Skip to main content

EnsLib.SQL.Common

abstract class EnsLib.SQL.Common extends EnsLib.SQL.CommonJ

Property Inventory

Method Inventory

Properties

property ConnectAttrs as %String [ Calculated ];
Deprecated: use ConnectionAttributes You can set this property in your Operation/Service .OnInit() method to have the options take effect at connect time.
Property methods: ConnectAttrsDisplayToLogical(), ConnectAttrsIsValid(), ConnectAttrsLogicalToDisplay(), ConnectAttrsLogicalToOdbc(), ConnectAttrsNormalize()
property Connected as %Boolean [ InitialExpression = 0 ];
True if currently connected to datasource, else False
Property methods: ConnectedDisplayToLogical(), ConnectedGet(), ConnectedIsValid(), ConnectedLogicalToDisplay(), ConnectedNormalize()
property IsUnicodeDLL as %Boolean [ InitialExpression = 1 ];
Property methods: IsUnicodeDLLDisplayToLogical(), IsUnicodeDLLGet(), IsUnicodeDLLIsValid(), IsUnicodeDLLLogicalToDisplay(), IsUnicodeDLLNormalize(), IsUnicodeDLLSet()
property StatementAttrs as %String;
A set of SQL Statement Attribute Options of the form attr:val,attr:val,... Set this property to have the options take effect for every statement subsequently created. Do this in your Business Operation's OnInit() method. For example: Set ..Adapter.StatementAttrs="QueryTimeout:12"
Property methods: StatementAttrsDisplayToLogical(), StatementAttrsGet(), StatementAttrsIsValid(), StatementAttrsLogicalToDisplay(), StatementAttrsLogicalToOdbc(), StatementAttrsNormalize(), StatementAttrsSet()
property attrIDs as %Integer [ MultiDimensional ];
Array holding name-to-number mappings for SQL_ATTR_ values
Property methods: attrIDsDisplayToLogical(), attrIDsGet(), attrIDsIsValid(), attrIDsLogicalToDisplay(), attrIDsNormalize(), attrIDsSet()

Methods

