IRISLIB database
SQLGatewayConnection Class Reference

The SQLGatewayConnection class provides low-level access to the SQLGateway. More...

Inheritance diagram for SQLGatewayConnection:
Collaboration diagram for SQLGatewayConnection:

Public Member Functions

_.Library.Status AllocateStatement (hstmt)
 Method AllocateStatement(hstmt) invokes SQLAllocHandle and creates the corresponding structures in the SQL Gateway.
 
 BindParameter (hstmt, _.Library.Integer ParameterNumber, _.Library.Integer IOType, _.Library.Integer ValueType, _.Library.Integer ParameterType, _.Library.Integer ColumnSize, _.Library.Integer DecimalDigits, _.Library.Integer StrLen)
 BindParameter is calling SQLBindParameter with the corresponding values, the buffer length is guaranteed to be not less then StrLen.
 
_.Library.Status BindParameters (hstmt, _.Library.List ptype, _.Library.List dtype, _.Library.List precision, _.Library.List scale, _.Library.List cd)
 BindParameters is used for binding all the parameters for a given statement handle. More...
 
_.Library.Status CloseCursor (hstmt)
 Method CloseCursor(hstmt) invokes SQLCloseCursor .
 
_.Library.Status ColumnPrivileges (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String ColumnName)
 Method ColumnPrivileges invokes SQLColumnPrivileges. More...
 
_.Library.Status ColumnPrivilegesW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String ColumnName)
 The wide version of Columns. More...
 
_.Library.Status Columns (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String ColumnName)
 Method Columns invokes SQLColumns. More...
 
_.Library.Status ColumnsW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String ColumnName)
 The wide version of Columns. More...
 
_.Library.Status Connect (dsn, usr, pwd, timeout)
 The method Connect is used for establishing connection to a DSN. More...
 
_.Library.Status DescribeColumns (hstmt, _.Library.List clist)
 Method DescribeColumns returns a list with column information in a second argument. More...
 
_.Library.Status DescribeParameters (hstmt, _.Library.List plist)
 Method DescribeParameters returns a list with parameter information in a second argument. More...
 
_.Library.Status DescribeProcedureColumns (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String ProcName, _.Library.String ColumnName)
 Method DescribeProcedureColumns invokes SQLProcedureColumns. More...
 
_.Library.Status DescribeProcedureColumnsW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String ProcName, _.Library.String ColumnName)
 Method DescribeProcedureColumns invokes SQLProcedureColumns. More...
 
_.Library.Status DescribeProcedures (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String ProcName)
 Method DescribeProcedures invokes SQLProcedures. More...
 
_.Library.Status DescribeProceduresW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String ProcName)
 Method DescribeProcedures invokes SQLProcedures. More...
 
_.Library.Status Disconnect ()
 Method Disconnect closes the connection. More...
 
_.Library.Status DropStatement (hstmt)
 Method DropStatement(hstmt) invokes SQLFreeHandle with SQL_HANDLE_STMT.
 
_.Library.Status Execute (hstmt)
 Method Execute(hstmt) invokes SQLExecute for a given handle.
 
_.Library.Status Fetch (hstmt)
 Method Fetch(hstmt) invokes SQLFetch. More...
 
_.Library.Status FetchRows (hstmt, _.Library.List rlist, _.Library.Integer nrows)
 Method FetchRows retrieves nrows of rows for the given hstmt (it should be a statement which returns a result set) More...
 
_.Library.Status ForeignKeys (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String ForeignCatalogName, _.Library.String ForeignSchemaName, _.Library.String ForeignTableName)
 Method ForeignKeys invokes SQLForeignKeys. More...
 
_.Library.Status ForeignKeysW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String ForeignCatalogName, _.Library.String ForeignSchemaName, _.Library.String ForeignTableName)
 Method ForeignKeysW invokes SQLForeignKeysW. More...
 
_.Library.Integer GatewayStatusGet ()
 method GatewayStatusGet returns an error code for the last call. More...
 
_.Library.Status GetConnection (conn, timeout)
 Method GetConnection is used for establishing connection. More...
 
_.Library.Status GetData (hstmt, icol, type, val)
 Method GetData calls SQLGetData> for the column icol and. More...
 
_.Library.Status GetDataL (hstmt, icol, type, length, val)
 Method GetDataL calls SQLGetData> for the column icol and returns data in the last argument. More...
 
