11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - 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.

<strong>Caché</strong> <strong>ObjectScript</strong> Functions$INCREMENT and Transaction ProcessingThe common usage for $INCREMENT is to increment a counter before adding a new entryto a database. $INCREMENT provides a way to do this very quickly, avoiding the use ofthe LOCK command and, in distributed environments, avoiding synchronous network trips.The trade-off for this is that the counter is not locked. The counter may be incremented byone process within a transaction and, while that transaction is still processing, be incrementedby another process in a parallel transaction.In the event either transaction (or any other transaction that uses $INCREMENT) must berolled back (with the TROLLBACK command), counter increments are ignored. The countervariables are not decremented since it is not clear whether the resulting counter value wouldbe valid. In all likelihood, such a rollback would be disastrous for other transactions.See Also• TROLLBACK command• $GET function• $ZINCREMENT function• Using <strong>ObjectScript</strong> for Transaction Processing in Using <strong>Caché</strong> <strong>ObjectScript</strong>$INUMBERValidates a numeric value and converts it to internal format.$INUMBER(fnumber,format,erropt)$IN(fnumber,format,erropt)ParametersfnumberformaterroptThe numeric value to be converted to the internal format. It can be anumeric or string value, a variable name, or any valid <strong>Caché</strong> <strong>ObjectScript</strong>expression.A format specification indicating which external numeric formats are validrepresentations of numbers. It is a string consisting of one or more validformat codes described below.Optional — The expression returned if fnumber is considered invalidbased on format.224 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!