/* * compiles using informix esql 9.2.1 compiler but does not compile * using ecpg 3.1.0(PostgreSQL 7.4.1) */ int main (int argc, char **argv) { /* Declare host variables */ EXEC SQL BEGIN DECLARE SECTION; char _ix_database_name[30]; int exception_count; char _message[100]; EXEC SQL END DECLARE SECTION; /* Connect to the database. */ EXEC SQL CONNECT TO 'test_db'; EXEC SQL get diagnostics :exception_count = NUMBER ; /* * The GET DIAGNOSTICS statement also returns information about the * exceptions that the most-recently executed SQL statement has generated. */ EXEC SQL get diagnostics exception 1 :_message = MESSAGE_TEXT; return (0); }