persistent class %SYS.PTools.SQLQuery
extends %Persistent
This is the parent class of %SYS_PTools.SQLStats.
This class stores the general info of a query from compile time: QueryText, QueryType, CursorName, RoutineName, and NameSpace.
All of the run time data is stored in the %SYS_PTools.SQLStats class.
Error information is stored in ^%SYS.PTools.SQLQuery("Error",$j)
Caché SQL Manager.
These classes are storing the data in globals that default to the %SYS NameSpace: ^%SYS.PTools.SQLQueryD, ^%SYS.PTools.SQLQueryC, and ^%SYS.PTools.SQLQueryI.
If you are going to run this on a large system for some time you might want to create global mapping to move these globals out of %SYS to a different database.
property CompileTime
as %Numeric;
Number of Seconds it takes to compile the query
property CursorName
as %String;
What is the name of the cursor for this SQL Statement
property InternalQueryText
as %String(MAXLEN=15000,TRUNCATE=1);
property NameSpace
as %String;
What NameSpace the SQL was generated in
property QueryText
as %String(MAXLEN=15000,TRUNCATE=1) [ Calculated ];
Store the first 15000 charactors of the SQL Query in this field.
property QueryType
as %String;
Is the Query an INSERT UPDATE DELETE or SELECT query
property RoutineName
as %String;
What Routine is the SQL generated in
relationship SQLStatsPointer
as %SYS.PTools.SQLStats [ Inverse = SQLQueryPointer,Cardinality = children ];
classmethod NewQuery(ByRef SQLText As %String, SQLType As %String, NameSpace As %String, RoutineName As %String, CursorName As %String, CompileTime As %Numeric = 0)
as %Status
This method is called at compile time for a query
It deletes all current stats for this query, as they could be very different after the compile
index (master on NameSpace,RoutineName,CursorName) [IdKey,Unique];