13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RDBMS Stored Procedure Details<br />

3–24<br />

The following types of temp-tables can support results sets:<br />

• Static — A temp-table whose schema is defined at compile time.<br />

• Dynamic — A temp-table whose schema is defined at run time. There are two types of<br />

dynamic temp-tables: dynamic-prepared and dynamic-unprepared.<br />

Keep in mind that you can pass handles of temp-tables that contain a mixed array. A mixed array<br />

is one in which some of the temp-table handle elements can be static while others can be<br />

dynamic. Also, note that a stored procedure supports the use of an INT64 data type in static and<br />

dynamic temp tables when the LOAD-RESULT-INTO phrase processes the procedure’s result set<br />

on the RUN-STORED-PROC statement.<br />

Using a temp-table handle with an unprepared dynamic temp-table<br />

When a temp-table handle points to an unprepared dynamic temp-table, the MS <strong>SQL</strong> <strong>Server</strong><br />

<strong>Data</strong><strong>Server</strong> defines the temp-table schema in the <strong>for</strong>m of the result sets record structure which<br />

is passed back to the <strong>Data</strong><strong>Server</strong> from the <strong>for</strong>eign data source. The data types defined <strong>for</strong> the<br />

temp-table schema are determined based on the default data type mapping that exists between<br />

the <strong>SQL</strong> data type and its equivalent <strong>OpenEdge</strong> default data type. Once the temp-table schema<br />

is dynamically established by the <strong>Data</strong><strong>Server</strong>, the result set begins to populate it.<br />

Recognize that there is the possibility of a small per<strong>for</strong>mance price to be paid when you build<br />

dynamic temp-tables. However, considering the database independence that this technique<br />

af<strong>for</strong>ds over building static temp-tables, you might consider the price of dynamically built<br />

temp-tables to be a small, reasonable one.<br />

Table 3–4 identifies the temp-table options <strong>for</strong> which you can plan and the requirements you<br />

must fulfill <strong>for</strong> each option.<br />

Table 3–4: Options to plan the temp-table layout <strong>for</strong> result sets<br />

To return a result set to this<br />

type of temp-table . . . Then the layout definition is . . .<br />

Static<br />

Dynamic-prepared state<br />

Defined by you; you must base the layout on the<br />

expected fields to be returned and each of these fields’<br />

data types so that the first field defined in the<br />

temp-table corresponds to the first column of the<br />

result set. This column matching and data type<br />

matching must be repeated successfully <strong>for</strong> each<br />

temp-table and its corresponding result set.<br />

Dynamic - unprepared state Not defined by you; the schema of the temp-table is<br />

based on the result-set schema and a mapping of<br />

default <strong>OpenEdge</strong> data types <strong>for</strong> each <strong>SQL</strong> type. For<br />

more details, see the “Details about a dynamic<br />

temp-table in an unprepared state” section on<br />

page 3–25.<br />

Note: Once the data is loaded into the temp-table, any updates made to the records in the<br />

temp-table are not propagated back to the <strong>for</strong>eign database. Result sets are available<br />

through temp-tables <strong>for</strong> the purpose of obtaining a snapshot of the data. For example,<br />

you can use this technique to populate a browser from a temp-table. You must re-read<br />

the record using the proper lock mechanism to actually update the record.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!