|
<< Click to Display Table of Contents >> SQL record modification behavior |
![]() ![]()
|
The following characteristics describe record modification behavior:
•All current record modifications use optimistic locking. An optimistic lock must be explicitly requested, but the lock request does not attempt to explicitly lock the record on the server.
•Except for an explicit client transaction, all modifications are singleton operations. This means that upon successful completion, each modification is autocommitted.
•Transaction or batch request overrides singleton behavior.
Record Modification Example
The SQL driver saves a copy of the record as an optimistic lock. The application changes the record buffer data:
DbiGetNextRecord (hCursor, dbiWRITELOCK, &myRecBuff, NULL);
The SQL driver uses the saved record copy to find and modify the data:
DbiModifyRecord (hCursor, &myRecBuff, TRUE);
UPDATE Customer
SET Name = "Harold"
WHERE Id = 12321 AND Name = "Harry"
Then the SQL driver verifies the resulting rows changed:
-If one row changed, optimism has paid off.
-If no rows changed, the optimistic lock was broken.
-If more than one row changed, there was no unique index
and the optimistic lock was broken.