Progress
DataServer
for ODBC Guide
Record Creation
Record creation is handled differently for Progress databases and ODBC data sources accessed through the DataServer. The difference occurs because Progress code run against a Progress database follows different record-scoping rules than Progress code run against an ODBC data source. The code fragments in this section illustrate these differences.
Suppose that you have a table called cust with a field called cust-num that is defined as an indexed field, and you write the following procedure:
When you run this procedure:
- Progress does not create the record at the CREATE statement. Instead, it writes it to the database at the end of the record scope or when the index information is supplied, whichever occurs first. In this example, Progress writes the record after executing the statement cust-num = 10.
- The DataServer writes the record at the end of the record scope. In this example, it writes the record after executing the statement END.
The following procedure also illustrates the differences between Progress and DataServer record creation:
In this procedure, the code creates a customer, sets cust-num equal to 111, then finds and displays the customer record using cust-num (the unique index). In this case:
To get a consistent response from the DataServer, use this procedure instead:
The VALIDATE or RELEASE statement causes the DataServer to write the customer 111 record to the database before the FIND statement occurs.
NOTE: If you set the default value when creating a record, you must change the value before you create another record with the default value if the field is part of a unique key. Otherwise, the second record will cause a duplicate key.Record updates are handled similarly to record creation. A record is updated in an ODBC data source at the end of record scope or at the end of a transaction, whichever comes first. For example, when you run the following procedure, the newly updated record is not found:
To send the record to the data source sooner, use the VALIDATE statement, as follows:
For more information about record scoping and transaction behavior, see the Progress Programming Handbook.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |