|
Informix DataBlade API Programmer's Manual Using the DataBlade API
|
|
What Is the DataBlade API?
The DataBlade API contains the following pieces for the development of DataBlade API modules:
Header Files
Informix provides the following categories of header files for use in a DataBlade API module:
DataBlade API Header Files
The DataBlade API header files begin with the mi prefix. The DataBlade API provides the following header files for use in DataBlade API modules.
Header File
|
Description
|
mi.h
|
The main DataBlade API header file. It includes the DataBlade API public header files: milib.h, milo.h, miloback.h, mitrace.h, and miback.h.
|
milib.h
|
Defines function prototypes for the public entry points, and public declarations of required data structures and related macros.
The mi.h header file automatically includes milib.h.
|
mitypes.h
|
Defines all DataBlade API simple data types, their accessor macros, and their directly related value macros.
The mitypes.h header file automatically includes the ESQL/C header files: datetime.h, decimal.h, and int8.h. The milib.h header file automatically includes mitypes.h.
|
milo.h
|
Defines the data structures, values, and function prototypes for the smart-large-object interface (functions that have names starting with mi_lo_).
The mi.h file header automatically includes milo.h.
|
mitrace.h
|
Defines the data structures, values, and function prototypes for the DataBlade API trace facility.
The mi.h file header automatically includes mitrace.h.
|
miloback.h
|
Defines the data structures, values, and function prototypes for the Illustra large-object interface (functions that have names starting with mi_large) which are backward compatible with the Illustra applications.
The mi.h file header automatically includes miloback.h.
|
miconv.h
|
Contains convention definitions. Includes on/off switches based on architecture, compiler type, and so on. Other parts of the code use these switches to define data types correctly.
The mitypes.h header file automatically includes miconv.h.
|
miback.h
|
Contains definitions that provide backward compatibility with Illustra applications.
The mi.h file header automatically includes miback.h.
|
Tip: For a complete list of header files, check the incl/public subdirectory of the INFORMIXDIR directory.
The mi.h header file provides access to all DataBlade API header files in the preceding table. Include this header file in your DataBlade API module to obtain declarations of DataBlade API functions and data types.
ESQL/C Header Files
Informix provides the following header files to support some of the functions and data types of the Informix ESQL/C library.
Important: The mitypes.h header file automatically includes the datetime.h, decimal.h, and int8.h header files. In turn, the milib.h header file automatically includes mitypes.h, and mi.h automatically includes milib.h. Therefore, you automatically have access to the information in these ESQL/C header files when you include mi.h in your DataBlade API module.
For additional information about the use of these ESQL/C header files, see the following sections of this manual.
Informix GLS Header File
Informix provides a header file to support the Informix GLS library. If you use the Informix GLS library in your DataBlade API module, include its header file, ifxgls.h, in your source code. For more information on the Informix GLS library and how to use it in a DataBlade API module, see Internationalization of DataBlade API Modules.
Private Header Files
If you define any opaque data types, you must include their header file in your DataBlade API source code. An opaque-type header file usually contains the declaration of the internal format for the opaque data type. For more information, see Creating an Opaque Data Type.
Public Data Types
The DataBlade API provides support for the following public data types:
DataBlade API Data Types
To ensure portability across dissimilar machine architectures, the DataBlade API provides a set of simple data types, which Figure 1-1 shows. These data types begin with the mi_ prefix. Most of these data types correspond to common SQL or C-language data types.
Figure 1-1
DataBlade API, C, and SQL Data Types
DataBlade API Data Type
|
Standard C or ESQL/C Data Type
|
SQL Data Type
|
Character Data Types
|
mi_char
|
C: char
|
CHAR, VARCHAR,
GLS: NCHAR, NVARCHAR
|
mi_char1
|
C: char
|
CHAR(1)
|
mi_unsigned_char1
|
C: unsigned char
|
None
|
mi_wchar (deprecated)
|
C: unsigned 2-byte integer
|
None
|
mi_string
|
C: char *
|
CHAR, VARCHAR,
GLS: NCHAR, NVARCHAR
|
mi_lvarchar
|
ESQL/C: lvarchar (though lvarchar is null-terminated and mi_lvarchar is not)
|
LVARCHAR
Within C UDRs: for CHAR, NCHAR, TEXT, VARCHAR, and NVARCHAR arguments and return value
|
Numeric Data Types: Integer
|
mi_sint1
|
C: signed 1-byte integer
|
None
|
mi_int1
|
C: unsigned 1-byte integer, char
|
None
|
mi_smallint
|
C: signed 2-byte integer (short integer on many systems)
|
SMALLINT
|
mi_unsigned_smallint
|
C: unsigned 2-byte integer
|
None
|
mi_integer
|
C: signed 4-byte integer
(long integer on many systems)
|
INTEGER, SERIAL
|
mi_unsigned_integer
|
C: unsigned 4-byte integer
|
None
|
mi_int8
|
C: signed 8-byte integer; ESQL/C: int8, ifx_int8_t
|
INT8, SERIAL8
|
mi_unsigned_int8
|
C: unsigned 8-byte integer; ESQL/C: int8, ifx_int8_t
|
None
|
Numeric Data Types: Fixed-Point
|
mi_decimal, mi_numeric
|
ESQL/C: decimal, dec_t
|
DECIMAL(p,s) (fixed-point)
|
mi_money
|
ESQL/C: decimal, dec_t
|
MONEY
|
Numeric Data Types: Floating-Point
|
mi_decimal
|
ESQL/C: decimal, dec_t
|
DECIMAL(p) (floating-point)
|
mi_real
|
C: float
|
SMALLFLOAT, REAL
|
mi_double_precision
|
C: double
|
FLOAT, DOUBLE PRECISION
|
Date and Time Data Types
|
mi_date
|
C: 4-byte integer
ESQL/C: date
|
DATE
|
mi_datetime
|
ESQL/C: datetime, dtime_t
|
DATETIME
|
mi_interval
|
ESQL/C: interval, intrvl_t
|
INTERVAL
|
Varying-Length Data Types
|
mi_lvarchar
|
C: void *
ESQL/C: lvarchar (though lvarchar is null-terminated and mi_lvarchar is not)
|
LVARCHAR, Opaque types
Within C UDRs: for CHAR, NCHAR, TEXT, VARCHAR, and NVARCHAR arguments and return value
|
mi_sendrecv
|
C: void *
|
SENDRECV, opaque-type support functions: send, receive
|
mi_impexp
|
C: void *
|
IMPEXP, opaque-type support functions: import, export
|
mi_impexpbin
|
C: void *
|
IMPEXPBIN, opaque-type support functions: importbin, exportbin
|
mi_bitvarying
|
C: void *
|
None
|
Complex Types
|
MI_COLLECTION
|
C: void *
|
SET, LIST, MULTISET
|
MI_ROW
|
C: void *
|
ROW (unnamed row type), Named row type
|
Other Data Types
|
mi_boolean
|
C: char
ESQL/C: boolean
|
BOOLEAN
|
mi_pointer
|
C: void *
|
POINTER
|
Important: To make your DataBlade API module portable, Informix recommends that you use the DataBlade API platform-independent data types (such as mi_integer, mi_smallint, mi_real, mi_boolean, and mi_double_precision) instead of their C-language counterparts. These data types handle the different sizes of numeric values across machine architectures.
Figure 1-1 on page 1-11 lists the correspondences between DataBlade API data types and SQL data types. However, when you pass some of these data types to and from C user-defined routines, you must pass them as pointers rather than as actual values. For more information, see Passing Mechanism for MI_DATUM Values.
Figure 1-2 shows where you can find the description of how to use these DataBlade API data types to the corresponding SQL data types.
Figure 1-2
Information on SQL Data Types
Data Type
|
For More Information
|
BLOB
|
Chapter 6, Using Smart Large Objects
|
BOOLEAN
|
Boolean Data
|
BYTE
|
Simple Large Objects
|
CHAR
|
Text and String Support
|
CLOB
|
Chapter 6, Using Smart Large Objects
|
DATE
|
Chapter 4, Using Date and Time Data Types
|
DATETIME
|
Chapter 4, Using Date and Time Data Types
|
DECIMAL
|
Chapter 3, Using Numeric Data Types
|
Distinct
|
Chapter 14, Extending Data Types
|
FLOAT
|
Chapter 3, Using Numeric Data Types
|
INT8
|
Chapter 3, Using Numeric Data Types
|
INTEGER
|
Chapter 3, Using Numeric Data Types
|
INTERVAL
|
Chapter 4, Using Date and Time Data Types
|
LIST
|
Chapter 5, Using Complex Data Types
|
LVARCHAR
|
Varying-Length Data Structures
|
MONEY
|
Chapter 3, Using Numeric Data Types
|
MULTISET
|
Chapter 5, Using Complex Data Types
|
NCHAR
|
Text and String Support
|
NVARCHAR
|
Text and String Support
|
Opaque
|
Chapter 14, Extending Data Types
|
POINTER
|
POINTER Data Type
|
ROW
|
Chapter 5, Using Complex Data Types
|
SERIAL
|
Chapter 3, Using Numeric Data Types
|
SERIAL8
|
Chapter 3, Using Numeric Data Types
|
SET
|
Chapter 5, Using Complex Data Types
|
SMALLFLOAT
|
Chapter 3, Using Numeric Data Types
|
SMALLINT
|
Chapter 3, Using Numeric Data Types
|
TEXT
|
Simple Large Objects
|
VARCHAR
|
Text and String Support
|
DataBlade API Data Structures
Many DataBlade API functions provide information for DataBlade API modules in special data structures. These data types begin with the MI_ prefix. Figure 1-3 lists these data structures, their purpose, and the location in this manual where the data structure is described in more detail.
Figure 1-3
DataBlade API Data Structures
DataBlade API Data Structure
|
Purpose
|
Related Topics
|
MI_COLL_DESC
|
Collection descriptor, which describes the structure of a collection
|
Using a Collection Descriptor
|
MI_COLLECTION
|
Collection structure, which contains the elements of a collection
|
Using a Collection Structure
|
MI_CONNECTION
|
Connection descriptor, which contains the execution context for a connection
|
Establishing the Connection
|
MI_CONNECTION_INFO
|
Connection-information descriptor, which contains connection parameters for an open connection
|
Using Connection Parameters
|
MI_DATABASE_INFO
|
Database-information descriptor, which contains database parameters for an open connection
|
Using Database Parameters
|
MI_DATUM
|
Datum, which provides a transport mechanism for data types
|
MI_DATUM Data Type
|
MI_ERROR_DESC
|
Error descriptor, which describes an exception
|
Obtaining Event Information
|
MI_EVENT_TYPE
|
Classifies an event
|
What Is An Event?
|
MI_FPARAM
|
Function-parameter structure, which holds information about a user-defined routine that the routine can access during its execution
|
Accessing the Routine State with MI_FPARAM
|
MI_FUNC_DESC
|
Function descriptor, which describes a user-defined routine that is to be invoked with the Fastpath interface
|
Obtaining a Function Descriptor
|
MI_LO_FD
|
LO file descriptor, which describes an open smart large object
|
Obtaining an LO File Descriptor and the mi_large_object_open() function
|
MI_LO_HANDLE
|
LO handle, which identifies the location of a smart large object in its sbspace
|
Obtaining an LO Handle and the mi_large_object_create()function
|
MI_LO_SPEC
|
LO-specification structure, which contains storage characteristics for a smart large object
|
Obtaining the LO-Specification Structure and the mi_large_object_info() function
|
MI_LO_STAT
|
LO-status structure, which contains status information for a smart large object
|
Obtaining the Status of a Smart Large Object and the mi_large_object_stat() function
|
MI_MULTIREP_DATA
|
Holds multirepresentational data
|
Creating Multirepresentational Data
|
MI_PARAMETER_INFO
|
Parameter-information descriptor, which specified whether callbacks are enabled or disabled and whether pointers are checked in client LIBMI applications
|
Using Session Parameters
|
MI_ROW
|
Row (or row structure), which contains either the column values of a table row or field values of a row type
|
Retrieving Rows
Using a Row Structure
|
MI_ROW_DESC
|
Row descriptor, which describes the structure of a row
|
Obtaining Row Information
Using a Row Descriptor
|
MI_SAVE_SET
|
Save-set descriptor, which describes a save set
|
Creating a Save Set
|
MI_STATEMENT
|
Statement descriptor, which describes a prepared SQL statement
|
Executing Prepared SQL Statements
|
MI_TRANSITION_DESC
|
Error descriptor, which describes an exception
|
Obtaining Event Information
|
MI_TYPEID
|
Type identifier, which uniquely identifies a data type within a database
|
Type Identifiers
|
MI_TYPE_DESC
|
Type descriptor, which provides information about a data type
|
Type Descriptors
|
The DataBlade API also provides simple data types for use with SQL values. For a list of these data types, see Figure 1-1 on page 1-11.
The DataBlade API provides constructor and destructor functions for most of these public DataBlade API data structures. These functions handle memory allocation of these data structures, as follows:
Public Functions
The DataBlade API provides support for the following types of functions in a DataBlade API module.
DataBlade API Functions
The DataBlade API functions begin with the mi_ prefix. The milib.h header file declares most of these DataBlade API functions. The mi.h header file automatically includes milib.h. You must include mi.h in any DataBlade API module that uses a DataBlade API function.
The functions of the DataBlade API function library can be divided into the following categories.
For a complete list of DataBlade API functions in each of these categories, see The DataBlade API Function Library. Chapter 15, DataBlade API Function Descriptions, provides descriptions of all public functions, in alphabetical order.
If an error occurs while one of the DataBlade API function executes, the function usually indicates the error with one of the following return values.
Informix ESQL/C Functions
In a DataBlade API module, you can use some of the functions in the Informix ESQL/C library functions to perform conversions and operations on different data types. The ESQL/C functions do not begin with the mi_ prefix. Various header files declare these functions. For more information, see ESQL/C Header Files.
The functions of the ESQL/C function library that are valid in a DataBlade API module can be divided into the following categories.
For a complete list of ESQL/C functions in each of these categories, see The ESQL/C Function Library. Chapter 15, DataBlade API Function Descriptions, provides descriptions of these public functions, in alphabetical order.
Informix GLS Functions
The Informix GLS library is an application-programming interface (API) that lets developers of DataBlade API modules create internationalized applications. The macros and functions of Informix GLS provide access to the GLS locales, which contain culture-specific information.
The Informix GLS library contains functions that provide the following capabilities:
The mi.h header file does not automatically include the Informix GLS library. For more information on the Informix GLS library and how to use it in a DataBlade API module, see Internationalization of DataBlade API Modules.
Informix DataBlade API Programmer's Manual, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved