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.

If the list for a particular instance contains no elements, it is projected as an empty string (and<br />

not an SQL NULL value).<br />

13.2.2.8 Stream Properties<br />

Both character stream properties and binary stream properties are projected as BLOBs (binary<br />

large objects).<br />

Refer to the chapter on Streams for more information.<br />

13.2.2.9 Transient and Calculated Properties<br />

Since transient and calculated properties are not stored on disk, by default, they have no SQL<br />

projection.<br />

For the projection to include these columns, use the SQLCOMPUTED keyword, which allows<br />

you to specify the code that calculates the value of an SQL computed field for the property;<br />

you can then add code to the property definition that calculates the value of the projected<br />

field. A property projected as a computed field can provide parallel object and SQL functionality<br />

through parallel computations.<br />

There are two ways to include code for a property's SQL computed field:<br />

• Write code that performs the calculations required to determine the computed field's<br />

value and associate it with the SQLCOMPUTECODE keyword.<br />

• Write code that performs the calculations required to determine the computed field's<br />

value and place it in a class method. Call this class method both from the code associated<br />

with the SQLCOMPUTECODE keyword (for the SQL projection) and from the property's<br />

Get method (for the object itself).<br />

With either approach, this code can include values based on other properties and systembased<br />

values. It can invoke class methods and user-defined functions.<br />

Two Types of Computed SQL Fields<br />

The Object-SQL Projection<br />

The kind of computed SQL field described above is only one of the two types of computed<br />

SQL fields:<br />

• Always Computed (described above) — The field value is not stored in the database, but<br />

calculated when needed upon retrieval.<br />

• Triggered Computed — The field value is stored in the database and is calculated upon<br />

INSERT/UPDATE if needed.<br />

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

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

Saved successfully!

Ooh no, something went wrong!