The OpenAPI data structures are described in the following sections.
The IIAPI_COPYMAP data type provides information needed to execute the copy statement, including the copy file name, log file name, number of columns in a row, and a description of the data.
This data type has the following syntax:
typedef struct _IIAPI_COPYMAP
{
II_BOOL cp_copyFrom;
II_ULONG cp_flags;
II_LONG cp_errorCount;
II_CHAR II_FAR *cp_fileName;
II_CHAR II_FAR *cp_logName;
II_INT2 cp_dbmsCount;
IIAPI_DESCRIPTOR II_FAR *cp_dbmsDescr;
II_INT2 cp_fileCount;
IIAPI_FDATADESCR II_FAR *cp_fileDescr;
} IIAPI_COPYMAP;
This data type has the following parameters:
Indicates what kind of copy operation is being used. TRUE if the query is COPY FROM; FALSE if the query is COPY INTO.
Specifies the number of columns in a row in the database table.
Specifies an array of data describing the database table column. The number of entries in this array is cp_dbmsCount.
The memory for this parameter is managed by the OpenAPI.
Note: For more information, see How Memory is Managed for Data Input and Output.
Specifies the maximum number of errors allowed to occur before the copy statement is aborted.
Specifies the number of data items in the copy file.
Specifies an array of data describing the copy file data items. The number of entries in this array is cp_fileCount.
The memory for this parameter is managed by the OpenAPI.
Note: For more information, see How Memory is Managed for Data Input and Output.
Specifies a NULL-terminating string containing the name of the copy file. This parameter cannot be NULL.
The memory for this parameter is managed by the OpenAPI.
Note: For more information, see How Memory is Managed for Data Input and Output.
Specifies flag bits for the copy statement. Currently, there are no flag bits defined. (This parameter is reserved for future use.)
Specifies a NULL-terminating string containing the name of the log file that logs all errors occurring during the copy. This parameter is NULL if logging of copy errors is not desired.
Note: For more information, see How Memory is Managed for Data Input and Output.
The memory for this parameter is managed by the OpenAPI.
The IIAPI_DATAVALUE data type contains the value for OpenAPI data. If the value is unavailable, this data type contains a NULL value and the dv_null parameter is TRUE.
This data type has the following syntax:
typedef struct _IIAPI_DATAVALUE
{
II_BOOL dv_null;
II_UINT2 dv_length;
II_PTR dv_value;
} IIAPI_DATAVALUE;
This data type has the following parameters:
Indicates whether the data is NULL. If it is NULL, this parameter is TRUE; otherwise, it is FALSE.
Specifies the length of the data.
Specifies the value of the data. When used to provide input to an OpenAPI function, this parameter must contain dv_length bytes of data. When used to receive output from an OpenAPI function, this parameter must be large enough to hold the datatype described by the corresponding descriptor (ds_length from IIAPI_DESCRIPTOR).
The IIAPI_DESCRIPTOR data type describes OpenAPI data, including its type, length, precision, scale, and usage. This data is normally stored in an array of II_DATAVALUE data type values.
This data type has the following syntax:
typedef struct _IIAPI_DESCRIPTOR
{
IIAPI_DT_ID ds_dataType;
II_BOOL ds_nullable;
II_UINT2 ds_length;
II_INT2 ds_precision;
II_INT2 de_scale;
II_INT2 ds_columnType;
II_CHAR *ds_columnName;
} IIAPI_DESCRIPTOR;
This data type has the following parameters:
Specifies the data type of the value being described.
Indicates whether the data is nullable. If so, this parameter is TRUE; otherwise, it is FALSE.
Specifies the length of the value being described.
Specifies the precision of the value being described. It is valid only when the ds_dataType is IIAPI_DEC_TYPE or IIAPI_FLT_TYPE.
Specifies the scale of the value being described. It is valid only when the ds_dataType parameter is IIAPI_DEC_TYPE.
Specifies the usage of the value being described. Its value can be one of the following:
Note: IIAPI_COL_PROCINPARM is a synonym for IIAPI_COL_PROCPARM.
Note: IIAPI_COL_PROCINOUTPARM is a synonym for IIAPI_COL_PROCBYREFPARM.
For a description of how IIapi_query() uses column types to describe its parameters, see Query Data Correlation. Except for the information there, copy and tuple data always have the column type of IIAPI_DS_TUPLE.
Specifies the symbolic name of the OpenAPI data. It is used only when the data is copy file data, or a procedure parameter.
This data type describes the data in a copy file. It also describes how the file should be formatted.
This data type has the following syntax:
typedef struct _IIAPI_FDATADESCR
{
II_CHAR *fd_name;
II_INT2 fd_type;
II_INT2 fd_length;
II_INT2 fd_prec;
II_LONG fd_column;
II_LONG fd_funcID;
II_LONG fd_cvLen;
II_LONG fd_cvPrec;
II_BOOL fd_delimiter;
II_INT2 fd_delimLength;
II_CHAR *fd_delimValue;
II_BOOL fd_nullable;
II_BOOL fd_nullInfo;
IIAPI_DESCRIPTOR fd_nullDescr;
IIAPI_DATAVALUE fd_nullValue;
} IIAPI_FDATADESCR;
This data type has the following parameters:
Specifies the name of the column in the file.
Specifies the datatype of the column as stored in the file.
Specifies the length of the column as stored in the file.
Specifies the encoded precision and scale of the column as stored in the file.
Specifies the index in cp_dbmsDescr of the corresponding column in the table (see IIAPI_COPYMAP).
Specifies an Ingres Abstract Data Facility function ID used for conversion between the table column datatype and file datatype.
Specifies the length used during conversion.
Specifies the encoded precision and scale used during conversion.
Indicates whether a separator is used between columns. This parameter is TRUE if there is a separator between this and the next column; otherwise, it is FALSE.
Specifies the length of the separator between this and the next column. This parameter is valid only if fd_isDelimiter is TRUE.
Specifies the value of the separator between this and the next column. This parameter is valid only if fd_isDelimiter is TRUE.
Indicates whether a NULL value is allowed in the column. This parameter is TRUE if NULL is allowed; otherwise, it is FALSE.
Indicates whether a symbol representing a NULL value should be specified for this column. If so, this parameter is TRUE; otherwise, it is FALSE. This parameter is valid only if fd_nullable is TRUE.
Specifies the description of the NULL symbol. This parameter is valid if fd_nullable and fd_nullInfo are TRUE.
Specifies the value of the NULL symbol. This parameter is valid if fd_nullable and fd_nullInfo are TRUE.
The IIAPI_II_DIS_TRAN_ID data type specifies and names a distributed Ingres transaction.
This data type has the following syntax:
typedef struct _IIAPI_II_DIS_TRAN_ID
{
IIAPI_II_TRAN_ID ii_tranID;
II_CHAR ii_tranName[IIAPI_TRAN_MAXNAME];
} IIAPI_II_DIS_TRAN_ID;
This data type has the following parameters:
Specifies the unique transaction ID of the distributed transaction. This ID is an 8-byte ID stored in the IIAPI_II_TRAN_ID data type.
Specifies the unique transaction name of the Ingres transaction. It is a NULL-terminated string representing the transaction. The name must not be more than 63 bytes, leaving one byte for NULL.
The IIAPI_II_TRAN_ID data type specifies a local Ingres transaction ID.
This data type has the following syntax:
typedef struct _IIAPI_II_TRAN_ID
{
II_UINT4 it_highTran;
II_UINT4 it_lowTran;
} IIAPI_II_TRAN_ID;
This data type has the following parameters:
Specifies the high order bytes of the transaction ID.
Specifies the low order bytes of the transaction ID.
The IIAPI_SVR_ERRINFO data type contains additional server-specific information that was received along with an error, warning, or user message.
This data type has the following syntax:
typedef struct _IIAPI_SVR_ERRINFO
{
II_LONG svr_id_error;
II_LONG svr_local_error;
II_LONG svr_id_server;
II_LONG svr_server_type;
II_LONG svr_severity;
II_INT2 svr_parmCount;
II_API_DESCRIPTOR *svr_parmDescr;
II_API_DATAVALUE *svr_parmValue;
} IIAPI_SVR_ERRINFO;
This data type has the following parameters:
Specifies the generic error code or encoded SQLSTATE of the message.
Specifies the server specific error code.
Specifies the ID of the server.
Specifies the type of the server.
Specifies the message type. Valid values can be a combination of the following:
Specifies the number of message parameters.
Specifies the description of the message parameters. The memory for this parameter is managed by the OpenAPI.
Note: For more information, see How Memory is Managed for Data Input and Output.
Specifies the value of the message parameters. The memory for this parameter is managed by the OpenAPI.
Note: For more information, see How Memory is Managed for Data Input and Output.
The IIAPI_TRAN_ID data type specifies and names an OpenAPI transaction. OpenAPI supports Ingres transaction management. The union in this data type will increase as more transaction managers are supported.
This data type has the following syntax:
typedef struct _IIAPI_TRAN_ID
{
II_ULONG ti_type;
union
{
IIAPI_II_DIS_TRAN_ID iiXID;
IIAPI_XA_DIS_TRAN_ID xaXID;
} ti_value;
} IIAPI_TRAN_ID;
This data type has the following parameters:
Specifies the type of transaction being identified. The valid values are:
Specifies the unique ID of an Ingres transaction. This parameter is valid only if ti_type is IIAPI_TI_IIXID.
Specifies the unique ID of an XA transaction. This parameter is valid only if ti_type is IIAPI_TI_XAXID.
The IIAPI_XA_DIS_TRAN_ID datatype specifies a distributed XA transaction ID.
This data type has the following syntax:
typedef struct _IIAPI_XA_DIS_TRAN_ID
{
IIAPI_XA_TRAN_ID xa_tranID;
II_INT4 xa_branchSeqnum;
II_INT4 xa_branchFlag;
} IIAPI_XA_DIS_TRAN_ID;
This data type has the following parameters:
Specifies the unique transaction ID of an XA transaction.
Specifies the branch sequence number.
Specifies branch flags. A combination of one of the following flags:
The IIAPI_XA_TRAN_ID datatype specifies an XA transaction ID.
This data type has the following syntax:
typedef struct _IIAPI_XA_TRAN_ID
{
II_LONG xt_formatID;
II_LONG xt_gtridLength;
II_LONG xt_bqualLength;
II_CHAR xt_data[128];
} IIAPI_XA_TRAN_ID;
This data type has the following parameters:
Specifies the format ID set by TP monitor.
Specifies the length of gtrid value in xt_data (first data item).
Specifies the length of bqual value in xt_data (second data item).
Specifies the concatenated gtrid and bqual data values. Length is xt_gtridLength + xt_bqualLength.