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.

Interfacing with RDBMS stored procedures<br />

Table 23: 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 />

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

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

are available through temp-tables <strong>for</strong> the purpose of obtaining a snapshot of<br />

the data. For example, you can use this technique to populate a browser from<br />

a temp-table. You must re-read the record using the proper lock mechanism to<br />

actually update the record.<br />

Details about a dynamic temp-table in an unprepared state<br />

A dynamic temp-table is considered to be in an unprepared state after the first<br />

definitional method is called until the temp-table is prepared. If a clear dynamic<br />

temp-table handle is passed, the <strong>Data</strong><strong>Server</strong> populates the temp-table schema based<br />

on the result-set schema and prepares the temp-table. A clear dynamic temp-table is<br />

a table that is in an unprepared state where definitional methods have not yet been<br />

called. The <strong>Data</strong><strong>Server</strong> then executes the temp-table handle: ADD-NEW-FIELD (field<br />

name, data type) internally <strong>for</strong> each one of the columns of the result set. If a column in<br />

the result set from the <strong>for</strong>eign schema does not have a name (<strong>for</strong> example, an array<br />

element field or a <strong>SQL</strong>-derived field), the <strong>Data</strong><strong>Server</strong> assigns a name to it based on the<br />

column position on the row.<br />

For example, if you run the following statement, then the temp-table contains these<br />

columns:<br />

• Column 1<br />

• Cust_num<br />

• Name<br />

• Column 4<br />

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

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

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

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

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

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

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

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

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

of default <strong>OpenEdge</strong> data types <strong>for</strong> each <strong>SQL</strong><br />

type. For more details, see the “Details about a<br />

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

section on page 145.<br />

/* */<br />

SELECT “mytag,” cust_num, name, (salary * 0.10) FROM <br />

<strong>OpenEdge</strong> <strong>Data</strong> <strong>Management</strong>: <strong>Data</strong><strong>Server</strong> <strong>for</strong> <strong>Microsoft</strong> <strong>SQL</strong> <strong>Server</strong> 145

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

Saved successfully!

Ooh no, something went wrong!