This section describes each OpenAPI function and provides its syntax.
The IIapi_abort() function closes a connection opened with IIapi_connect() and frees all the resources associated with the connection handle.
Any transaction associated with the connection is aborted, and the transaction handle freed, as are all associated statements and database event handles.
While this function can be used to clean up quickly when a problem is detected on a connection, applications are encouraged to continue calling IIapi_close(), IIapi_commit() or IIapi_rollback(), and IIapi_disconnect() to cleanly shut down server connections.
This function has the following syntax:
II_VOID IIapi_abort ( IIAPI_ABORTPARM *abortParm );
typedef struct _IIAPI_ABORTPARM
{
IIAPI_GENPARM ab_genParm;
II_PTR ab_connHandle;
} IIAPI_ABORTPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters.
For a description, see Generic Parameters.
Type: input
Specifies the connection handle to be disconnected immediately. All resources associated with this connection are also freed.
The IIapi_autocommit() function provides an interface for the front-end application to manage the autocommit state in a server. It controls the autocommit state of the server through an autocommit transaction handle. An autocommit transaction handle is required to access the Name Server through OpenAPI.
This function is called with a NULL transaction handle to enable the autocommit state in a server. For a DBMS connection, this is equivalent to the SQL statement 'SET AUTOCOMMIT ON'. An autocommit transaction handle is returned to be used in place of a regular transaction handle in IIapi_query(). Query statements executed in the context of an autocommit transaction are automatically committed when they complete execution.
When called with an existing autocommit transaction handle, this function disables the autocommit state in the server. This is equivalent to the SQL statement 'SET AUTOCOMMIT OFF'. The autocommit transaction handle is freed and can not be referenced further by the application.
When you set autocommit on, a commit occurs automatically after every statement except prepare and describe. If autocommit is on and you open a cursor, the DBMS does not issue a commit until the close cursor statement is executed because cursors are logically a single statement.
This function has the following syntax:
II_VOID IIapi_autocommit( IIAPI_AUTOPARM *autoParm);
typedef struct _IIAPI_AUTOPARM
{
IIAPI_GENPARM ac_genParm;
II_PTR ac_connHandle;
II_PTR ac_tranHandle;
} IIAPI_AUTOPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters.
For a description, see Generic Parameters.
Type: input
Specifies the connection handle identifying the connection associated with the autocommit transaction. Set to NULL when disabling an existing autocommit transaction.
Type: input and immediate output
Specifies the transaction handle to be used while autocommit is enabled. Set to NULL when enabling an autocommit transaction.
The IIapi_cancel() function causes a query statement started with IIapi_query() or an event retrieval started with IIapi_catchEvent() to complete its operations.
When IIapi_cancel() completes successfully, the query may not yet be canceled; it simply means that the server has received the cancellation request. Each canceled query receives a callback.
This function is different from IIapi_close(), which is used to end a query. The IIapi_close() function waits for the completion of the query, whereas IIapi_cancel() attempts to end it before it is completed.
Statement handle output from IIapi_query() and event handle output from IIapi_catchEvent() is available when the function returns, so queries can be canceled at anytime thereafter.
The following are possible results of the IIapi_cancel() function and their corresponding actions:
This function has the following syntax:
II_VOID IIapi_cancel (IIAPI_CANCELPARM *cancelParm);
typedef struct _IIAPI_CANCELPARM
{
IIAPI_GENPARM cn_genParm;
II_PTR cn_stmtHandle;
} IIAPI_CANCELPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters.
For a description, see Generic Parameters.
Type: input
Specifies the statement or event handle identifying the query to be canceled.
The following is a summary of the OpenAPI functions, grouped by tasks.
Initializes OpenAPI.
Assigns an environment parameter and value in the environment handle.
Releases resources associated with an environment handle.
Terminates OpenAPI.
Closes a server connection forcibly and frees the connection handle.
Connects to a server and allocates a connection handle.
Closes a server connection, after doing an orderly shutdown, and frees the connection handle.
Sends connection parameters to the server.
Assigns a connection parameter and value to a connection.
Begins a query statement and allocates a statement handle, and can also allocate a transaction ID handle.
Sends information about the format of data being sent to the server for subsequent IIapi_putParms() or IIapi_putColumns() calls.
Sends data values for query statement parameters.
Returns the data format of the copy file and database table involved in a copy statement.
Sends data to be copied from a file to a database table.
Returns the format of the data for subsequent IIapi_getColumns() call.
Returns the results of a query.
Returns information about a query.
Returns additional error or user-defined information.
Cancels an outstanding query.
Ends a query statement and frees the statement handle.
Reserves a unique ID for a two-phase commit transaction.
Marks a savepoint for a partial rollback.
Begins a two-phase commit for a transaction.
Enables or disables an autocommit transaction.
Commits a transaction and frees the transaction ID handle.
Rolls back a transaction and frees the transaction ID handle.
Releases a unique ID for a two-phase commit transaction.
Retrieves a database event and allocates a statement handle.
Provides interface for applications to wait for database events to occur.
Converts Ingres data values to a compatible type, using Ingres installation and user configuration settings.
Converts Ingres data values to a compatible type, using OpenAPI environment handle settings.
Blocks control from the application until an outstanding operation completes, or until a user-defined time-out period expires.
The IIapi_catchEvent() function retrieves a database event previously registered by an application. The application first registers for a database event using IIapi_query() to invoke the register dbevent statement. It then captures each occurrence of the event and retrieves its data by calling IIapi_catchEvent().
IIapi_catchEvent() allows the application to specify the database event by the event parameters. If ce_selectEventName and ce_selectEventOwner are specified, one specific event is captured when the function completes. If only ce_selectEventOwner is specified, any events owned by the specific owner are captured. If only ce_selectEventName is specified, any events with the event name are captured. If neither ce_selectEventName nor ce_selectEventOwner are specified, all events are captured.
When IIapi_catchEvent() returns, it provides an event handle as immediate output. This handle is used to retrieve additional event information, to cancel the event retrieval, or to clean up after the event is retrieved.
Calling IIapi_catchEvent() captures one occurrence of a database event. After it has captured the event, the application can immediately issue another IIapi_catchEvent() with the same event handle to capture the next occurrence.
IIapi_catchEvent() operates in a manner similar to the embedded SQL statement set_sql(dbeventhandler=<dbevent_handler>). IIapi_catchEvent() does not result in any communication with the server. Since database event notification is passed along with other SQL result information, the application must continue with other database operations after calling IIapi_catchEvent() to enable retrieval of database events.
IIapi_getEvent() can be used to receive database event notifications when the application has no other database operations to perform. IIapi_getEvent() operates in a manner similar to the embedded SQL statement GET DBEVENT. See IIapi_getEvent() for further details.
If IIapi_catchEvent() completes with ce_eventInfoAvail set to TRUE, the application should call IIapi_getDescriptor() and IIapi_getColumns() to access additional event information.
If the application no longer wants to retrieve a pending database event, it calls IIapi_cancel() to cancel the event retrieval. A canceled event retrieval completes with a failure status. After an event is canceled, or an event retrieval has completed, the application calls IIapi_close() to free the event handle and associated internal resources.
If an event notification occurs for which there is no active matching event handle, the database event is ignored. IIapi_setEnvParam() permits a callback function to be registered, which will be called for each database event that fails to match to an active event handle and would otherwise be ignored. See IIAPI_EP_EVENT_FUNC and related documentation in the description for IIapi_setEnvParam().
This function has the following syntax:
II_VOID IIapi_catchEvent (IIAPI_CATCHEVENTPARM *catchEventParm);
typedef struct _IIAPI_CATCHEVENTPARM
{
IIAPI_GENPARM ce_genParm;
II_PTR ce_connHandle;
II_CHAR *ce_selectEventName;
II_CHAR *ce_selectEventOwner;
II_PTR ce_eventHandle;
II_CHAR *ce_eventName
II_CHAR *ce_eventOwner
II_CHAR *ce_eventDB;
IIAPI_DATAVALUE ce_eventTime;
II_BOOL ce_eventInfoAvail;
} IIAPI_CATCHEVENTPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters.
Note: For a description, see Generic Parameters.
Type: input
Specifies the connection handle, identifying the connection to the target server, or the environment handle.
Type: input
Specifies the name of the event to retrieve. This parameter is NULL if the application wants to receive the next event indiscriminately; otherwise, it is a NULL-terminated string containing the name of the event the application is requesting.
Type: input
Specifies the owner of the event to retrieve. This parameter is NULL if the application requests events by any owner; otherwise, it is a NULLterminated string containing the name of the event owner.
Type: input and immediate output
Specifies the event handle identifying the event retrieval. Set to NULL to begin a new event retrieval. After receiving the requested event, the application may call IIapi_catchEvent() with the same event handle to receive the next event. The application should clean up resources when event retrieval is no longer desired by calling IIapi_close() with this event handle.
Type: delayed output
Assigns the name of the event retrieved when the function completes.
The memory for this parameter is managed by the OpenAPI. For more information, see How Memory is Managed for Data Input and Output.
Type: delayed output
Assigns the owner name of the event retrieved when the function completes.
The memory for this parameter is managed by OpenAPI. For more information, see How Memory is Managed for Data Input and Output.
Type: delayed output
Indicates the server where the event occurred. This parameter contains a NULL-terminated string containing the name of the server.
The memory for this parameter is managed by the OpenAPI. For more information, see How Memory is Managed for Data Input and Output.
Type: delayed output
Indicates the time the event occurred, stored as an IIAPI_DTE_TYPE data value.
The memory for this parameter is managed by the OpenAPI. For more information, see How Memory is Managed for Data Input and Output.
Type: delayed output
Indicates whether the is additional information associated with the event. The parameter is FALSE if there is no additional information associated with the event; otherwise, the application should call IIapi_getDescription() and IIapi_getColumns() with ce_eventHandle to retrieve the additional event information.
The IIapi_close() function ends a query or database event retrieval started with IIapi_query() or IIapi_catchEvent(). This function frees the event or statement handle and closes any cursor associated with the statement handle.
An application calls IIapi_close() to end a query that has finished all OpenAPI function calls required by the query type. The application must call IIapi_cancel() to interrupt a query with outstanding requests prior to calling IIapi_close().
IIapi_close() invalidates any data returned by the IIapi_catchEvent(), IIapi_getCopyMap(), IIapi_getDescriptor(), or IIapi_getErrorInfo() functions for the statement handle.
Note: For more information, see How Memory is Managed for Data Input and Output.
For each IIapi_query() or IIapi_catchEvent(with NULL ce_eventHandle), there should be a corresponding IIapi_close().
The following are possible results of the IIapi_close() function and their corresponding actions:
This function has the following syntax:
II_VOID IIapi_close (IIAPI_CLOSEPARM *closeParm);
typedef struct _IIAPI_CLOSEPARM
{
IIAPI_GENPARM cl_genParm;
II_PTR cl_stmtHandle;
} IIAPI_CLOSEPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement or event handle identifying the query or event retrieval for which resources should be freed.
The IIapi_commit() function commits a transaction that was started with IIapi_query() or restarted by IIapi_connect(), and then frees the transaction handle.
Before the transaction is committed, the application must call IIapi_close() to free the statement handles within the transaction.
This function has the following syntax:
II_VOID IIapi_commit (IIAPI_COMMITPARM *commitParm);
typedef struct _IIAPI_COMMITPARM
{
IIAPI_GENPARM cm_genParm;
II_PTR cm_tranHandle;
} IIAPI_COMMITPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the transaction ID handle identifying the transaction to be committed. The transaction ID handle is either from qy_tranHandle of IIapi_query() or co_tranHandle of IIapi_connect().
The IIapi_connect() function establishes a connection to a DBMS Server or the Name Server, based on the connection type, and allocates a connection handle. When connecting to the Name Server an environment handle must be provided as input.
This function returns the co_apiLevel output parameter, which specifies the level of functionality provided by OpenAPI for the current connection. If the output connection handle is not NULL after this function returns, even if an error occurs, IIapi_disconnect() or IIapi_abort() must be called to release the connection handle.
This function has the following syntax:
II_VOID IIapi_connect (IIAPI_CONNPARM *connParm);
typedef struct _IIAPI_CONNPARM
{
IIAPI_GENPARM co_genParm;
II_CHAR *co_target;
II_CHAR *co_username;
II_CHAR *co_password;
II_LONG co_timeout;
II_PTR co_connHandle;
II_PTR co_tranHandle
II_LONG co_sizeAdvise;
II_LONG co_apiLevel;
II_LONG co_type;
} IIAPI_CONNPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
The name of the database. When connecting to a DBMS Server, this parameter cannot be NULL. It contains a NULL-terminated string naming the database to which the application will connect. When connecting to a Name Server, NULL is used for the local installation and the vnode name is used for a remote installation.
The syntax of the target name is:
[node_id::]dbname[/svr_class]
Type: input
The name of the user connecting to the server. This parameter contains a NULL-terminated string, which is the user name authorized to connect to the server.
If this parameter is NULL, a default user name will be used and co_password should also be NULL.
Type: input
A NULL-terminated string containing the password for the user specified in co_username. If co_username is NULL, this parameter should be NULL as well.
If connecting to the Name Server, this parameter is not required if the current user has the NET_ADMIN privilege.
Type: input
Specifies the maximum time in milliseconds to wait for a connection to be established. A value of -1 is used if a timeout is not desired.
Support for timeouts is platform-dependent. If timeouts are not supported, all values are treated the same as -1.
Type: input and immediate output
Specifies a connection handle returned by IIapi_setConnectParam(), an environment handle returned by IIapi_initialize(), or NULL.
Specifies the connection handle identifying the connection for subsequent OpenAPI function calls that invoke query statements and transactions within the context of this connection.
Type: input and immediate output
Specifies a transaction ID handle that can be used to re-connect to a distributed transaction, obtained from IIapi_registerXID(), as input. This parameter (input and output) is usually NULL. A transaction handle for the distributed transaction is returned.
Type: delayed output
Specifies the advised buffer size for long varchar or long byte segment sizes used within this connection.
Type: delayed output
Specifies the OpenAPI level of functionality supported by the server for the connection. Valid values for this parameter are:
Specifies level 0. All level 1 data types are supported except the following:
IIAPI_DEC_TYPE
IIAPI_BYTE_TYPE
IIAPI_VBYTE_TYPE
IIAPI_LBYTE_TYPE
IIAPI_LVCH_TYPE
Specifies level 1. All level 2 data types are supported except the National Character Set data types:
IIAPI_NCHA_TYPE
IIAPI_NVCH_TYPE
IIAPI_LNVCH_TYPE
Specifies level 2. (Requires initialization at IIAPI_VERSION_3.) All level 3 data types are supported except eight-byte integers (bigint):
IIAPI_INT_TYPE with length 8
Specifies level 3. (Requires initialization at IIAPI_VERSION_4.) All level 4 data types are supported except ANSI date/time types:
IIAPI_DATE_TYPE
IIAPI_TIME_TYPE
IIAPI_TMWO_TYPE
IIAPI_TMTZ_TYPE
IIAPI_TS_TYPE
IIAPI_TSWO_TYPE
IIAPI_TSTZ_TYPE
IIAPI_INTYM_TYPE
IIAPI_INTDS_TYPE
Specifies level 4. (Requires initialization at IIAPI_VERSION_5.) All data types in this guide are supported.
Type: input
Specifies the connection type. Its value is one of the following:
Establishes a connection to the Name Server.
Establishes a connection to a relational DBMS Server.
This parameter is ignored (IIAPI_CT_SQL assumed) if co_connHandle is NULL or is a connection handle that was created with a NULL environment handle.
The IIapi_convertData() function converts data values between Ingres data types. The data values are translated and formatted using default settings selected by the user and specified at the operating system level prior to running the application. IIapi_formatData() can be used to convert data using settings selected by the application.
This function is intended to support Ingres data types that do not have a corresponding C language data type.
Conversions to and from IIAPI_CHA_TYPE are supported for the data types IIAPI_DEC_TYPE, IIAPI_MNY_TYPE, IIAPI_DTE_TYPE, IIAPI_DATE_TYPE, IIAPI_TIME_TYPE, IIAPI_TMWO_TYPE, IIAPI_TMTZ_TYPE, IIAPI_TS_TYPE, IIAPI_TSWO_TYPE, IIAPI_TSTZ_TYPE, IIAPI_INTYM_TYPE, IIAPI_INTDS_TYPE.
In addition, the following conversions are supported:
Data Type |
Converted To |
|---|---|
IIAPI_DEC_TYPE |
IIAPI_FLT_TYPE |
IIAPI_FLT_TYPE |
IIAPI_DEC_TYPE |
IIAPI_MNY_TYPE |
IIAPI_FLT_TYPE |
IIAPI_FLT_TYPE |
IIAPI_MNY_TYPE |
The source data value must not be NULL (that is, dv_null set to TRUE).
This function has the following syntax:
II_VOID IIapi_convertData(IIAPI_CONVERTPARM *convertParm);
typedef struct _IIAPI_CONVERTPARM
{
IIAPI_DESCRIPTOR cv_srcDesc;
IIAPI_DATAVALUE cv_srcValue;
IIAPI_DESCRIPTOR cv_dstDesc;
IIAPI_DATAVALUE cv_dstValue;
IIAPI_STATUS cv_status;
} IIAPI_CONVERTPARM;
This function has the following parameters:
Type: input
Specifies a description of the original data type.
Type: input
Specifies the original data value. This value must not be NULL.
Type: input
Specifies the description of the desired result data type.
Type: output
Specifies the resulting data value. There must be enough memory allocated to hold the resulting data value, as described by cv_dstDesc (that is, dv_length must be equal or greater than ds_length).
Type: output
Returns IIAPI_ST_SUCCESS if the conversion succeeded; IIAPI_ST_FAILURE if there is an invalid parameter value, insufficient space to hold the resulting data value, or the input data value could not be converted to the requested type.
The IIapi_disconnect() function closes the connection to the server opened with IIapi_connect() and frees all resources associated with the connection handle.
An application must close all outstanding statements and event retrievals, and it must commit or roll back all outstanding transactions before calling IIapi_disconnect().
This function has the following syntax:
II_VOID IIapi_disconnect (IIAPI_DISCONNPARM *disconnParm);
typedef struct _IIAPI_DISCONNPARM
{
IIAPI_GENPARM dc_genParm;
II_PTR dc_connHandle;
} IIAPI_DISCONNPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the connection handle, identifying the connection to the target server. All resources associated with this connection are also freed.
The IIapi_formatData() function converts data values between Ingres data types. The data values are translated and formatted using settings selected by the application and specified on an environment handle using IIapi_setEnvParam(). IIapi_convertData() can be used to convert data using default settings selected by the user running the application.
For further details, see the description of IIapi_convertData().
This function has the following syntax:
II_VOID IIapi_formatData( IIAPI_FORMATPARM *formatParm );
typedef struct _IIAPI_FORMATPARM
{
II_PTR fd_envHandle;
IIAPI_DESCRIPTOR fd_srcDesc;
IIAPI_DATAVALUE fd_srcValue;
IIAPI_DESCRIPTOR fd_dstDesc;
IIAPI_DATAVALUE fd_dstValue;
IIAPI_STATUS fd_status;
} IIAPI_FORMATPARM;
This function has the following parameters:
Type: input
Specifies the environment handle for which the data values to be converted.
Type: input
Specifies the description of the original data type.
Type: input
Specifies the original data value. The value must not be NULL.
Type: input
Specifies the description of the desired result data type.
Type: output
Specifies the resulting data value. There must be enough memory allocated to hold the resulting data value as described by fd_dstDesc (that is, dv_length must be equal or greater than ds_length).
Type: output
Returns IIAPI_ST_SUCCESS if the conversion succeeded. Returns IIAPI_ST_FAILURE if there is an invalid parameter value, insufficient space to hold the resulting data value, or the input data value could not be converted to the requested type.
The IIapi_getColumns() function returns the results of a query statement or database event retrieval created by IIapi_query() or IIapi_catchEvent() to the application. It retrieves into the application's buffers the requested number of columns of data.
This function is always preceded with the IIapi_getDescriptor() or IIapi_getCopyMap() function, which describes the format and number of columns to be returned to the application from the server.
IIapi_getColumns() can return multiple rows. If there are long varchar or long byte data columns, IIapi_getColumns() returns only one row at a time.
If one of the columns is a long varchar or long byte that requires more than one segment to be returned, the application requests the segments individually with single calls to IIapi_getColumns(). For example, a row of ten columns with a long varchar or long byte spanning multiple segments as the fifth column is handled as follows. The application:
IIapi_getColumns() returns columns sequentially in the order that they appear in the row, as described in IIapi_getCopyMap() and IIapi_getDescriptor(). When IIAPI_ST_NO_DATA is returned, the application should free the statement handle with the IIapi_close() function.
IIapi_getColumns() assumes the application has allocated sufficient storage for each column. The buffer size of each column should be equal to the ds_length parameter of its corresponding descriptor from IIapi_getCopyMap() or IIapi_getDescriptor().
This function has the following syntax:
II_VOID IIapi_getColumns (IIAPI_GETCOLPARM *getColParm);
typedef struct _IIAPI_GETCOLPARM
{
IIAPI_GENPARM gc_genParm;
II_PTR gc_stmtHandle;
II_INT gc_rowCount;
II_INT gc_columnCount;
IIAPI_DATAVALUE *gc_columnData;
II_INT gc_rowsReturned
II_BOOL gc_moreSegments;
} IIAPI_GETCOLPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement handle identifying the query or event handle identifying the database event.
Type: input
Specifies the number of rows to fetch. This parameter must be 1 if the query contains any long varchar or long byte values.
Type: input
Specifies the number of columns to retrieve. This parameter must contain a non-zero positive integer, and it cannot exceed the total number of columns in a row.
Type: delayed output
Specifies an array of buffers. The number of buffers in this array must equal gc_rowCount * gc_columnCount. The first gc_columnCount buffers receive the columns from the first row. The second row follows immediately after the first. Each buffer must have enough allocated memory to store the value of a column in the order specified by the descriptors returned from IIapi_getDescriptor() or IIapi_getCopyMap().
Type: delayed output
Specifies the number of rows actually returned in gc_columnData.
Type: delayed output
Indicates whether there is more data to be retrieved for a column of a long varchar or long byte data type. This parameter is set to TRUE if the data type is long varchar or long byte and more data must be retrieved for the current column; otherwise, the parameter is set to FALSE.
The IIapi_getCopyMap() function returns a pointer to a copy map for data being copied from a file to a database table or from a database table to a file. The copy map describes the data in the file and in the database table.
IIapi_getCopyMap() output remains valid until the copy statement is closed with IIapi_close().
This function has the following syntax:
II_VOID IIapi_getCopyMap (IIAPI_GETCOPYMAPPARM *getCopyMapParm);
typedef struct _IIAPI_GETCOPYMAPPARM
{
IIAPI_GENPARM gm_genParm;
II_PTR gm_stmtHandle;
IIAPI_COPYMAP gm_copyMap;
} IIAPI_GETCOPYMAPPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement handle identifying the copy statement.
Type: delayed output
Specifies the copy map returned from the server. The copy map contains descriptions of the data in the file and in the database table.
The IIapi_getDescriptor() function retrieves information from the server about the format of the data being returned to the application. This information includes the number of columns in a row and the type, length, precision, and scale of each column. The actual values are returned with a subsequent call to IIapi_getColumns().
IIapi_getDescriptor() output remains valid until the query is ended with the IIapi_close() function.
This function has the following syntax:
II_VOID IIapi_getDescriptor (IIAPI_GETDESCRPARM *getDescrParm);
typedef struct _IIAPI_GETDESCRPARM
{
IIAPI_GENPARM gd_genParm;
II_PTR gd_stmtHandle;
II_LONG gd_descriptorCount;
IIAPI_DESCRIPTOR *gd_descriptor;
} IIAPI_GETDESCRPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement handle identifying the query or event handle identifying the database event.
Type: delayed output
Specifies the number of columns being returned. This parameter is 0 if there is no data that meets the criteria of the query.
Type: delayed output
Specifies an array of buffers. The number of buffers is equal to the gd_descriptorCount value. Each buffer contains the description of a column, including information about the data type, length, precision, and scale.
The memory for this parameter is managed by OpenAPI. For more information, see How Memory is Managed for Data Input and Output.
The IIapi_getErrorInfo() function returns a set of error parameters or user-defined information specified by an error handle. User-defined information consists of messages declared in a database procedure. These messages are returned during the execution of the database procedure.
Because the error handle can contain more than one set of error parameters, the application should repeat IIapi_getErrorInfo() until the status IIAPI_ST_NO_DATA is returned by the ge_status parameter.
The output of IIapi_getErrorInfo() is valid until another operation is invoked with the same handle.
This function has the following syntax:
II_VOID IIapi_getErrorInfo (IIAPI_GETEINFOPARM *getEInfoParm);
typedef struct _IIAPI_GETEINFOPARM
{
II_PTR ge_errorHandle;
II_LONG ge_type;
II_CHAR ge_SQLSTATE[6];
II_LONG ge_errorCode;
II_CHAR *ge_message;
II_BOOL ge_serverInfoAvail;
IIAPI_SVR_ERRINFO *ge_serverInfo;
IIAPI_STATUS ge_status;
} IIAPI_GETEINFOPARM;
This function has the following parameters:
Type: input
Indicates the error handle returned in the generic parameters.
Type: immediate output
Indicates the type of message. Its value is one of the following:
Type: immediate output
Indicates the SQLSTATE value of the error.
Type: immediate output
Indicates the error code generated by the server.
Type: immediate output
Provides the text of the message.
The OpenAPI manages the memory for this parameter. For more information, see How Memory is Managed for Data Input and Output.
Type: immediate output
Indicates whether additional information will be made available. TRUE if the server sent the message; FALSE if the message was generated by OpenAPI. If TRUE, additional information is available in ge_serverInfo.
Type: immediate output
Specifies additional information sent by the server. Only available if ge_serverInfoAvail is TRUE.
Type: immediate output
Indicates the status of the function upon its return. Its value is one of the following:
The IIapi_getEvent() function provides an interface for applications to wait for database events to occur. The IIapi_getEvent() function checks for database events that are received, independent of other query results being returned by the server. Database event information is retrieved using IIapi_catchEvent(), which should be called prior to calling IIapi_getEvent().
An application prepares to process database events by registering with the server (IIapi_query()) and OpenAPI (IIapi_catchEvent()) for specific events. The application can then receive event notification while processing other queries on the connection.
IIapi_getEvent() can be called to receive database events when the application does not have any query processing to be performed on the desired connection. No queries can be issued on the specified connection handle until IIapi_getEvent() completes.
This function has the following syntax:
II_VOID IIapi_getEvent ( IIAPI_GETEVENTPARM *getEventParm );
typedef struct _IIAPI_GETEVENTPARM
{
IIAPI_GENPARM gv_genParm;
II_PTR gv_connHandle;
II_LONG gv_timeout;
} IIAPI_GETEVENTPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the connection handle, identifying the connection to the target server, or the environment handle.
Type: input
Specifies the maximum time in milliseconds to wait for the database event to be received. A value of -1 means to wait indefinitely. A value of 0 polls for events without waiting.
Note: Support for timeouts is platform-dependent. If timeouts are not supported, all values are treated the same as -1.
The IIapi_getQueryInfo() function returns data associated with a query statement. It is useful for applications that are updating the database to know if the update was successful. The information includes the following:
As a common practice, applications should call IIapi_getQueryInfo() after each query is completed to check if there are any additional errors or response data reported by the server.
The output of IIapi_getQueryInfo() is valid until the query statement is ended with the IIapi_close() function.
This function has the following syntax:
II_VOID IIapi_getQueryInfo (IIAPI_GETQINFOPARM *getQInfoParm);
typedef struct _IIAPI_GETQINFOPARM
{
IIAPI_GENPARM gq_genParm;
II_PTR gq_stmtHandle;
II_ULONG gq_flags;
II_ULONG gq_mask;
II_LONG gq_rowCount;
II_BOOL gq_readonly
II_LONG gq_procedureReturn;
II_PTR gq_procedureHandle;
II_PTR gq_repeatQueryHandle;
II_CHAR gq_tableKey [TBL_KEY_SZ];
II_CHAR gq_objectKey [OBJ_KEY_SZ];
} IIAPI_GETQINFOPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement handle identifying the query.
Type: delayed output
Provides status flags indicating result of the query. This parameter is 0 or a mask of the following values:
IIAPI_GQF_FAIL
IIAPI_GQF_ALL_UPDATED
IIAPI_GQF_NULLS_REMOVED
IIAPI_GQF_UNKNOWN_REPEAT_QUERY
IIAPI_GQF_END_OF_DATA
IIAPI_GQF_CONTINUE
IIAPI_GQF_INVALID_STATEMENT
IIAPI_GQF_TRANSACTION_INACTIVE
IIAPI_GQF_OBJECT_KEY
IIAPI_GQF_TABLE_KEY
IIAPI_GQF_NEW_EFFECTIVE_USER
IIAPI_GQF_FLUSH_QUERY_ID
IIAPI_GQF_ILLEGAL_XACT_STMT
Type: delayed output
Specifies the mask indicating the available response data. This parameter is 0 or a mask of the following values:
IIAPI_GQ_ROW_COUNT
IIAPI_GQ_CURSOR
IIAPI_GQ_PROCEDURE_RET
IIAPI_GQ_PROCEDURE_ID
IIAPI_GQ_REPEAT_QUERY_ID
IIAPI_GQ_TABLE_KEY
IIAPI_GQ_OBJECT_KEY
This parameter is 0 if no response data is available.
Type: delayed output
Specifies the number of rows affected by the query. This parameter is valid only if the IIAPI_GQ_ROW_COUNT mask is set in gq_mask; otherwise, this parameter should be ignored.
Type: delayed output
Indicates the type of cursor opened. Set to TRUE if the statement handle represents a cursor opened for READONLY; otherwise, FALSE. This information is available after IIapi_getDescriptor() or IIapi_getColumns() completes successfully.
This parameter is valid only if the IIAPI_GQ_CURSOR mask is set in gq_mask; otherwise, this parameter should be ignored.
Type: delayed output
Indicates the return status of an executed database procedure. This parameter is valid only if the IIAPI_GQ_PROCEDURE_RET mask is set in gq_mask; otherwise, this parameter should be ignored.
Type: delayed output
Specifies the procedure handle for a database procedure. This handle can be used for subsequent executions of the procedure. It is used as a parameter of a query when the query type is IIAPI_QT_EXEC_PROCEDURE.
This parameter is valid only if the IIAPI_GQ_PROCEDURE_ID mask is set in gq_mask; otherwise, this parameter should be ignored.
Type: delayed output
Specifies the repeat query handle for a repeat query. This handle is used for a future invocation of a repeat query. It is used as a parameter of a query when the query type is IIAPI_QT_EXEC_REPEAT_QUERY.
This parameter is valid only if the IIAPI_GQ_REPEAT_QUERY_ID mask is set in gq_mask; otherwise, this parameter should be ignored.
Type: delayed output
Specifies the table key value. This parameter is valid only if the IIAPI_GQ_TABLE_KEY mask is set in gq_mask; otherwise, this parameter should be ignored.
Type: delayed output
Specifies the object key value. This parameter is valid only if the IIAPI_GQ_OBJECT_KEY mask is set in gq_mask; otherwise, this parameter should be ignored.
The IIapi_initialize() function prepares OpenAPI for operation. This function allocates an environment handle and returns it to the application. IIapi_initialize() must be called before the application performs any memory allocation and OpenAPI functions. When IIapi_initialize() completes, the application can begin issuing other OpenAPI functions. This function can be called more than once, but each call requires a corresponding call to IIapi_terminate().
The application specifies the OpenAPI interface version used by the application when calling this function. For version IIAPI_VERSION_1, a single default environment is used as the context for server connections (the returned environment handle is set to NULL). For version IIAPI_VERSION_2 (and higher), a new environment handle is allocated and returned to the application. The application can select environment settings by providing the environment handle as input to IIapi_setEnvParam(). The application can also make connections utilizing the environment settings by providing the environment handle as input to IIapi_setConnectParam() or IIapi_connect(). The environment handle must be released by calling IIapi_releaseEnv().
This function has the following syntax:
II_VOID IIapi_initialize (IIAPI_INITPARM *initParm);
typedef struct _IIAPI_INITPARM
{
II_LONG in_timeout;
II_LONG in_version;
IIAPI_STATUS in_status;
II_PTR in_envHandle;
} IIAPI_INITPARM;
This function has the following parameters:
Type: input
Specifies the maximum time in milliseconds to wait for OpenAPI initialization to occur. A value of -1 is used if a timeout is not desired.
Support for timeouts is platform-dependent. If timeouts are not supported, all values are treated the same as -1.
Type: input
The OpenAPI interface version being used by the application. Any version of OpenAPI can operate correctly with applications coded and compiled for previous versions of OpenAPI. Its value is one of the following:
Specifies the initial version of OpenAPI.
Specifies a version that supports an environment handle, which identifies storage for information about a specific environment setup.
Indicates support for the National Character Set data types:
Indicates support for eight-byte integers (bigint): IIAPI_INT_TYPE.
Indicates support for ANSI date/time types:
Type: output
The status of the function upon its return. Its value is one of the following:
Type: output
Specifies the environment handle returned to the application for the OpenAPI if the version being used by the application is IIAPI_VERSION_2.
The value is NULL if the OpenAPI version being used by the application is IIAPI_VERSION_1.
The IIapi_modifyConnect() function sends the connection parameters, assigned in prior calls to IIapi_setConnectParam(), to the server. Once sent, parameters are cleared so as to not affect subsequent calls to IIapi_modifyConnect(). This function can be called only when no transaction is active on the specified connection.
Note: An Ingres DBMS Server accepts only IIAPI_CP_SHARED_SYS_UPDATE once a connection is established.
This function has the following syntax:
II_VOID IIapi_modifyConnect (IIAPI_MODCONNPARM *modifyConnParm);
typdef struct _IIAPI_MODCONNPARM
{
IIAPI_GENPARM mc_genParm;
II_PTR mc_connHandle;
} IIAPI_MODCONNPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the connection handle, identifying the connection to the target server, or the environment handle.
The IIapi_prepareCommit() function prepares to commit a distributed transaction started with IIapi_query() or restarted by IIapi_connect().
IIapi_prepareCommit() secures resources for a transaction in a two-phase commit situation. When IIapi_prepareCommit() completes successfully, the server has allocated and secured all resources to commit the transaction. The application can then call IIapi_commit() to commit the transaction or IIapi_rollback() to abort the transaction.
Normally two-phase commits are desirable when multiple transactions are being committed as a unit. Each transaction is secured for the commit with IIapi_prepareCommit(). When all transactions have been secured, the application calls IIapi_commit() to finish the two-phase commit process. If some of the transactions cannot be secured, resulting in an unsuccessful completion of IIapi_prepareCommit(), the application can call IIapi_rollback() on each transaction to abort it.
In order to create or restart a distributed transaction, the application calls IIapi_registerXID() to register a unique global transaction ID. This global transaction ID can be used for multiple transactions. The transaction ID handle returned by IIapi_registerXID() can then be provided as input to IIapi_query() or IIapi_connect() to create or restart a distributed transaction. The application used the transaction handle returned by IIapi_query() or IIapi_connect() as input to IIapi_prepareCommit() to specify the distributed transaction for which resources are to be secured.
IIapi_prepareCommit() rejects any transaction handle representing a non-distributed or autocommit transaction.
This function has the following syntax:
II_VOID IIapi_prepareCommit (IIAPI_PREPCMTPARM *prepCommitParm);
typedef struct _IIAPI_PREPCMTPARM
{
IIAPI_GENPARM pr_genParm;
II_PTR pr_tranHandle;
} IIAPI_PREPCMTPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the transaction handle identifying the transaction for the two-phase commit. The value for this handle is from the qy_tranHandle provided by IIapi_query() or co_tranHandle parameter in IIapi_connect().
The IIapi_putColumns() function takes the requested number of columns of data from the application's buffers and copies it to a database table.
This function is preceded with the IIapi_getCopyMap() function, which describes the format and number of columns to be copied.
IIapi_putColumns() processes columns sequentially in the order that they appear in the row, as described in the IIapi_getCopyMap() functions. The application requests that a whole row be sent with one call to IIapi_putColumns(), provided it does not contain any long varchar or long byte columns. However, IIapi_putColumns() cannot span rows, so the application cannot request a number greater than the number of columns in a row.
If one of the columns is a long varchar or long byte that requires more than one segment to be sent, the application sends the columns individually with single calls to IIapi_putColumns(). For example, a row of ten columns with a long varchar or long byte spanning multiple segments as the fifth column is handled as follows. The application:
This function has the following syntax:
II_VOID IIapi_putColumns (IIAPI_PUTCOLPARM *putColParm);
typedef struct _IIAPI_PUTCOLPARM
{
IIAPI_GENPARM pc_genParm;
II_PTR pc_stmtHandle;
II_LONG pc_columnCount;
IIAPI_DATAVALUE *pc_columnData;
II_BOOL pc_moreSegments;
} IIAPI_PUTCOLPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement handle identifying the copy from statement.
Type: input
Specifies the number of columns the application is sending to the server.
Type: input
Specifies an array of buffers containing the data to be sent to the server. The number of buffers in this array must be equal to the value of pc_columnCount.
Type: input
Indicates whether there is more data to be sent for a column of a long varchar or long byte data type. This parameter is set to TRUE if the data type is long varchar or long byte and more data must be sent for the current column; otherwise, the parameter is set to FALSE.
The IIapi_putParms() function allows the application to send parameter data to a server at statement execution time.
This function is preceded with the IIapi_setDescriptor() function, which describes the format and number of parameters to be sent to the server.
IIapi_putParms() processes parameters sequentially in the order they appear in the query. The application sends all parameters with a single call to IIapi_putParms(), provided the parameters do not contain any long varchar or long byte data types. The total number of parameters provided for a query must not be less than the number of parameters the query expects.
If one of the parameters is a long varchar or long byte that requires more than one segment to be sent, the application sends the parameters individually with single calls to IIapi_putColumns(). For example, a row of ten parameters with a long varchar or long byte spanning multiple segments as the fifth parameter is handled as follows. The application:
This function has the following syntax:
II_VOID IIapi_putParms (IIAPI_PUTPARMPARM *putParmParm);
typedef struct _IIAPI_PUTPARMPARM
{
IIAPI_GENPARM pp_genParm;
II_PTR pp_stmtHandle;
II_LONG pp_parmCount;
IIAPI_DATAVALUE *pp_parmData;
II_BOOL pp_moreSegments;
} IIAPI_PUTPARMPARM;
This function has the following parameters:
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement handle identifying the query.
Type: input
Specifies the number of parameters associated with the query.
Type: input
Specifies an array of buffers containing parameter data to be sent to the server. The number of buffers in this array must be equal to the value of pc_parmCount.
Type: input
Indicates whether there is more data to be sent for the current parameter of a long varchar or long byte data type. This parameter is set to TRUE if the data type is long varchar or long byte and more data must be sent for the current parameter; otherwise, it is set to FALSE.
The IIapi_query() function begins a query statement. IIapi_query() allocates a statement handle. The statement handle must eventually be freed with the IIapi_close() function.
An application enters parameters for the query statement with subsequent calls to the IIapi_setDescriptor() and IIapi_putParms() functions. It can also use the qy_queryText parameter of IIapi_query() to enter the syntax of the query statement. The qy_queryText parameter should contain NULL if query text is not required.
Note: For a list of SQL statements that can be invoked by IIapi_query(), see Accessing a DBMS Using SQL.
When entering the syntax of SQL statements in the qy_queryText parameter, see SQL Syntax, and the SQL Reference Guide.
An application specifies the beginning of a transaction with the qy_tranHandle input parameter. If this parameter is NULL or is a transaction ID handle created by IIapi_registerXID(), a new transaction is begun and a transaction handle is allocated. Otherwise, this parameter must be an existing transaction handle and the statement is executed as part of the current transaction.
A transaction handle allocated by this function must be released using IIapi_commit() or IIapi_rollback(). If a transaction handle is allocated for a request which eventually fails, the transaction handle should be released using IIapi_rollback().
Currently, the GCA protocol does not support multiple, concurrent non-cursor statements in the same transaction, or multiple concurrent transactions on the same connection.
This function has the following syntax:
II_VOID IIapi_query (IIAPI_QUERYPARM *queryParm);
typedef struct _IIAPI_QUERYPARM
{
IIAPI_GENPARM qy_genParm;
II_PTR qy_connHandle;
IIAPI_QUERY_TYPE qy_queryType;
II_BOOL qy_queryText;
II_CHAR *qy_parameters;
II_PTR qy_tranHandle;
II_PTR qy_stmtHandle;
} IIAPI_QUERYPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the connection handle, identifying the connection to the target server.
Type: input
Specifies the type of query statement.
Note: If connecting to a DBMS, see Accessing a DBMS Using SQL for valid DBMS query type macros.
For a Name Server connection, this parameter must be IIAPI_QT_QUERY.
Type: input
Specifies the syntax of the query statement, if syntax is required. The query text should be a NULL-terminated string containing the query text with zero or more parameter markers.
Type: input
Indicates whether there are parameters to be sent with the query. TRUE if the application intends to send parameters with the query using IIapi_setDescriptor() and IIapi_putParms(); FALSE if there are no parameters to be sent with the query. OpenAPI requires some parameters for certain query types.
Note: For more information, see Queries, Parameters, and Query Data Correlation.
If FALSE, the query is sent to the server for processing; otherwise, OpenAPI waits for calls to IIapi_setDescriptor() and IIapi_putParms() before sending the query to the server.
Type: input and immediate output
Indicates whether a new transaction should be started or whether an existing transaction should be used. If the parameter is NULL or a transaction ID handle created by IIapi_registerXID(), a new transaction should be started. If the parameter is a transaction handle previously returned by another query, the existing transaction should be used.
For a Name Server connection, this parameter must be an autocommit transaction handle returned by IIapi_autoCommit().
Type: immediate output
Specifies the statement handle identifying the query statement for future OpenAPI function calls.
The IIapi_registerXID() function reserves a unique ID to begin a two-phase commit transaction with IIapi_query() or to restart a previously-aborted two-phase commit transaction with IIapi_connect(). An application must use IIapi_registerXID() if a two-phase commit transaction is being used.
After this function is successfully completed, the output parameter rg_tranIdHandle can be used as input for IIapi_connect() and IIapi_query() to specify a transaction. The transaction ID handle can be used on multiple transactions; it does not uniquely identify one transaction.
The transaction ID handle returned by this function must be release using IIapi_releaseXID().
This function has the following syntax:
VOID IIapi_registerXID (IIAPI_REGXIDPARM *regXIDParm);
typedef struct _IIAPI_REGXIDPARM
{
IIAPI_TRAN_ID rg_tranID;
PTR rg_tranIdHandle;
IIAPI_STATUS rg_status;
} IIAPI_REGXIDPARM;
This function has the following parameters:
Type: input
Specifies the parameter identifying a unique transaction ID. This parameter has the data type of IIAPI_TRAN_ID, which specifies a globally unique Ingres transaction identification.
Type: immediate output
Specifies the transaction ID handle identifying the transaction ID registered with OpenAPI. This handle is used as input to IIapi_query() and IIapi_connect().
Type: immediate output
Indicates the status of IIapi_registerXID() upon completion. Its value can be one of the following:
The IIapi_releaseEnv() function frees an environment handle and any resources associated with the environment handle.
An application calls IIapi_releaseEnv() to free an environment handle allocated by IIapi_initialize(). Any active server connections associated with the environment handle are aborted and the respective connection handle is freed, as are all associated transaction, statement, and database event handles. While this function can be used to clean up quickly after a connection failure, applications are encouraged to continue calling IIapi_close(), IIapi_commit() or IIapi_rollback() and IIapi_disconnect() to cleanly shut down server connections. A warning status is returned if a connection is aborted.
The application can continue to make OpenAPI function calls after calling this function, but does so in the context of the default environment handle shared by all IIAPI_VERSION_1 applications. The application must still call IIapi_terminate() to release global resources used by OpenAPI.
This function has the following syntax:
II_VOID IIapi_releaseEnv (IIAPI_RELENVPARM *relEnvParm);
typedef struct _IIAPI_RELENVPARM
{
II_PTR re_envHandle:
IIAPI_STATUS re_status;
} IIAPI_RELENVPARM;
This function has the following parameters:
Type: input
Specifies the environment handle for which resources should be freed.
Type: output
Specifies the status of the function upon its return. Its value is one of the following:
The IIapi_releaseXID() function releases the transaction ID reserved by IIapi_registerXID(). It also frees the resources associated with the transaction ID handle.
This function has the following syntax:
II_VOID IIapi_releaseXID (IIAPI_RELXIDPARM *relXIDParm);
typedef struct _IIAPI_RELXIDPARM
{
II_PTR rl_tranIdHandle;
IIAPI_STATUS rl_status;
} IIAPI_RELXIDPARM;
This function has the following parameters:
Type: input
Specifies the transaction ID handle identifying the unique transaction ID to be released.
Type: immediate output
Specifies the status of IIapi_releaseXID() upon completion. Its value can be one of the following:
The IIapi_rollback() function rolls back a transaction started with IIapi_query() or restarted by IIapi_connect(). It also frees the transaction handle if the rb_savePointHandle parameter is NULL. If the rb_savePointHandle parameter is the savepoint handle returned by the IIapi_savePoint() function, the transaction is rolled back to the savepoint and the transaction handle remains valid.
Before rolling back a transaction, the application must call IIapi_close() to release all statement handles associated with the transaction.
This function has the following syntax:
II_VOID IIapi_rollback (IIAPI_ROLLBACKPARM *rollbackParm);
typedef struct _IIAPI_ROLLBACKPARM
{
IIAPI_GENPARM rb_genParm;
II_PTR rb_tranHandle;
II_PTR rb_savePointHandle;
} IIAPI_ROLLBACKPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the transaction handle identifying the transaction to be rolled back. Its value is either from qy_tranHandle of IIapi_query() or co_tranHandle parameter of IIapi_connect().
Type: input
Specifies an optional savepoint for the current rollback. This parameter contains a handle of the savepoint, returned by the IIapi_savePoint() function. If there is no savepoint for the current rollback, this parameter is NULL.
The IIapi_savePoint() function marks a savepoint in a transaction for a partial rollback with the IIapi_rollback() function.
The sp_savePointHandle parameter that is output from this function is unique to the transaction and remains valid until the transaction is committed or completely rolled back.
This function has the following syntax:
II_VOID IIapi_savePoint (IIAPI_SAVEPTPARM *savePtParm);
typedef struct _IIAPI_SAVEPTPARM
{
IIAPI_GENPARM sp_genParm;
II_PTR sp_tranHandle;
II_CHAR *sp_savePoint;
II_PTR sp_savePointHandle;
} IIAPI_SAVEPTPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the transaction handle identifying the transaction for which the savepoint is specified. Its value is either from qy_tranHandle of IIapi_query() or co_tranHandle parameter of IIapi_connect().
Type: input
Specifies the identifier for the savepoint marker. It is a NULL-terminated string unique within the transaction.
Type: delayed output
Specifies the savepoint handle identifying the savepoint marker.
The IIapi_setConnectParam() function allows the application to assign connection parameters to a connection. These parameters are sent to the server when IIapi_connect() or IIapi_modifyConnect() are called. One parameter and associated value are assigned for each call to IIapi_setConnectParam().
This function creates a new connection handle if called with sc_connHandle set to NULL or an environment handle returned by IIapi_initialize(). The returned connection handle can be used in subsequent calls to assign additional connection parameters to the connection. The connection handle can then be used to call IIapi_connect() to establish the connection to the server with the desired connection parameters. The connection handle is released using IIapi_disconnect() or IIapi_abort().
Once a connection has been established with IIapi_connect(), IIapi_setConnectParam() can be called with the connection handle to assign new connection parameters or to modify the parameters established with IIapi_connect(). Parameters assigned after calling IIapi_connect() are sent to the server by calling IIapi_modifyConnect().
This function has the following syntax:
II_VOID IIapi_setConnectParam (IIAPI_SETCONPRMPARM *setConPrmParm);
typedef struct _IIAPI_SETCONPRMPARM
{
IIAPI_GENPARM sc_genParm;
II_PTR sc_connHandle;
II_LONG sc_paramID;
II_PTR sc_paramValue;
} IIAPI_SETCONPRMPARM;
Note: Only IIAPI_CP_SHARED_SYS_UPDATE is accepted by an Ingres DBMS Server once a connection is established.
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input and immediate output
Specifies the input and output for a connection handle.
The input is NULL for a new connection associated with the default environment, an environment handle for a new connection associated with the environment, or an existing connection handle.
The output is a connection handle that can be used in subsequent calls to IIapi_setConnectParam() and IIapi_connect().
Type: input
Specifies the parameter being assigned. For valid parameter ID macros, see the following table.
Type: input
Specifies the value of the parameter being assigned. The data type and description of the value associated with each parameter ID are as follows (valid parameter ID macros for the sc_paramID parameter).
Data type: II_CHAR
The role ID of the application. If a role password is required, the parameter value should be specified as "role/password".
Data type: II_LONG
Specifies the value for an internal flag used for debugging a corrupted database. This flag is for Ingres internal applications; it must not be used by non-Ingres applications.
Data type: II_LONG
Specifies the date century boundary.
Data type: II_LONG
Specifies the maximum length of a character (IIAPI_BYTE_TYPE, IIAPI_CHA_TYPE, IIAPI_CHR_TYPE, or IIAPI_VCH_TYPE) data type.
Data type: II_LONG
Specifies the date format. Its value can be one of the following:
IIAPI_CPV_DFRMT_US
IIAPI_CPV_DFRMT_MULTI
IIAPI_CPV_DFRMT_FINNISH
IIAPI_CPV_DFRMT_ISO
IIAPI_CPV_DFRMT_GERMAN
IIAPI_CPV_DFRMT_YMD
IIAPI_CPV_DFRMT_MDY
IIAPI_CPV_DFRMT_DMY
Data type: II_CHAR
Specifies the DBMS password for the user.
Data type: II_CHAR
Specifies the character identifier of decimal data.
Data type: II_CHAR
Specifies the effective user name for the new session.
Data type: II_BOOL
Indicates whether the database should be locked for exclusive use of this application. If it should be locked, this parameter is TRUE; otherwise, it is FALSE.
Data type: II_BOOL
Indicates whether the system catalog should be updated with an exclusive lock. If so, this parameter is TRUE; otherwise, it is FALSE.
Data type: II_LONG
Specifies the precision of a float4 (IIAPI_FLT_TYPE) data type.
Data type: II_CHAR
Specifies the output column format for the four-byte floating-point data type. Its value can be one of the following:
Default: IIAPI_CPV_FLOATDEC
Data type: II_LONG
Specifies the length of a float4 (IIAPI_FLT_TYPE) data type.
Data type: II_LONG
Specifies the precision of a float8 (IIAPI_FLT_TYPE) data type.
Data type: II_CHAR
Specifies the output column format for an eight-byte floating-point data type. Its value can be one of the following:
Default: IIAPI_CPV_FLOATDEC
Data type: II_LONG
Specifies the length of a float8 (IIAPI_FLT_TYPE) data type.
Data type: II_CHAR
Specifies Enterprise Access parameters. This parameter can be set multiple times.
Data type: II_CHAR
Specifies the group ID of the user.
Data type: II_LONG
Specifies the length of an integer1 (IIAPI_INT_TYPE) data type.
Data type: II_LONG
Specifies the length of an integer2 (IIAPI_INT_TYPE) data type.
Data type: II_LONG
Specifies the length of an integer4 (IIAPI_INT_TYPE) data type.
Data type: II_LONG
Specifies the length of an integer8 (IIAPI_INT_TYPE) data type (ignored if connection level, co_apiLevel, is less than IIAPI_LEVEL_3).
Data type: II_BOOL
Determines how the connection user ID and password are used when a VNODE is included in the target database string. If set to TRUE, the user ID and password are used to locally access the VNODE and the VNODE login information is used to establish the DBMS connection. If set to FALSE, the process user ID is used to access the VNODE and the connection user ID and password are used in place of the VNODE login information to establish the DBMS connection. This parameter is ignored if no VNODE is included in the target database string. The default is FALSE.
Data type: II_CHAR
Specifies the type of error message to be returned because of a numerical overflow/underflow at the server. Its value can be one of the following:
Data type: II_CHAR
Specifies miscellaneous parameters. This parameter can be set multiple times.
Data type: II_LONG
Indicates a leading or trailing money sign. Valid values are one of the following:
Data type: II_LONG
Specifies the precision of the money (IIAPI_MNY_TYPE) data type.
Data type: II_CHAR
Specifies the money sign.
Data type: II_CHAR
Specifies the name of the language used for error reporting. This is converted to a language code prior to sending to the server. Can be set to NULL to obtain the default installation language.
Data type: II_LONG
Specifies the language code of the native language used for error reporting. IIAPI_CP_NATIVE_LANG can be used when the language code is not known.
Data type: II_CHAR
Specifies the treatment of the numeric literal. Its value can be one of the following:
Data type: II_LONG
Specifies the default result table structure. Its value can be one of the following:
IIAPI_CPV_ISAM
IIAPI_CPV_CISAM
IIAPI_CPV_HEAP
IIAPI_CPV_CHEAP
IIAPI_CPV_BTREE
IIAPI_CPV_CBTREE
IIAPI_CPV_HASH
IIAPI_CPV_CHASH
Data type: II_LONG
Specifies the default secondary index structure. Its value can be one of the following:
IIAPI_CPV_ISAM
IIAPI_CPV_CISAM
IIAPI_CPV_BTREE
IIAPI_CPV_CBTREE
IIAPI_CPV_HASH
IIAPI_CPV_CHASH
Data type: II_LONG
Specifies the type of server function desired. Its value can be one of the following:
IIAPI_CPV_SVNORMAL
IIAPI_CPV_MONITOR
Data type: II_BOOL
Indicates whether the system catalog should be updated with a shared lock. If so, this parameter is TRUE; otherwise, it is FALSE.
Data type: II_CHAR
Specifies the parameters for specifying how to handle truncation when a string value is being inserted into a column that is too short to contain the value. Its value can be one of the following:
Data type: II_CHAR
Specifies the time zone of the application.
Data type: II_LONG
Specifies the maximum length of a text (IIAPI_TXT_TYPE) data type.
Data type: II_BOOL
Indicates whether the application is willing to wait for a lock on the database to be released. If so, this parameter is TRUE; otherwise, it is FALSE.
The IIapi_setDescriptor() function sends information about the format of data that will be provided with the IIapi_putParms() or IIapi_putColumns() function. Parameters to IIapi_setDescriptor() contain the number of columns being inserted or copied to the database, as well as their data type, length, precision, and scale.
Sends information to the server about the format of data to be provided in subsequent calls to IIapi_putParms() and IIapi_putColumns().
This function has the following syntax:
II_VOID IIapi_setDescriptor
(IIAPI_SETDESCRPARM *setDescrParm);
typedef struct _IIAPI_SETDESCRPARM
{
IIAPI_GENPARM sd_genParm;
II_PTR sd_stmtHandle;
II_LONG sd_descriptorCount;
IIAPI_DESCRIPTOR *sd_descriptor;
} IIAPI_SETDESCRPARM;
This function has the following parameters:
Type: input and delayed output
Specifies the generic parameters. For a description, see Generic Parameters.
Type: input
Specifies the statement handle identifying the query.
Type: input
Specifies the number of columns being described by sd_descriptor.
Type: input
Specifies an array of buffers containing the descriptions of the columns. The number of buffers in this array must be equal to the sd_descriptorCount value. Each buffer includes the data type, length, precision, and scale.
The IIapi_setEnvParam() function allows the application to override the default environment logical settings established by the IIapi_initialize() for a specific environment handle.
Settings for environment parameters, which correspond to connection parameters, are used as the default connection parameter values unless specifically overridden by IIapi_setConnectParam().
Environment parameters also affect the conversions performed by IIapi_formatData() and control interactions between OpenAPI and the application.
This function has the following syntax:
II_VOID IIapi_setEnvParam (IIAPI_SETENVPRMPARM *setEnvPrmParm);
typedef struct _IIAPI_SETENVPRMPARAM
{
II_PTR se_envHandle;
II_LONG se_paramID
II_PTR se_paramValue
IIAPI_STATUS se_status
} IIAPI_SETENVPRMPARM;
This function has the following parameters:
Type: input
Specifies the environment handle for the parameter being assigned.
Type: input
Specifies the parameter being assigned. For valid parameter ID macros, see the following list.
Type: input
Specifies the value of the parameter being assigned. For the data type and description of the value associated with each parameter ID, see the following list.
Type: output
Specifies the status of the function upon its return. Its value is one of the following:
IIAPI_ST_SUCCESS
IIAPI_ST_FAILURE
IIAPI_ST_NOT_INITIALIZED
IIAPI_ST_INVALID_HANDLE
The following table lists valid parameter ID macros for the se_paramID parameter:
Data type: II_LONG
Specifies the maximum length of a character data type (IIAPI_BYTE_TYPE, IIAPI_CHA_TYPE, IIAPI_CHR_TYPE, IIAPI_VCH_TYPE).
Data type: II_LONG
Specifies the maximum length of a text data type (IIAPI_TXT_TYPE).
Data type: II_LONG
Specifies the length of an integer1 data type (IIAPI_INT_TYPE).
Data type: II_LONG
Specifies the length of an integer2 data type (IIAPI_INT_TYPE).
Data type: II_LONG
Specifies the length of an integer4 data type (IIAPI_INT_TYPE).
Data type: II_LONG
Specifies the length of a float4 data type (IIAPI_FLT_TYPE).
Data type: II_LONG
Specifies the length of an integer8 (IIAPI_INT_TYPE) data type (ignored if connection level, co_apiLevel, is less than IIAPI_LEVEL_3).
Data type: II_LONG
Specifies the length of a float8 data type (IIAPI_FLT_TYPE).
Data type: II_LONG
Specifies the precision of a float4 data type (IIAPI_FLT_TYPE).
Data type: II_LONG
Specifies the precision of a float8 data type (IIAPI_FLT_TYPE).
Data type: II_LONG
Specifies the precision of a money data type (IIAPI_MNY_TYPE).
Data type: II_CHAR
Specifies the format style of a float4 data type (IIAPI_FLT_TYPE).
Data type: II_CHAR
Specifies the format style of a float8 data type (IIAPI_FLT_TYPE).
Data type: II_CHAR
Specifies the treatment of the numeric literal. Its value is one of the following:
Data type: II_CHAR
Specifies the money sign of an IIAPI_MNY_TYPE data type.
Data type: II_LONG
Specifies the leading or trailing money sign. Its value is one of the following:
Data type: II_CHAR
Specifies the decimal character.
Data type: II_CHAR
Specifies the treatment of math exceptions. Its value is one of the following:
IIAPI_EPV_RET_FATAL
IIAPI_EPV_RET_WARN
IIAPI_EPV_RET_IGNORE
Data type: II_CHAR
Specifies the truncation of strings.
Data type: II_LONG
Specifies the date format. Its value is one of the following:
IIAPI_EPV_DFRMT_US
IIAPI_EPV_DFRMT_MULT
IIAPI_EPV_DFRMT_FINNISH
IIAPI_EPV_DFRMT_ISO
IIAPI_EPV_DFRMT_GERMAN
IIAPI_EPV_DFRMT_YMD
IIAPI_EPV_DFRMT_MDY
IIAPI_EPV_DFRMT_DMY
Data type: II_CHAR
Specifies the name of the time zone.
Data type: II_CHAR
Specifies the name of the language used for error reporting. This is converted to a language code prior to sending it to the server.
Data type: II_LONG
Specifies the language code of the native language used for error reporting. IIAPI_EP_NATIVE_LANG can be used when the language code is not known.
Data type: II_LONG
Specifies the date century boundary.
Data type: II_LONG
Specifies the value used as the ds_length value when describing a BLOB column using IIapi_getDescriptor(), and will therefore be used as the segment length when retrieving a BLOB using IIapi_getColumns().
Data type: II_PTR
Specifies the callback function pointer to the application for trace messages. For more information on setting this value, see Environment Parameter IIAPI_EP_EVENT_FUNC.
Data type: II_PTR
Specifies the callback function pointer to the application for database event notification. For more information on setting this value, see Environment Parameter IIAPI_EP_EVENT_FUNC.
Data type: II_PTR
Specifies the callback function pointer to the application for database password prompting. For more information on setting this value, see Environment Parameter IIAPI_EP_CAN_PROMPT.
An application can set IIAPI_EP_CAN_PROMPT in the IIapi_setEnvParam() function by providing the address of an application function to call back. OpenAPI invokes this application function to receive a reply from the application for the prompt message from the server using the following C structure:
typedef struct _IIAPI_PROMPTPARM
{
II_PTR pd_envHandle;
II_PTR pd_connHandle;
II_LONG pd_flags;
II_LONG pd_timeout;
II_UINT2 pd_msg_len;
II_CHAR *pd_message;
II_UINT2 pd_max_reply;
II_LONG pd_rep_flags;
II_UINT2 pd_rep_len;
II_CHAR *pd_reply;
} IIAPI_PROMPTPARM;
The syntax of the application function is as follows:
II_VOID promptFunc(IIAPI_PROMPTPARM *parm);
The application must invoke IIapi_setEnvParam() by setting se_paramID to IIAPI_EP_CAN_PROMPT and se_paramValue to the address of an application-supplied function that matches the calling sequence of the promptFunc() template function shown.
The IIAPI_PROMPTPARM parameters are described in the following table:
Type: input
Specifies the environment handle associated with the connection. It is NULL if the connection belongs to the default environment associated with IIAPI_VERSION_1 applications.
Type: input
Specifies the connection handle identifying the connection.
Type: input
Specifies the prompt flags. Its value is one of the following:
IIAPI_PR_NOECHO will be set if user input should not be echoed, generally indicating a request for a password. IIAPI_PR_TIMEOUT will be set if the pd_timeout parameter has a valid value.
Type: input
Specifies the maximum time, in seconds, to wait for user input. Ignore this parameter if IIAPI_PR_TIMEOUT is not set in pd_flags.
Support for timeouts is platform-dependent.
Type: input
Specifies the length of the prompt message in pd_message.
Type: input
Specifies the message to be displayed when prompting for user input.
Type: input
Specifies the maximum length of user input to be returned in pd_reply.
Type: output
Specifies the response flags. The valid value is IIAPI_REPLY_TIMEOUT. Set this value if timeout occurred waiting for user response. (See IIAPI_PR_TIMEOUT in the pd_flags description.)
Type: output
Specifies the length of the user response in pd_reply.
Type: output
Specifies the user response.
An application can set IIAPI_EP_TRACE_FUNC in the IIapi_setEnvParam() function by providing an address of an application function to call back. OpenAPI invokes this application function to send trace information from the server to the application using the following C structure:
typedef struct _IIAPI_TRACEPARM
{
II_PTR tr_envHandle;
II_PTR tr_connHandle;
II_INT4 tr_length;
II_CHAR *tr_message;
} IIAPI_TRACEPARM;
The syntax of the application function is as follows:
II_VOID traceFunc(IIAPI_PROMPTPARM *parm);
The application must invoke IIapi_setEnvParam() by providing se_paramID to be IIAPI_EP_TRACE_FUNC and se_paramValue to the address of an application-supplied function that matches the calling sequence of the traceFunc() function template shown in this section.
The IIAPI_TRACEPARM parameters are described in the following table:
Type: input
Specifies the environment handle associated with the connection. It is NULL if the connection belongs to the default environment associated with IIAPI_VERSION_1 applications.
Type: input
Specifies the connection handle identifying the connection.
Type: input
Specifies the length of the output trace message in tr_message.
Type: input
Specifies the output trace message.
An application can set IIAPI_EP_EVENT_FUNC in the IIapi_setEnvParam() function by providing an address of an application function to callback. OpenAPI invokes this application function to send information on database events which failed to match an existing OpenAPI event handle (and would otherwise be ignored) to the application using the following C structure:
typedef struct _IIAPI_EVENTPARM
{
II_PTR ev_envHandle;
II_PTR ev_connHandle;
II_CHAR *ev_eventName;
II_CHAR *ev_eventOwner;
II_CHAR *ev_eventDB;
IIAPI_DATAVALUE ev_eventTime;
} IIAPI_EVENTPARM;
The syntax of the application function is as follows:
II_VOID eventFunc(IIAPI_EVENTPARM *parm);
The application must invoke IIapi_setEnvParam() by providing sc_paramID to be IIAPI_EP_EVENT_FUNC and sc_paramValue to the address of an application-supplied function that matches the calling sequence of the eventFunc() function template shown in this section.
The IIAPI_EVENTPARM parameters are described in the following table:
Type: input
Specifies the environment handle associated with the connection. It is NULL if the connection is associated with the default environment assigned to IIAPI_VERSION_1 applications.
Type: input
Specifies the connection handle identifying the connection.
Type: input
Specifies the name of the database event.
Type: input
Specifies the owner of the database event.
Type: input
Specifies the name of the database that raised the event.
Type: input
Specifies the time the event occured, stored as an IIAPI_DTE_TYPE data value.
The IIapi_terminate() function cleans up all OpenAPI resources. This function should be called when OpenAPI functions are no longer used in the application. If multiple calls to IIapi_initialize() have been made, the OpenAPI is shut down only when the last corresponding call to this function is made; a warning status is returned otherwise.
This function has the following syntax:
II_VOID IIapi_terminate (IIAPI_TERMPARM *termParm);
typedef struct _IIAPI_TERMPARM
{
IIAPI_STATUS tm_status;
} IIAPI_TERMPARM;
This statement has the following parameter:
Type: output
The status of the function upon its return. Its value is one of the following:
The IIapi_wait() function enables an application to give control to OpenAPI until an outstanding task completes. Because OpenAPI is asynchronous and many operating systems do not provide an interrupt mechanism for receiving incoming messages, IIapi_wait() provides a way to yield the flow of control to OpenAPI. By occasionally calling IIapi_wait(), an application ensures that it will receive incoming messages from the server.
IIapi_wait() can be used in two programming styles: synchronous and asynchronous. To support the synchronous style of programming, the application can invoke an OpenAPI function and call IIapi_wait() until the application notes the completion of the function (by checking gp_completed) before calling the next function.
In an asynchronous application, the application code itself is event-driven (the events being OpenAPI function completions). Once the first function is invoked, the application calls IIapi_wait() in a continuous top-level loop to drive all subsequent functions asynchronously.
This function has the following syntax:
II_VOID IIapi_wait (IIAPI_WAITPARM *waitParm);
typedef struct _IIAPI_WAITPARM
{
II_LONG wt_timeout;
II_API_STATUS wt_status;
} IIAPI_WAITPARM;
This function has the following parameters:
Type: input
(Optional.) Indicates the maximum time in milliseconds to wait for the outstanding operations to complete. If timeout is not desired, this parameter is -1.
Support for timeouts is platform-dependent. If timeouts are not supported, all values are treated the same as -1.
Type: output
Specifies the status of the function upon its return. Its value is one of the following: