List:NDB Connectors« Previous MessageNext Message »
From:Stewart Smith Date:November 22 2007 4:00am
Subject:Re: Any substitute for FOR UPDATE
View as plain text  
On Mon, 2007-10-29 at 15:10 +0100, Hasnain Muhammad Iqbal wrote:
> we need to implement the ndb equivalent of the sql "FOR UPDATE" statement.
> Does anyone know how we can do this using NDB Api/ NDBJ Api or whether this
> is supported by the ndb engine. Is there a way we can work around this
> problem. we are basically using FOR UPDATE for maintaining a lock on a db by
> a broker

Perform read with appropriate lock (exclusive).

(From NdbOperation.hpp:)
  enum LockMode {
    LM_Read                 ///< Read with shared lock
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
    = 0
#endif
    ,LM_Exclusive           ///< Read with exclusive lock
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
    = 1
#endif
    ,LM_CommittedRead       ///< Ignore locks, read last committed value
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
    = 2,
    LM_Dirty = 2,
#endif
    LM_SimpleRead = 3       ///< Read with shared lock, but release lock
directly
  };

-- 
Stewart Smith, Senior Software Engineer (MySQL Cluster)
MySQL AB, www.mysql.com
Office: +14082136540 Ext: 6616
VoIP: 6616@stripped
Mobile: +61 4 3 8844 332

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Thread