Cursor lock and sql command

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Sat Jul 26 10:17:27 CDT 2014


On 7/26/14, 10:14 AM, "François Van Lerberghe" <frvanlerberghe at gmail.com>
wrote:

Hi François, 
 
> I do not see it in the documentation.
> Is a SQL command ("UPDATE" for example) doing some lock on the updated
> record ?
> Is it good if I create a Vcursor with EVLockType.kReadOnly (or kReadWrite)
> and next I do a sqlExecute("UPDATE...") on one record included in the first
> locked cursor or is a valentina exception raised ?

Few points

* Locks set only Vcursor.
        curs = SqlSelect( "SELECT...",   kLockWhich  )

* Cursor lives long time, so it needs locks.


* Having cursor, you can do
        curs.UpdateRecord()

      instead issue "UPDATE ..."  SQL command as string.


* If separate UPDATE command want touch record, which is locked by another
user ReadOnly / ReadWrite, then UPDATE will fails.



* UPDATE command is atomic, as others.
    so if it finds NOT locked record(s),
    then it updates it without any locks ... Because atomic



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list