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.

Chapter 3: RDBMS Stored Procedure Details<br />

Creating a temp-table layout plan<br />

When using static or prepared dynamic temp-tables, you must define the temp-table<br />

layout in your application program to accommodate specific result sets be<strong>for</strong>e you<br />

attempt to populate the temp-tables with data. If a <strong>SQL</strong> statement retrieves more than<br />

one results set, you must define multiple temp-tables to be able to retrieve all the data.<br />

There<strong>for</strong>e, the success of this approach depends to a large extent on your:<br />

• Understanding of the specific data your <strong>for</strong>eign data source is providing you<br />

through a given stored procedure<br />

• Ability to correctly define temp-tables<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<br />

types of 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<br />

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

others can be dynamic. Also, note that a stored procedure supports the use of an<br />

INT64 data type in static and dynamic temp tables when the LOAD-RESULT-INTO<br />

phrase processes the procedure’s result set 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><br />

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

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

data types defined <strong>for</strong> the temp-table schema are determined based on the default data<br />

type mapping that exists between the <strong>SQL</strong> data type and its equivalent <strong>OpenEdge</strong><br />

default data type. Once the temp-table schema is dynamically established by the<br />

<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<br />

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

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

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

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

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

144 <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>

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

Saved successfully!

Ooh no, something went wrong!