_.Library.Status GetDataLW (hstmt, icol, type, length, val)
 Method GetDataL calls SQLGetData> for the column icol and returns data in the last argument. More...
 
_.Library.Status GetDataW (hstmt, icol, type, val)
 Method GetDataW calls SQLGetData> for the column icol and returns data in the last argument. More...
 
_.Library.Status GetErrorList (hstmt, _.Library.List errorlist)
 Method GetErrorList sets a list of errors. More...
 
_.Library.Integer GetGTWVersion ()
 method GetGTWVersion returns the current version of odbcgateway.dll(so)
 
_.Library.Status GetInfo (infotype, infoval)
 Method GetInfo calls SQLGetInfo for the current connection handle.
 
_.Library.Integer GetLastSQLCode ()
 method GetLastSQLCode returns an SQL code for the last call if this call does not return an SQL code (e.g. More...
 
_.Library.Status GetOneRow (hstmt, row)
 Method GetOneRow retrieves the next for the given hstmt (it should be a statement which returns a result set) More...
 
_.Library.Status GetParameter (hstmt, pnbr, value)
 Method GetParameter(hstmt, pnbr, value) returns the current value of the parameter with the ordinal number pnbr in value.
 
_.Library.Status GetTypeInfo (hstmt, _.Library.Integer infotype)
 Method GetInfo calls SQLGetTypeInfo for the current connection handle.
 
_.Library.Status GetUV (infoval)
 Method GetUV returns whether the dll was built as Unicode.
 
_.Library.Integer MoreResults (hstmt)
 Method MoreResults(hstmt) returns SQLMoreResults for the corresponding hstmt.
 
_.Library.Status ParamData (hstmt, _.Library.Integer ind)
 Method ParamData(hstmt) invokes SQLParamData for a given handle.
 
_.Library.Status Prepare (hstmt, sql)
 Method Prepare(hstmt, sql) invokes SQLPrepare for a given handle.
 
_.Library.Status PrepareW (hstmt, sql)
 Method PrepareW(hstmt, sql) invokes SQLPrepareW for a given handle.
 
_.Library.Status PrimaryKeys (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName)
 Method PrimaryKeys invokes SQLPrimaryKeys. More...
 
_.Library.Status PrimaryKeysW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName)
 The wide version of PrimaryKeys. More...
 
_.Library.Status PutData (hstmt, val)
 Method PutData calls SQLPutData> for the column icol and sets the sqlcode property.
 
_.Library.Status PutDataW (hstmt, val)
 Method PutDataW calls SQLPutData> for the column icol and sets the sqlcode property.
 
_.Library.Integer RowCount (hstmt)
 Method RowCount(hstmt) returns SQLRowCount for the corresponding hstmt.
 
_.Library.Status SetConnectOption (opt, val)
 Method SetConnectOption(opt, val) invokes SQLSetConnectAttr. More...
 
_.Library.Status SetParameter (hstmt, pvalue, pnbr)
 Method SetParameter(hstmt, pvalue, pnbr) is used for setting the previously bound parameter with the ordinal number pnbr to the value which is contained in a $list format in pvalue. More...
 
_.Library.Status SetParameterBinary (hstmt, pvalue, pnbr)
 Method SetParameterBinary(hstmt, pvalue, pnbr) is used for setting the previously bound binary parameter with the ordinal number pnbr to the value which is contained in a $list format in pvalue. More...
 
_.Library.Status SetStmtOption (hstmt, opt, val)
 Method SetStmtOption(hstmt, opt, val) invokes SQLSetStmtAttr. More...
 
_.Library.Status SpecialColumns (hstmt, _.Library.Integer IdentifierType, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.Integer Scope, _.Library.Integer Nullable)
 Method SpecialColumns invokes SQLSpecialColumns. More...
 
_.Library.Status SpecialColumnsW (hstmt, _.Library.Integer IdentifierType, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.Integer Scope, _.Library.Integer Nullable)
 The wide version of SpecialColumns. More...
 
_.Library.Status Statistics (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.Integer unique)
 Method Statistics invokes SQLStatistics. More...
 
_.Library.Status StatisticsW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.Integer unique)
 Method StatisticsW invokes SQLStatisticsW. More...
 
_.Library.Status TablePrivileges (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName)
 Method TablePrivileges invokes SQLTablePrivileges. More...
 
_.Library.Status TablePrivilegesW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName)
 The wide version of TablePrivileges. More...
 
_.Library.Status Tables (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String TableType)
 Method Tables invokes SQLTables. More...
 
