Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
mation. Again, this method deletes all the instances of the specified class, as well as all<br />
instances of its subclasses.<br />
For example, to delete all Person objects (including all instances of subclasses of Person)<br />
use the following code:<br />
Do ##class(Person).%DeleteExtent()<br />
The %DeleteExtent method will execute any %OnDelete callback methods, if present, for<br />
each object it deletes.<br />
You can also delete all instances of a class and its subclasses using the faster, but dangerous,<br />
%KillExtent method:<br />
Do ##class(Classname).%KillExtent()<br />
Executing Queries<br />
The %KillExtent method immediate kills all data associated with a class extent; no callbacks<br />
are executed and no referential actions are performed. You should only use the %KillExtent<br />
method on developmental systems on which you have no real data.<br />
10.7 Executing Queries<br />
<strong>Caché</strong> provides %ResultSet objects for executing queries and processing the results.<br />
This involves several steps:<br />
1. Preparing the query<br />
2. Executing the query<br />
3. Processing the query results<br />
4. Closing the query<br />
10.7.1 Query Metadata Methods<br />
To use a query, associate it with a %ResultSet object and you can then manipulate in a number<br />
of ways. The methods available for these operations are:<br />
• ContainsId checks if the query returns object ID values. It returns an integer value<br />
specifying the column number of the ID, if there is one; otherwise, it returns 0.<br />
• GetParamCount returns an integer specifying the number of arguments that the query<br />
takes.<br />
<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 83