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.

Initial Programming Considerations<br />

2–54<br />

RECID values can be stored in an INTEGER data type. The internal bit size <strong>for</strong> the INTEGER data<br />

type is not expanded from 32-bit to a 64-bit field size. If the RECID value stored in the INTEGER<br />

data type does exceed 32 bits however, an overflow condition occurs. See the “Overflow<br />

checking” section on page 2–47.<br />

You can make an existing application that includes RECID behave more consistently across data<br />

sources by replacing RECID with ROWID. See the “ROWID function” section on page 2–52 <strong>for</strong><br />

more in<strong>for</strong>mation.<br />

DEFINE BROWSE statement<br />

The DEFINE BROWSE statement relies on a unique record identifier <strong>for</strong> <strong>for</strong>ward and backward<br />

scrolling. If your MS <strong>SQL</strong> <strong>Server</strong> data source table does not support the <strong>OpenEdge</strong> ROWID<br />

function (through either a PROGRESS_RECID column or an indexed column with unique values,<br />

defined as bigint in <strong>OpenEdge</strong> Release 10.1B and later or as integer in Release 10.A or<br />

earlier), you can write code that explicitly requests the default <strong>OpenEdge</strong> browse scrolling<br />

behavior, similar to this:<br />

DEFINE VARIABLE iRow AS INTEGER NO-UNDO.<br />

DEFINE QUERY q FOR customer FIELDS (custnum name address) SCROLLING NO-LOCK.<br />

DEFINE BROWSE b QUERY q DISPLAY custnum name address WITH 10 DOWN.<br />

DEFINE BUTTON upd.<br />

OPEN QUERY q FOR EACH customer NO-LOCK.<br />

ENABLE upd b WITH FRAME x.<br />

ON CHOOSE OF upd DO:<br />

iRow = CURRENT-RESULT-ROW("q").<br />

GET PREV q.<br />

GET NEXT q EXCLUSIVE-LOCK.<br />

IF CURRENT-RESULT-ROW("q") EQ iRow THEN<br />

UPDATE customer.address WITH FRAME z VIEW-AS DIALOG-BOX.<br />

/* else, indicate that an error occurred: the record was deleted in<br />

the meantime. */<br />

DISPLAY customer.address WITH BROWSE b.<br />

END.<br />

WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.<br />

Field lists<br />

The <strong>Data</strong><strong>Server</strong> fully supports the use of field lists in queries (DEFINE QUERY, FOR EACH,<br />

PRESELECT, and <strong>SQL</strong> SELECT statements). Using FIELD and EXCEPT clauses can greatly improve<br />

per<strong>for</strong>mance <strong>for</strong> NO-LOCK queries, particularly if the <strong>Data</strong><strong>Server</strong> is a remote configuration where<br />

the query results must be passed over a network. When a field list is used, unneeded data is not<br />

returned. The field list does not guarantee that it will restrict the data to the specified fields. It<br />

can be necessary to return additional fields such as those required to accommodate the values<br />

of a selected index.<br />

For example, the following statement returns the same results <strong>for</strong> an <strong>OpenEdge</strong> database and a<br />

MS <strong>SQL</strong> <strong>Server</strong> data source:<br />

DEFINE QUERY myquery FOR customer FIELDS (custnum name) SCROLLING.<br />

OPEN QUERY myquery FOR EACH customer NO-LOCK WHERE custnum LT 6<br />

BY customer.name.

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

Saved successfully!

Ooh no, something went wrong!