Redrock Postgres Search Chinese
Version: 9.3 / 9.4 / 9.5 / 9.6 / 10 / 11 / 12 / 13 / 14 / 15 / 16

Chapter 33. ECPG - Embedded SQL in C

Table of Contents
33.1. The Concept
33.2. Managing Database Connections
33.2.1. Connecting to the Database Server
33.2.2. Choosing a Connection
33.2.3. Closing a Connection
33.3. Running SQL Commands
33.3.1. Executing SQL Statements
33.3.2. Using Cursors
33.3.3. Managing Transactions
33.3.4. Prepared Statements
33.4. Using Host Variables
33.4.1. Overview
33.4.2. Declare Sections
33.4.3. Retrieving Query Results
33.4.4. Type Mapping
33.4.5. Handling Nonprimitive SQL Data Types
33.4.6. Indicators
33.5. Dynamic SQL
33.5.1. Executing Statements without a Result Set
33.5.2. Executing a Statement with Input Parameters
33.5.3. Executing a Statement with a Result Set
33.6. pgtypes Library
33.6.1. The numeric Type
33.6.2. The date Type
33.6.3. The timestamp Type
33.6.4. The interval Type
33.6.5. The decimal Type
33.6.6. errno Values of pgtypeslib
33.6.7. Special Constants of pgtypeslib
33.7. Using Descriptor Areas
33.7.1. Named SQL Descriptor Areas
33.7.2. SQLDA Descriptor Areas
33.8. Error Handling
33.8.1. Setting Callbacks
33.8.2. sqlca
33.8.3. SQLSTATE vs. SQLCODE
33.9. Preprocessor Directives
33.9.1. Including Files
33.9.2. The define and undef Directives
33.9.3. ifdef, ifndef, else, elif, and endif Directives
33.10. Processing Embedded SQL Programs
33.11. Library Functions
33.12. Large Objects
33.13. C++ Applications
33.13.1. Scope for Host Variables
33.13.2. C++ Application Development with External C Module
33.14. Embedded SQL Commands
ALLOCATE DESCRIPTOR -- allocate an SQL descriptor area
CONNECT -- establish a database connection
DEALLOCATE DESCRIPTOR -- deallocate an SQL descriptor area
DECLARE -- define a cursor
DESCRIBE -- obtain information about a prepared statement or result set
DISCONNECT -- terminate a database connection
EXECUTE IMMEDIATE -- dynamically prepare and execute a statement
GET DESCRIPTOR -- get information from an SQL descriptor area
OPEN -- open a dynamic cursor
PREPARE -- prepare a statement for execution
SET AUTOCOMMIT -- set the autocommit behavior of the current session
SET CONNECTION -- select a database connection
SET DESCRIPTOR -- set information in an SQL descriptor area
TYPE -- define a new data type
VAR -- define a variable
WHENEVER -- specify the action to be taken when an SQL statement causes a specific class condition to be raised
33.15. Informix Compatibility Mode
33.15.1. Additional Types
33.15.2. Additional/Missing Embedded SQL Statements
33.15.3. Informix-compatible SQLDA Descriptor Areas
33.15.4. Additional Functions
33.15.5. Additional Constants
33.16. Internals

This chapter describes the embedded SQL package for PostgreSQL. It was written by Linus Tolke () and Michael Meskes (). Originally it was written to work with C. It also works with C++, but it does not recognize all C++ constructs yet.

This documentation is quite incomplete. But since this interface is standardized, additional information can be found in many resources about SQL.