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.

Record creation<br />

The VALIDATE or RELEASE statement causes the <strong>Data</strong><strong>Server</strong> to write the customer 111 record to<br />

the database be<strong>for</strong>e the FIND statement occurs. Using the VALIDATE or RELEASE statements<br />

<strong>for</strong>ces a write to the data source even if the transaction has not yet completed. This makes the<br />

record available in the local database cache and it will be found if the record must be re-read<br />

be<strong>for</strong>e the end of the transaction.<br />

Note: If you set the default value when creating a record, you must change the value be<strong>for</strong>e<br />

you create another record with the default value if the field is part of a unique key.<br />

Otherwise, the second record will cause a duplicate key error.<br />

Record updates are handled similarly to record creation. A record is updated in a MS <strong>SQL</strong><br />

<strong>Server</strong> data source at the end of record scope or at the end of a transaction, whichever comes<br />

first. For example, when you run the following procedure, the newly updated record is not<br />

found:<br />

FIND customer WHERE customer.custnum EQ 12.<br />

DO TRANSACTION.<br />

ASSIGN customer.address = "14 Oak Park".<br />

FIND customer WHERE customer.address EQ "14 Oak Park".<br />

END.<br />

To send the record to the data source sooner, use the VALIDATE statement, as follows:<br />

FIND customer WHERE customer.custnum EQ 12.<br />

DO TRANSACTION:<br />

ASSIGN customer.address = "14 Oak Park".<br />

VALIDATE customer.<br />

FIND customer WHERE customer.address EQ "14 Oak Park".<br />

END.<br />

For more in<strong>for</strong>mation about record scoping and transaction behavior, see <strong>OpenEdge</strong> Getting<br />

Started: ABL Essentials.<br />

2–35

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

Saved successfully!

Ooh no, something went wrong!