25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Object Concurrency<br />

Note:<br />

You can use this set of features to implement optimistic concurrency.<br />

To implement a concurrency check in an SQL update statement for a class where<br />

VERSIONPROPERTY refers to a property called InstanceVersion, the code would be something<br />

like:<br />

SELECT InstanceVersion,Name,SpecialRelevantField,%ID<br />

FROM my_table<br />

WHERE %ID = :myid<br />

// Application performs operations on the selected row<br />

UPDATE my_table<br />

SET SpecialRelevantField = :newMoreSpecialValue<br />

WHERE %ID = :myid AND InstanceVersion = :myversion<br />

where myversion is the value of the version property selected with the original data.<br />

204 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!