OpenAPI User Guide
1. Introduction
Audience
Your Support Options
What Is OpenAPI?
Common Features of Application Programming Interfaces
Differences Between OpenAPI and Other Application Programming Interfaces
OpenAPI Communication
Relationship of OpenAPI to Basic Ingres Architecture
How OpenAPI Handles Backward Compatibility
OpenAPI Concepts and Processes
Parameter Blocks
How Callback and Closure Work
How Asynchronous Processing Works
How Synchronous Processing Works
Handles
Types of Handles
How Connections are Established and Severed
Transactions
How Transactions Work
How an Application Begins a Transaction
How an Application Ends a Transaction
How Distributed Transactions Are Used
How Savepoints Are Used
How XA Transactions Are Used
How Query Statements Work
Typical Flow of Operations for SQL and Name Server Query Statement Processing
Order of Invoking OpenAPI Functions
How Query Statements Are Canceled
How Data Is Retrieved
How Cursors Work
Scrollable Cursors
Order of Function Calls Used to Manipulate Data with a Cursor
Batch Statement Execution
How You Can Maximize Performance
How Batch Statements without Parameters Are Executed
How Batch Statements with Parameters Are Executed
How Batch Statements with Multiple Parameter Sets Are Repeated
Database Events
Order in which OpenAPI Creates, Retrieves, and Deletes Database Events
How Database Events Are Processed
SQL Syntax
Name Server Query Statement Syntax
Query Parameters
How Unformatted Data is Handled
LOB Locators
Data Conversion
Error Handling
How Status Checking Works
2. OpenAPI Function Reference
Generic Parameters
Output Parameters Allocated by OpenAPI
Function Summary
OpenAPI Management
Session Management
Query Processing
Transaction Operations
Miscellaneous
OpenAPI Functions
IIapi_abort() Function--Abort a Connection
IIapi_autocommit() Function--Enable or Disable Autocommit Transactions
IIapi_batch() Function--Execute Batch Statements
IIapi_cancel() Function--Cancel an Outstanding Query Statement
IIapi_catchEvent() Function--Retrieve a Database Event
IIapi_close() Function--End a Query Statement or Database Event Retrieval
IIapi_commit() Function--Commit a Transaction
IIapi_connect() Function--Connect to a DBMS Server or Name Server
IIapi_convertData() Function--Convert Ingres Data Values to Compatible Types Using Default Settings
IIapi_disconnect() Function--Close a Server Connection
IIapi_formatData() Function--Convert Ingres Data Values to Compatible Types
IIapi_getColumns() Function--Return Columns from a Previously Invoked Query Statement or Database Event Retrieval
IIapi_getColumnInfo() Function--Return Additional Information about Columns
IIapi_getCopyMap() Function--Return the Data Format of Copy File and Database Table Involved in a Copy Statement
IIapi_getDescriptor() Function--Communicate Format of Return Data with IIapi_getColumns()
IIapi_getErrorInfo() Function--Return Additional Error or User-defined Information
IIapi_getEvent() Function--Wait for Database Events
IIapi_getQueryInfo() Function--Return Information about a Query
IIapi_initialize() Function--Initialize OpenAPI to a Specified Input Version
IIapi_modifyConnect Function--Send Connection Parameters to Server
IIapi_position() Function--Position Cursor and Initiate Row Retrieval
IIapi_prepareCommit() Function--Begin Two-phase Commit of Transaction
IIapi_putColumns() Function--Send Data to Server to Copy Data from File to Database Table
IIapi_putParms() Function--Send Query Statement Parameter Values to a Server
IIapi_query() Function--Begin Query Statement and Allocate Statement Handle
IIapi_registerXID() Function--Reserve Unique ID for Two-phase Commit Transaction
IIapi_releaseEnv() Function--Release Resources Associated with Environment Handle
IIapi_releaseXID() Function--Release Unique ID for Two-phase Commit Transaction
IIapi_rollback() Function--Roll Back a Transaction
IIapi_savePoint() Function--Mark Savepoint in a Transaction for Partial Rollback
IIapi_scroll() Function--Scroll (Position) Cursor and Initiate Row Retrieval
IIapi_setConnectParam() Function--Assign Connection Parameter and Value to a Connection
IIapi_setDescriptor() Function--Send Information About Data Format
IIapi_setEnvParam() Function--Assign an Environment Parameter and Value in Environment Handle
Environment Parameter IIAPI_EP_CAN_PROMPT
Environment Parameter IIAPI_EP_TRACE_FUNC
Environment Parameter IIAPI_EP_EVENT_FUNC
IIapi_terminate() Function--Terminate OpenAPI
IIapi_wait() Function--Block Application Control Until Outstanding Operation Completes or User-defined Timeout Expires
IIapi_xaCommit() Function--Commit an XA Transaction
IIapi_xaEnd() Function--End an XA Transaction Association
IIapi_xaPrepare() Function--Prepare an XA transaction for Two-Phase Commit
IIapi_xaRollback() Function--Rollback an XA Transaction
IIapi_xaStart() Function--Start an XA Transaction
3. OpenAPI Data Types
OpenAPI Generic Data Types
OpenAPI Data Types
IIAPI_DT_ID Data Type--Describe Data Type of Database Columns and Query Parameters
IIAPI_QUERYTYPE Data Type--Describe Type of Query Being Invoked
IIAPI_STATUS Data Type--Describe the Return Status of an OpenAPI Function
OpenAPI Data Structures
IIAPI_COPYMAP Data Type--Provide Information on How to Execute the SQL Copy Statement
IIAPI_DATAVALUE Data Type--Provide Value for OpenAPI Data
IIAPI_DESCRIPTOR Data Type--Provide Description for OpenAPI Data
IIAPI_FDATADESCR Data Type--Describe Column Data in a Copy File
IIAPI_II_DIS_TRAN_ID Data Type--Identify Distributed Ingres Transaction ID
IIAPI_II_TRAN_ID Data Type--Identify Local Ingres Transaction ID
IIAPI_SVR_ERRINFO Data Type--Describe Additional Server Information Associated with Error Messages
IIAPI_TRAN_ID Data Type--Identify an OpenAPI Transaction
IIAPI_XA_DIS_TRAN_ID Data Type--Identify a Distributed XA Transaction ID
IIAPI_XA_TRAN_ID Data Type--Identify an XA Transaction ID
4. Accessing a DBMS Using SQL
Mapping of SQL to OpenAPI
SQL Syntax
Prepare Statement
Describe Statement
Execute Statement
Declare Statement, Open Cursor Statement
Cursor Delete Statement
Cursor Update Statement
Execute Procedure
Repeat Queries
Queries, Parameters, and Query Data Correlation
Queries and Parameters
Query Data Correlation
5. Accessing the Name Server
Mapping of Name Server Query Statements to OpenAPI
Name Server Query Statement Syntax
Name Server Query Syntax
Create Login Statement--Create a Login Definition
Examples: Create login statement
Destroy Login Statement--Destroy a Login Definition
Examples: Destroy login statement
Create Password Statement--Define an Installation Password
Example: Create password statement
Create Connection Statements--Create a Connection Data Definition
Example: Create connection statement
Destroy Connection Statement--Destroy a Data Definition
Examples: Destroy connection statement
Show Connection Statement--Display Connection Data Definitions
Example: Show connection statement
Create Attribute Statement--Create an Attribute Data Definition
Example: Create attribute statement
Destroy Attribute Statement--Destroy an Attribute Data Definition
Examples: Destroy attribute statement
Display Attribute Statement--Display an Attribute Data Definition
Examples: Display attribute statement
Show Server Statement--Display Servers in the Local Installation
Examples: Show server statement
How to Use ~V Marker in the Name Server Query Text
Example: Using the ~V marker in name server query text
6. Creating an Application with OpenAPI
How You Can Create an OpenAPI Application
Header Files
Library
Environment Variables
II_API_TRACE
II_API_LOG
II_API_SET
Sample Code
How the Synchronous Sample Code Works
main() Function
Error Checking
How You Can Run a Program
Source File Descriptions
How the Asynchronous Sample Code Works
How the Client Execution Unit Works
How the Server Execution Unit Works
How You Can Run the Demo Program
Source File Descriptions
7. Using Repeat Queries with OpenAPI
Repeat Queries
How the Repeat Query Protocol Works
Repeat Query ID
Compile-time and Runtime IDs
Query Parameters
How the ~V Mechanism Works
Repeat Query Parameters
Example: Repeat query using the $n = ~V marker
A. Error Handling
Error Codes
SQLSTATE Values and Descriptions
XA Error Codes
B. Data Types
Ingres Data Types
Data Type Descriptions
Ingres 10.2
Data Type Descriptions