_.Library.Status TablesW (hstmt, _.Library.String CatalogName, _.Library.String SchemaName, _.Library.String TableName, _.Library.String TableType)
 The wide version of Tables. More...
 
_.Library.Status Transact (type)
 Method Transact( type) invokes SQLEndTran. More...
 
_.Library.Status UnbindParameters (hstmt)
 Method UnbindParameters(hstmt) invokes SQLFreeStmt with SQL_UNBIND. More...
 
_.Library.Status UnloadDLL ()
 This method unloads odbcgateway.dll from the process memory. More...
 
_.SQL.IResultSet getResultSet (hstmt)
 The method getResultSet is used for encapsulating data retrival from already executed statement. More...
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Static Public Member Functions

_.Library.Boolean IsTextNetworkError (_.Library.String ErrorText)
 Decide whether the text of an error returned from the driver represents. More...
 

Public Attributes

 ConnectionHandle
   More...
 
 ConnectionName
   More...
 
 DLLHandle
   More...
 
 DLLName
   More...
 
 DSN
   More...
 
 GatewayStatus
   More...
 
 LegacyMode
   More...
 
 Password
   More...
 
 User
   More...
 
 sqlcode
   More...
 

Additional Inherited Members

- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Detailed Description

The SQLGatewayConnection class provides low-level access to the SQLGateway.

The user should understand how to make ODBC calls in order to use this class. Most of the calls which return Status also set the ..sqlcode property. The user should check ..sqlcode if return status is not $$$OK. The user can use a SQLGatewayConnection class as follows:

#include occInclude //Create new Gateway connection object set gc=##class(SQLGatewayConnection).New() If gc=$$$NULLOREF quit $$$ERROR($$$GeneralError,"Cannot create %SQLGatewayConnection.")

//Make connection to target DSN s pDSN="Samples" s usr="_system" s pwd="SYS" set sc=gc.Connect(pDSN,usr,pwd,0) If $$$ISERR(sc) quit sc if gc.ConnectionHandle="" quit $$$ERROR($$$GeneralError,"Connection failed")

set sc=gc.AllocateStatement(.hstmt) if $$$ISERR(sc) quit sc

//Prepare statement for execution set pQuery= "select * from Sample.Person" set sc=gc.Prepare(hstmt,pQuery) if $$$ISERR(sc) quit sc //Execute statement set sc=gc.Execute(hstmt) if $$$ISERR(sc) quit sc //Get list of columns returned by query set sc=gc.DescribeColumns(hstmt, .columnlist) if $$$ISERR(sc) quit sc

//display column headers delimited by ":" set numcols=$listlength(columnlist)-1 //get number of columns for colnum=2:1:numcols+1 { Write $listget($listget(columnlist,colnum),1),":" } write !

//Return first 200 rows
set sc=gc.Fetch(hstmt) if $$$ISERR(sc) quit sc s rownum=1 while((gc.sqlcode'=100) && (rownum<=200)) { for ii=1:1:numcols { s sc=gc.GetData(hstmt, ii, 1, .val) w " "_val if $$$ISERR(sc) break } s rownum=rownum+1 write ! set sc=gc.Fetch(hstmt) if $$$ISERR(sc) break

}

//Close cursor and then disconnect set sc=gc.CloseCursor(hstmt) if $$$ISERR(sc) quit sc // Disconnect() should always be called when done with the connection.
// On some platforms, not calling Disconnect() can lead to a hang when the process halts set sc=gc.Disconnect()

Quit sc

The sample class mentioned here (Sample.Person) is part of https://github.com/intersystems/Samples-Data. See Downloading Samples.

Member Function Documentation

◆ BindParameters()

_.Library.Status BindParameters (   hstmt,
_.Library.List  ptype,
_.Library.List  dtype,
_.Library.List  precision,
_.Library.List  scale,
_.Library.List  cd 
)

BindParameters is used for binding all the parameters for a given statement handle.


Arguments :

  • hstmt - Statement handle
  • ptype - input/ouput types of the parameters in $list format
  • dtype - SQL datatypes of parameters in the $list format
  • precision - $list of the correponding precision values - used for reserving buffers for parameter values
  • scale - $list of the correponding scale values
  • cd - $list of column sizes

They are used in the following places of the SQLBindParameter function

    SQLRETURN SQLBindParameter(
        SQLHSTMT         StatementHandle,   // hstmt
        SQLUSMALLINT     ParameterNumber,
        SQLSMALLINT      InputOutputType,   // $list element from ptype
        SQLSMALLINT      ValueType,
        SQLSMALLINT      ParameterType,     // $list element from dtype
        SQLUINTEGER      ColumnSize,        // $list element from cd
        SQLSMALLINT      DecimalDigits,     // $list element from scale
        SQLPOINTER       ParameterValuePtr ,
        SQLINTEGER       BufferLength,
        SQLINTEGER *     StrLen_or_IndPtr);
    

◆ ColumnPrivileges()

_.Library.Status ColumnPrivileges (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  ColumnName 
)

Method ColumnPrivileges invokes SQLColumnPrivileges.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ ColumnPrivilegesW()

_.Library.Status ColumnPrivilegesW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  ColumnName 
)

