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

Starting in <strong>OpenEdge</strong> Release 10.1B, the default external representation of ROWID<br />

enables the MS <strong>SQL</strong> <strong>Server</strong> <strong>Data</strong><strong>Server</strong> to use a 64-bit integer value <strong>for</strong> ROWID. Also,<br />

be<strong>for</strong>e discussing ROWID as it relates to the RUN STORED-PROC statement, it is important<br />

to understand an important property of the <strong>OpenEdge</strong> ROWID. The “ROWID—Standard<br />

ABL behavior” section on page 154 presents this in<strong>for</strong>mation.<br />

ROWID—Standard ABL behavior<br />

The ROWID value of a temp-table buffer will be different than the ROWID value of a record<br />

BUFFER even if the underlying data is identical. This difference exists because the<br />

ROWID function relies on the record buffer name. Example 24 shows the standard,<br />

expected ABL behavior.<br />

DEFINE VARIABLE rid-1 AS ROWID NO-UNDO.<br />

DEFINE VARIABLE rid-2 AS ROWID NO-UNDO.<br />

DEFINE VARIABLE ttHandle AS HANDLE NO-UNDO EXTENT 1.<br />

DEFINE TEMP-TABLE ttCustomer LIKE Sports2000.Customer<br />

FIELD tRecid AS INTEGER<br />

FIELD tRECID_ident AS INTEGER.<br />

ttHandle[1] = TEMP-TABLE ttCustomer:HANDLE.<br />

FIND FIRST Customer WHERE Customer.CustNum = 1 NO-LOCK.<br />

rid-1 = ROWID(Customer).<br />

RUN STORED-PROC send-sql-statement<br />

LOAD-RESULT-INTO ttHandle (“select * from customer where custnum = 1”).<br />

rid-2 = ROWID(ttCustomer).<br />

IF rid-1 NE rid-2 THEN<br />

MESSAGE “The same record but different ROWID’s”.<br />

Example 24: Expected ABL behavior—ROWID value of a temp-table buffer<br />

The following sections illustrate the differences between the ROWID value of a<br />

temp-table buffer and the ROWID value of a record BUFFER so that you can best<br />

understand, program <strong>for</strong>, and leverage the use of the ROWID function with the<br />

LOAD-RESULT-INTO clause of the RUN STORED-PROCEDURE command.<br />

Using ROWID with RUN STORED-PROCEDURE and<br />

LOAD-RESULT-INTO<br />

In the previous section, Example 24 assumes you migrated your database to MS <strong>SQL</strong><br />

<strong>Server</strong> using the Create RECID Field option, as discussed in the “ROWID<br />

characteristics” section on page 153. Example 3-24 and all subsequent examples in<br />

this section show ROWID as being represented by the 8-byte integer value of the<br />

PROGRESS_RECID column as opposed to some other unique single-component index<br />

designated in your database to be the PROGRESS_RECID.<br />

Note: If you used a different single-component index to load the ROWID of a<br />

temp-table, you would need to map the column accordingly, just as the<br />

example maps PROGRESS_RECID.<br />

154 <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!