One of the defining features of client-server computing is that many clients
may be accessing the server simultaneously. This feature means that several
clients may access the same table or record simultaneously. In Oracle this issue is
generally resolved using locks. Locks allow one client to restrict other client’s use of a table or record. Locks are placed temporarily on database entities
to prevent confusion and data corruption.
When you use Oracle Objects for OLE, locks are not placed on data until an ODynaset executes the StartEdit method. The StartEdit method attempts to obtain a lock (using "SELECT ... FOR UPDATE") on the
current record of the dynaset. This is done as late as possible to minimize the time
that locks are placed on the records. The StartEdit method can fail for several reasons:
· The SQL query violates Oracle SQL updatability rules, for instance, by using
calculated columns or table joins.
· The user does not have the privileges needed to obtain a lock.
· Another user has already locked the record. The ODatabase::Open method has an option so that you can decide whether to wait on locks.