The wide version of Columns.

See documentation for ColumnPrivilegesW

◆ Columns()

_.Library.Status Columns (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  ColumnName 
)

Method Columns invokes SQLColumns.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ ColumnsW()

_.Library.Status ColumnsW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  ColumnName 
)

The wide version of Columns.

See documentation for Columns

◆ Connect()

_.Library.Status Connect (   dsn,
  usr,
  pwd,
  timeout 
)

The method Connect is used for establishing connection to a DSN.


If username and password are both empty it calls SQLDriverConnect.
If that call is unsuccessful or username/password are specified it calls SQLConnect. SQLSetConnectAttr is called before connection to set SQL_ATTR_LOGIN_TIMEOUT if the timeout parameter is not 0.

◆ DescribeColumns()

_.Library.Status DescribeColumns (   hstmt,
_.Library.List  clist 
)

Method DescribeColumns returns a list with column information in a second argument.

It calls SQLDescribeCols and SQLColAttribute.

Each list element of the returned list is a list itself. The first list element contains the header in the $list format containing 8 elements:

  1. the number of columns in the given statement
  2. the string "SqlType"
  3. the string "Precision"
  4. the string "Scale"
  5. the string "Nullable"
  6. the string "Datatype"
  7. the string "DisplaySize"
  8. the string "IsMoney?"


Next elements correspond to the statement column and also contains 8 elements:

  1. column name
  2. SQL type of the column
  3. column size
  4. decimal digits
  5. nullable
  6. column datatype
  7. column display size
  8. SQL_TRUE or SQL_FALSE depending whether this is a currency type

◆ DescribeParameters()

_.Library.Status DescribeParameters (   hstmt,
_.Library.List  plist 
)

Method DescribeParameters returns a list with parameter information in a second argument.

It calls SQLDescribeParam and SQLNumParams.

Each list element of the returned list is a list itself. The first list element contains the header in $list format containing 5 elements:

  1. the number of parameters in the given statement
  2. the string "SqlType"
  3. the string "Precision"
  4. the string "Scale"
  5. the string "Nullable"


The next elements correspond to the statement parameter and contains 4 elements:

  1. the SQL type of the parameter
  2. the parameter size
  3. the scale
  4. whether the value is nullable

◆ DescribeProcedureColumns()

_.Library.Status DescribeProcedureColumns (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  ProcName,
_.Library.String  ColumnName 
)

Method DescribeProcedureColumns invokes SQLProcedureColumns.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ DescribeProcedureColumnsW()

_.Library.Status DescribeProcedureColumnsW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  ProcName,
_.Library.String  ColumnName 
)

Method DescribeProcedureColumns invokes SQLProcedureColumns.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ DescribeProcedures()

_.Library.Status DescribeProcedures (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  ProcName 
)

Method DescribeProcedures invokes SQLProcedures.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ DescribeProceduresW()

_.Library.Status DescribeProceduresW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  ProcName 
)

Method DescribeProcedures invokes SQLProcedures.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ Disconnect()

_.Library.Status Disconnect ( )

Method Disconnect closes the connection.


Disconnect() should always be called when done with the connection.
On some platforms, not calling Disconnect() can lead to a hang when the process halts

◆ Fetch()

_.Library.Status Fetch (   hstmt)

Method Fetch(hstmt) invokes SQLFetch.

It returns an error for all non zero SQL codes. The user should check the ..sqlcode property.

◆ FetchRows()

_.Library.Status FetchRows (   hstmt,
_.Library.List  rlist,
_.Library.Integer  nrows 
)

Method FetchRows retrieves nrows of rows for the given hstmt (it should be a statement which returns a result set)

