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.

Query Basics<br />

Final<br />

Specifies that subclasses cannot override the query. By default, queries are not final.<br />

SQLQuery<br />

SQLProc<br />

Specifies the code to execute when the query is run. Use this keyword if the query<br />

uses SQL (that is, is not user-written).<br />

Specifies that the query can also be accessed as an SQL stored procedure. By default,<br />

a query is not projected as a stored procedure.<br />

Type<br />

Specifies whether the query contains SQL or <strong>Caché</strong> ObjectScript code. By default,<br />

the query contains SQL code.<br />

8.1.3 Creating a Class Query Specification<br />

A query needs to contains information about its contents and the order of the fields returned<br />

for each row of its results. To provide this information, user-written queries include what is<br />

called a specification.<br />

A specification has one or two parameters modifying the query. These parameters are:<br />

• CONTAINID — This optional parameter specifies which field, if any, contains the ID<br />

for a particular row.<br />

• ROWSPEC — This parameter provides information on the names, data types, headings,<br />

and order of the fields in each row of the query's result set.<br />

8.1.3.1 About CONTAINID<br />

CONTAINID should be set to the number of the column returning the ID (1, by default) or<br />

to 0 if no column returns the ID. If you create a query using the New Query Wizard, then<br />

Studio automatically assigns the appropriate value to CONTAINID, based on the order in<br />

that wizard's Columns page.<br />

Note:<br />

<strong>Caché</strong> does not validate the value of CONTAINID. If you specify a non-valid value<br />

for this parameter, <strong>Caché</strong> does not throw an error. This means that if your query<br />

processing logic depends on this information, you may experience inconsistencies<br />

if the CONTAINID parameter is set improperly.<br />

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

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

Saved successfully!

Ooh no, something went wrong!