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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ROWID Support<br />

If the table uses computed-column PROGRESS_RECID option, then ttCustomer temp-table<br />

definition should be:<br />

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

FIELD tRecid AS ROWID /* Must be changed to ROWID type */<br />

FIELD tRECID_ident AS INT64<br />

FIELD tRECID_alt as INT64.<br />

Example 3–26 combines code from Example 3–24 and Example 3–25 by applying the results<br />

of the RUN STORED-PROC [LOAD-RESULT-INTO] technique, rather than an ABL query, to fill the<br />

TEMP-TABLE associated with a Pro<strong>Data</strong>Set.<br />

DEFINE VARIABLE hSend<strong>SQL</strong> AS HANDLE NO-UNDO EXTENT 1.<br />

DEFINE VARIABLE ph<strong>Data</strong>Set AS HANDLE NO-UNDO.<br />

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

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

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

FIELD tRecid AS ROWID /* Must be changed to ROWID type */<br />

FIELD tRECID_ident AS INT64.<br />

hSend<strong>SQL</strong>[1] = TEMP-TABLE ttCust:HANDLE.<br />

DEFINE DATASET dsCustomer FOR ttCustomer.<br />

DEFINE QUERY qCustomer FOR Customer.<br />

ph<strong>Data</strong>Set=DATASET dsCust:HANDLE.<br />

DEFINE DATA-SOURCE srcCustomer FOR QUERY qCust.<br />

BUFFER ttCustomer:HANDLE:ATTACH-DATA-SOURCE<br />

(DATA-SOURCE srcCustomer:HANDLE,?,?,?).<br />

FIND FIRST Customer WHERE Customer.CustNum = 1 NO_LOCK.<br />

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

/* Populate the ttCustomer Temp-Table */<br />

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

LOAD-RESULT-INTO hSend<strong>SQL</strong> (“select * from customer”).<br />

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

rid-2 = ttCustomer.tRecid.<br />

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

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

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

MESSAGE “Congratulations - we have the same ROWID’s”.<br />

MESSAGE STRING(ttCustomer.tRecid) VIEW-AS ALERT-BOX.<br />

Example 3–26: Using the LOAD-RESULT-INTO technique to populate the<br />

underlying Temp-Table of a Pro<strong>Data</strong>Set<br />

Keep the following key points in mind regarding Example 3–26:<br />

• The TEMP-TABLE field that is mapped to the PROGRESS_RECID column should be changed<br />

from its standard definition of INTEGER to ROWID.<br />

In Example 3–26, the result column location where PROGRESS_RECID is being returned has<br />

been named tRecid in the temp-table. The PROGRESS_RECID_IDENT has been renamed<br />

tRECID_ident. This renaming occurs in Example 3-26 because of the following line:<br />

3–35

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

Saved successfully!

Ooh no, something went wrong!