It returns rlist - a list of row.s If there is no data (SQL_CODE = 100) fetching is assumed to be successful
This call truncates character fields up to 120 characters so that more fields would fit in a row. It is advised to use GetData call when non truncated data is needed.

◆ ForeignKeys()

_.Library.Status ForeignKeys (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  ForeignCatalogName,
_.Library.String  ForeignSchemaName,
_.Library.String  ForeignTableName 
)

Method ForeignKeys invokes SQLForeignKeys.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ ForeignKeysW()

_.Library.Status ForeignKeysW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  ForeignCatalogName,
_.Library.String  ForeignSchemaName,
_.Library.String  ForeignTableName 
)

Method ForeignKeysW invokes SQLForeignKeysW.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ GatewayStatusGet()

_.Library.Integer GatewayStatusGet ( )

method GatewayStatusGet returns an error code for the last call.

It does not initialize the error code and can be called multiple times. The possible return values are:


  • 0 - success
  • -1 - SQL error
  • -1000 - critical error

◆ GetConnection()

_.Library.Status GetConnection (   conn,
  timeout 
)

Method GetConnection is used for establishing connection.

It uses

an entry from InterSystems IRIS configuration for determening the DSN, user name, and password.

◆ GetData()

_.Library.Status GetData (   hstmt,
  icol,
  type,
  val 
)

Method GetData calls SQLGetData> for the column icol and.

returns data in the last argument.. The supported types are 1 (SQL_CHAR),-2 (SQL_BINARY) and -8 (SQL_WCHAR). This method may be called repeatedly for the same column in the case when the data length exceeds 31K.

◆ GetDataL()

_.Library.Status GetDataL (   hstmt,
  icol,
  type,
  length,
  val 
)

Method GetDataL calls SQLGetData> for the column icol and returns data in the last argument.

This method support long strings

and requests the specified number of bytes. The supported types are 1 (SQL_CHAR),-2 (SQL_BINARY) and -8 (SQL_WCHAR). This method may be called repeatedly for the same column.

◆ GetDataLW()

_.Library.Status GetDataLW (   hstmt,
  icol,
  type,
  length,
  val 
)

Method GetDataL calls SQLGetData> for the column icol and returns data in the last argument.

This method support long strings

and requests the specified number of bytes. The supported types are 1 (SQL_CHAR) and -8 (SQL_WCHAR). This method may be called repeatedly for the same column.

◆ GetDataW()

_.Library.Status GetDataW (   hstmt,
  icol,
  type,
  val 
)

Method GetDataW calls SQLGetData> for the column icol and returns data in the last argument.

. The supported types are 1 (SQL_CHAR) and -8 (SQL_WCHAR). This method may be called repeatedly

for the same column in the case when the data length exceeds 31K.

◆ GetErrorList()

_.Library.Status GetErrorList (   hstmt,
_.Library.List  errorlist 
)

Method GetErrorList sets a list of errors.

It calls SQLDiagRec as long as

it returns errors for the given hdbc, hstmt (hdbc is set implicitly to the handle of the active connection).
errorlist is a delimited string (with platform specific new line characters as delimiters) metalist; each element corresponds to a particular error, in the format: SQLState: (...) NativeError: [...] Message: [... GetErrorList(0, .errorlist) - returns the error status of the ODBC function most recently called with the current hdbc;

◆ GetLastSQLCode()

_.Library.Integer GetLastSQLCode ( )

method GetLastSQLCode returns an SQL code for the last call if this call does not return an SQL code (e.g.

SQLGetData).

◆ GetOneRow()

_.Library.Status GetOneRow (   hstmt,
  row 
)

Method GetOneRow retrieves the next for the given hstmt (it should be a statement which returns a result set)

It returns rlist - a list of fields If there is no data (SQL_CODE = 100) fetching is assumed to be successful but the return list is empty. This call truncates character fields up to 120 characters so that more fields would fit in a row. It is advised to use GetData call when non truncated data is needed.

◆ IsTextNetworkError()

_.Library.Boolean IsTextNetworkError ( _.Library.String  ErrorText)
static

Decide whether the text of an error returned from the driver represents.

a disconnection implying the need to re-connect. If you encounter other error signatures that ought to be in this list, please contact InterSystems so that we may update this method.

◆ PrimaryKeys()

_.Library.Status PrimaryKeys (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName 
)

Method PrimaryKeys invokes SQLPrimaryKeys.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ PrimaryKeysW()

_.Library.Status PrimaryKeysW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName 
)

