Dababase Key Scope
Question
The scope of dbkeys can be set to COMMIT or FINISH. But what events, other than
deleting the record, can invalidate (or change) a dbkey?
Answer
The scope of dbkeys is an architectural restriction and in fact is not implemented
(currently) as strictly as stated. It is there for possible future enhancements. That
said, I would not write any code that did not adhere to the current dbk scope as
documented.
To really answer the question:
The dbkey will change if the record is deleted. If you specify scope is transaction and
then use the dbk again in a later transaction, you run the risk of seeing another record
not related to the first record fetched.
For instance:
If I use the following (logicall):
ATTACH DATABASE FOO DBK SCOPE IS COMMIT START_TRANS
READ_ONLY FETCH EMPLOYEE FEENAN RETAIN THE DBK COMMIT START_TRANS READ_WRITE FETCH DBK
UPDATE EMPLOYEE... COMMITYou could be updating not EMPLOYEE FEENAN but someone else.
I know that this example has a number of other semantical problems in terms of the
application, but it is an example.
IF you used DBK SCOPE is FINISH then the employee that you would update would either
be:
FEENANor
you would receive an error stating that the DBK no longer exists.
Cheers,
-Jay Feenan
***opinions expressed here are totally my own and not those of my employer***

Copyright © 1995, JCC Consulting, Inc. All rights reserved. Proprietary to JCC
Consulting, Inc. Information retrieved from this server may be used for internal purposes
only and may not be posted elsewhere without written permission. Information
accessible from this server is provided on an as-is basis. JCC exercises no editorial
control over the information provided, except that written by JCC dealing with JCC
services and products. JCC and the JCC logo are trademarks of JCC Consulting, Inc.
The look of the signs or header panels is a trademark of JCC Consulting, Inc.
Oracle is a registered trademark of Oracle Corporation. ORACLE Rdb is a trademarks
of Oracle Corporation.