method Commit() as %Status
method Connect(pClientTimeout As %Numeric = 15, pInbound As %Boolean = 0, pJGTimeout As %Numeric = 5) as %Status
Connect to the data source
method ConnectAttrsGet() as %String
method ConnectAttrsSet(val As %String) as %Status
method ConnectedSet(pValue As %Boolean) as %Status
classmethod ConvertSQLTypeToInt(pSQLType) as %Integer
method DSNSet(dsn As %String) as %Status
method Disconnect(pInbound As %Library.Boolean = 0)
Disconnect from the datasource
method ExecuteProcedure(ByRef pResultSnapshots As %ListOfObjects, Output pOutputParms As %ListOfDataTypes, pQueryStatement As %String, pIO As %String, pInputParms...) as %Status
Execute a stored procedure SQL Call statement. A variable number of parameters may be passed in addition to the query string. Results are returned as a new EnsLib.SQL.Snapshot objects in the pResultSnapshots output list. If you pass in a list with pre-instantiated EnsLib.SQL.Snapshot objects, ExecuteProcedure will populate the Snapshot objects using the values of their FirstRow and MaxRowsToGet properties to limit the set of rows it will retrieve. The pOutputParms list returns the output values of all scalar output and input/output parameters. If the procedure returns a scalar return value and your statement retrieves it, this value will be the first output value. The pIO argument is optional; it is not needed unless the particular ODBC driver omits support for DescribeProcedureColumns. If given it is a text string in which each character corresponds to one of the query parameters. The character 'i' means the corresponding parameter is an Input parameter. The character 'o' means it is an Output parameter, and 'b' means it is Both an Input and an Output parameter. Appending a '*' to the pIO argument prevents the adapter from calling ODBC DescribeProcedureColumns() to get parameter info, forcing the use of the types listed in the pIO string; otherwise the adapter will log warnings if the parameter types listed in pIO differ from those retrieved using DescribeProcedureColumns(). Appending a '#' to the pIO argument (or passing only '#') prevents the adapter from using cached DescribeColumns() results for the procedure call output, forcing a fresh call to ODBC DescribeColumns() every time the stored procedure is invoked. This can be necessary if the procedure is capable of returning different sequences of result types from consecutive invocations. After the pIO argument, you should add an argument with the value of each Input or Input/Output parameter.
method ExecuteProcedureParmArray(ByRef pResultSnapshots As %ListOfObjects, Output pOutputParms As %ListOfDataTypes, pQueryStatement As %String, pIO As %String = "", ByRef pIOParms) as %Status
Execute a stored procedure SQL Call statement. Any number of parameters may be passed in the multidimensional pIOParms array. For DSNs using ODBC drivers that don't support SQLDescribeParam: IOType, SqlType, CType, Prec, and Scale may be specified as sub-nodes of the node for each parameter. If pIO is given, it is a string of IO types for the statement parameters as described for ExecuteProcedure() above. If pIO is not given the IO types for the parameters may be given under an "IOType" subscript for each parameter in the pIOParms array. This means that Output parameters must also be included in the array, but the top node for each of these must be left undefined. If the parameters in the pParms array have descriptor subscripts, then these are used and the SQLDescribeParam query is not done. (This is determined by checking for a "SqlType" or "CType" subscript under the first parameter: pParms(1,"SqlType") ).
method ExecuteQuery(ByRef pRS As EnsLib.SQL.GatewayResultSet, pQueryStatement As %String, pParms...) as %Status
Execute a query. A variable number of parameters may be passed in addition to the query string. Results are returned as a new EnsLib.SQL.GatewayResultSet object in the pRS output argument, unless you pass in a EnsLib.SQL.Snapshot object for the pRS argument. In that case, ExecuteQuery will populate the Snapshot object instead, using the values of its FirstRow and MaxRowsToGet properties to choose the set of rows it will represent.
method ExecuteQueryParmArray(ByRef pRS As EnsLib.SQL.GatewayResultSet, pQueryStatement As %String, ByRef pParms) as %Status
Execute a query. Any number of parameters may be passed in the multidimensional pParms array. For DSNs using ODBC drivers that don't support SQLDescribeParam: SqlType, CType, Prec, and Scale may be specified as sub-nodes of the node for each parameter. If the parameters in the pParms array have descriptor subscripts, then these are used and the SQLDescribeParam query is not done. (This is determined by checking for a "SqlType" or "CType" subscript under the first parameter: (pParms(1,"SqlType"))).
method ExecuteUpdate(Output pNumRowsAffected As %Integer, pUpdateStatement As %String, pParms...) as %Status
Execute an Update, Insert or Delete. A variable number of parameters may be passed in addition to the query string. The pNumRowsAffected output value is the number of rows affected.
method ExecuteUpdateParmArray(Output pNumRowsAffected As %Integer, pUpdateStatement As %String, ByRef pParms) as %Status
Execute an Update, Insert or Delete. Any number of parameters may be passed in the multidimensional pParms array. For DSNs using ODBC drivers that don't support SQLDescribeParam: SqlType, CType, Prec, and Scale may be specified as sub-nodes of the node for each parameter. If the parameters in the pParms array have descriptor subscripts, then these are used and the SQLDescribeParam query is not done. (This is determined by checking for a "SqlType" or "CType" subscript under the first parameter: pParms(1,"SqlType") ).
method OnTearDown() as %Status
method Rollback() as %Status
method SetAutoCommit(pAutoCommit=1) as %Status
Set AutoCommit on or off for this adapter connection This will only work after the DSN connection is established. Set the ConnectAttrs property in your Operation/Service .OnInit() method if you want to set this at connect time.
method SetConnectAttr(pAttrName As %String, pVal As %String) as %Status
method TestConnection(pInbound As %Boolean = 0)
method addErrorList(pSC, pHS, ByRef pNetErr=0) as %Status
method getProcedureParameters(ByRef pQuery As %String, Output pParmDescs As %List, Output pNetErr, pSubstLiteralVals As %Boolean = 0) as %Status
method putLOBStream(pHS As %String, pStream As %Stream.Object, tBin As %Boolean) as %Status
method putLOBStreams(pHS As %String, ByRef pIOParms As %String) as %Status

Inherited Members

Inherited Properties

Inherited Methods

Subclasses

FeedbackOpens in a new tab