The wide version of PrimaryKeys.

See documentation for SQLPrimaryKeys

◆ SetConnectOption()

_.Library.Status SetConnectOption (   opt,
  val 
)

Method SetConnectOption(opt, val) invokes SQLSetConnectAttr.

Only integer values are supported. Integer values for the opt

may be taken from sql.h and sqlext.h header files.

◆ SetParameter()

_.Library.Status SetParameter (   hstmt,
  pvalue,
  pnbr 
)

Method SetParameter(hstmt, pvalue, pnbr) is used for setting the previously bound parameter with the ordinal number pnbr to the value which is contained in a $list format in pvalue.


If the allocated buffer is not sufficient a new buffer will be allocated.

◆ SetParameterBinary()

_.Library.Status SetParameterBinary (   hstmt,
  pvalue,
  pnbr 
)

Method SetParameterBinary(hstmt, pvalue, pnbr) is used for setting the previously bound binary parameter with the ordinal number pnbr to the value which is contained in a $list format in pvalue.


If the allocated buffer is not sufficient a new buffer will be allocated.

◆ SetStmtOption()

_.Library.Status SetStmtOption (   hstmt,
  opt,
  val 
)

Method SetStmtOption(hstmt, opt, val) invokes SQLSetStmtAttr.

Only integer values are supported. Integer values for the opt

may be taken from sql.h and sqlext.h header files.

◆ SpecialColumns()

_.Library.Status SpecialColumns (   hstmt,
_.Library.Integer  IdentifierType,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.Integer  Scope,
_.Library.Integer  Nullable 
)

Method SpecialColumns invokes SQLSpecialColumns.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ SpecialColumnsW()

_.Library.Status SpecialColumnsW (   hstmt,
_.Library.Integer  IdentifierType,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.Integer  Scope,
_.Library.Integer  Nullable 
)

The wide version of SpecialColumns.

See documentation for SpecialColumns

◆ Statistics()

_.Library.Status Statistics (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.Integer  unique 
)

Method Statistics invokes SQLStatistics.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ StatisticsW()

_.Library.Status StatisticsW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.Integer  unique 
)

Method StatisticsW invokes SQLStatisticsW.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ TablePrivileges()

_.Library.Status TablePrivileges (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName 
)

Method TablePrivileges invokes SQLTablePrivileges.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ TablePrivilegesW()

_.Library.Status TablePrivilegesW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName 
)

The wide version of TablePrivileges.

See documentation for Tables

◆ Tables()

_.Library.Status Tables (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  TableType 
)

Method Tables invokes SQLTables.

It should be followed by the usual retrieval of a result set.

Users should pass empty strings instead of the corresponding null values and $c(0) instead of empty strings. All other ODBC conventions for arguments in catalog functions apply.

◆ TablesW()

_.Library.Status TablesW (   hstmt,
_.Library.String  CatalogName,
_.Library.String  SchemaName,
_.Library.String  TableName,
_.Library.String  TableType 
)

The wide version of Tables.

See documentation for Tables

◆ Transact()

_.Library.Status Transact (   type)

Method Transact( type) invokes SQLEndTran.

Pass 0 for SQL_COMMIT and 1 for SQL_ROLLBACK.

◆ UnbindParameters()

_.Library.Status UnbindParameters (   hstmt)

Method UnbindParameters(hstmt) invokes SQLFreeStmt with SQL_UNBIND.


Unbinding is done automatically when BindParameters is called.

◆ UnloadDLL()

_.Library.Status UnloadDLL ( )

This method unloads odbcgateway.dll from the process memory.


◆ getResultSet()

_.SQL.IResultSet getResultSet (   hstmt)

The method getResultSet is used for encapsulating data retrival from already executed statement.


It return a resultset and all the resultset methods for data and metadata access are internally translated to ODBC calls. It means that if this path is chosen the user should not call Fetch, GetData etc independently, otherwise the results may be not complete and/or correct.

Member Data Documentation

◆ ConnectionHandle

ConnectionHandle

 

 

◆ ConnectionName

ConnectionName

 

 

◆ DLLHandle

DLLHandle

 

 

◆ DLLName

DLLName

 

 

◆ DSN

DSN

 

 

◆ GatewayStatus

GatewayStatus

 

 

◆ LegacyMode

LegacyMode

 

 

◆ Password

Password

 

 

◆ User

User

 

 

◆ sqlcode

sqlcode