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.

The Object-SQL Projection<br />

13.2.2.1 Property Names and Column Names<br />

If you want to give a property's projected column a different name, use the property keyword<br />

SQLFIELDNAME. For instance, if there is a %String property called “select,” you would define<br />

its projected name with the following syntax:<br />

Property select As %String [ SqlFieldName = selectfield ];<br />

If a property's name is an SQL reserved word, you need to specify a different name for its<br />

projection.<br />

13.2.2.2 Column Numbers for Properties<br />

<strong>Caché</strong> automatically assigns a unique column number for each property. If you wish to control<br />

column number assignments, you can specify the column for a property's projection. To do<br />

this, use the property keyword SQLCOLUMNNUMBER, as in the following example:<br />

Property RGBValue As %String [ SqlColumnNumber = 3 ];<br />

The value you specify for SQLCOLUMNNUMBER must be an integer greater than 1 (one) and<br />

specifies the property's column number in the projected table. If you use the<br />

SQLCOLUMNNUMBER keyword without an argument, <strong>Caché</strong> assigns a column number that<br />

is not preserved and that has no permanent position in the table's columns.<br />

If any property has an SQL column number specified, then <strong>Caché</strong> assigns column numbers<br />

for the other properties. The starting value for the assigned column numbers is the number<br />

following the highest SQL column number specified.<br />

The value of the SQLCOLUMNNUMBER keyword is inherited.<br />

13.2.2.3 Data Type Properties<br />

Data type properties are projected as fields using the property's SQL category (defined with<br />

the SQLCATEGORY keyword) and any of its parameters. Both relational and object access<br />

use the same data type classes, invoke the same data type methods to perform data validation<br />

and conversions, and use data type parameter values in the same way. This is true for both<br />

system-provided and user-written data type classes.<br />

For example, the following property definition:<br />

Property Name As %String(MAXLEN = 30);}<br />

is projected as a field in a relational table containing a string with a maximum length of 30<br />

characters.<br />

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

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

Saved successfully!

Ooh no, something went wrong!