﻿# SQLOP\_INIT\_LIB

_Updated (opflags) July 2019_

**xcall SQL, SQLOP\_INIT\_LIB, cmdhdr**

The SQLOP\_INIT\_LIB function initializes the SQL library and is required prior to any other operations for a given database type (MySQL, ODBC, etc.). 

**Parameters**

_cmdhdr_ (ST\_SQL\_CMDHDR), \[in/out\]

The fields of interest to this opcode in the _cmdhdr_ structure (defined in [SQL.DEF](https://bitbucket.org/microsabio/exlib/src/master/909060/sql.def)) are listed below.

| **Field** | **Dir** | **Notes** |
|------|------|------|
| handle | n/a |  |
| dbmsconid | in | [DBMS Connector ID](dbmsconnectorid.md) |
| opflags | in | SQLCONF\_TRACE=1 flag activates tracing of ASQL operations in ashlog.log |
| cmdarg1,2 | n/a |  |
| rc | out | return code (0 = ok, see SQLERR\_xxx) |
| rcext | out | extended return code (dbms err if _rc_ = SQLERR\_DBMSERR) |
| info1,2 | n/a |  |
| sqlstate | n/a |  |
| reshdl | in | If not zero, determines maximum number of result sets to support at one time. Default is 4. |
| psthdl | in | If not zero, determines maximum number of prepared statements to support at one time. Default is 16. |




**Notes**

At the end of the session, use SQLOP\_CLOSE\_LIB to close the library and release the resources.

**History**

2012 January, ashmysql connector 1.4.132:  SQLCONF\_TRACE flag added. Note that setting the SQLCONF\_TRACE flag in the opflags field is equivalent to defining an environment variable ASQLTRACE=1.

2012 January, ashmysql connector 1.4.130:  SQLOP\_INIT\_LIB and SQLOP\_CLOSE\_LIB can now be nested. See _History_ under SQLOP\_CLOSE\_LIB for further details.