DEFINE VARIABLE hSendSQL AS HANDLE NO-UNDO EXTENT 1.
DEFINE VARIABLE phDataSet AS HANDLE NO-UNDO. DEFINE VARIABLE rid-1 AS ROWID NO-UNDO. DEFINE VARIABLE rdi-2 AS ROWID NO-UNDO. DEFINE TEMP-TABLE ttCustomer LIKE Sports.Customer FIELD tRecid AS ROWID FIELD tRECID_ident AS INTEGER. hSendSQL[1] = TEMP-TABLE ttCustomer:HANDLE. DEFINE DATASET dsCustomer FOR ttCustomer. DEFINE QUERY qCustomer FOR Customer. phDataSet = DATASET dsCustomer:HANDLE. phDataSet:SET-CALLBACK-PROCEDURE ("BEFORE-FILL", "preDataSetFill", THIS-PROCEDURE). DEFINE DATA-SOURCE srcCustomer FOR QUERY qCustomer. BUFFER ttCustomer:HANDLE:ATTACH-DATA-SOURCE (DATA-SOURCE srcCustomer:HANDLE,?,?,?). DATASET dsCustomer:FILL(). FIND FIRST Customer WHERE Customer.CustNum = 1 NO-LOCK. rid-1 = ROWID(Customer). FIND FIRST ttCustomer WHERE ttCustomer.CustNum = 1 NO-LOCK. rid-2 = ttCustomer.tRecid. IF rid-1 NE rid-2 THEN MESSAGE "The same record but different ROWID's". IF rid-1 EQ rid-2 THEN MESSAGE "Congratulations - we have the same ROWID's". MESSAGE STRING(ttCustomer.tRecid) VIEW-AS ALERT-BOX. PROCEDURE preDataSetFill: DEFINE INPUT PARAMETER DATASET FOR dsCustomer. DEFINE VARIABLE handle1 AS INTEGER NO-UNDO. DEFINE VARIABLE hSendSQL AS HANDLE NO-UNDO EXTENT 1. hSendSQL[1] = TEMP-TABLE ttCustomer:HANDLE. IF DBTYPE(NUM-DBS) NE "PROGRESS" THEN DO: DISPLAY "DataServer FILL using SEND-SQL". BUFFER ttCustomer:HANDLE:FILL-MODE = "NO-FILL". RUN STORED-PROC send-sql-statement LOAD-RESULT-INTO hSendSQL ("select * from customer"). END. ELSE DO: /* normal OpenEddge FILL procedure */ DISPLAY "Native Progress FILL". QUERY qCustomer:QUERY-PREPARE("FOR EACH Customer"). END. END PROCEDURE. /* preDataSetFill */ |