Make some ecpg test cases more robust against unexpected errors that happen

during development. Test cases themselves should not hang or segfault.
This commit is contained in:
Michael Meskes 2019-01-30 10:36:53 +01:00
parent 5c04630ad0
commit e2f731cdba
21 changed files with 410 additions and 489 deletions

View File

@ -56,7 +56,6 @@ int main(void)
{
$fetch forward c into :i, :j, :c;
if (sqlca.sqlcode == 100) break;
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
if (risnull(CDECIMALTYPE, (char *)&j))
printf("%d NULL\n", i);

View File

@ -41,8 +41,6 @@ static void sql_check(const char *fn, const char *caller, int ignore)
}
}
int main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
@ -55,7 +53,7 @@ int main(void)
interval *intvl;
EXEC SQL whenever sqlerror sqlprint;
EXEC SQL whenever sqlerror stop;
ECPGdebug(1, stderr);

View File

@ -16,7 +16,7 @@ static void warn(void)
int main() {
EXEC SQL WHENEVER SQLWARNING do warn();
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL WHENEVER SQLERROR STOP;
const char *ppppp = "XXXXX";
int loopcount;

View File

@ -171,7 +171,6 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 57 "test_informix.pgc"
if (sqlca.sqlcode == 100) break;
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
if (risnull(CDECIMALTYPE, (char *)&j))
printf("%d NULL\n", i);
@ -190,53 +189,53 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "delete from test where i = $1 :: decimal",
ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 75 "test_informix.pgc"
#line 74 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 75 "test_informix.pgc"
#line 74 "test_informix.pgc"
printf("DELETE: %ld\n", sqlca.sqlcode);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 14", ECPGt_EOIT, ECPGt_EORT);
#line 78 "test_informix.pgc"
#line 77 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 78 "test_informix.pgc"
#line 77 "test_informix.pgc"
printf("Exists: %ld\n", sqlca.sqlcode);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 147", ECPGt_EOIT, ECPGt_EORT);
#line 81 "test_informix.pgc"
#line 80 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 81 "test_informix.pgc"
#line 80 "test_informix.pgc"
printf("Does not exist: %ld\n", sqlca.sqlcode);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 84 "test_informix.pgc"
#line 83 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 84 "test_informix.pgc"
#line 83 "test_informix.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
#line 85 "test_informix.pgc"
#line 84 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 85 "test_informix.pgc"
#line 84 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
#line 86 "test_informix.pgc"
#line 85 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 86 "test_informix.pgc"
#line 85 "test_informix.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 88 "test_informix.pgc"
#line 87 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 88 "test_informix.pgc"
#line 87 "test_informix.pgc"
return 0;
@ -247,9 +246,9 @@ static void openit(void)
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare c cursor for select * from test where i <= $1 ",
ECPGt_int,&(*( int *)(ECPGget_var( 0))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 95 "test_informix.pgc"
#line 94 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 95 "test_informix.pgc"
#line 94 "test_informix.pgc"
}

View File

@ -55,13 +55,13 @@ DETAIL: Key (i)=(7) already exists.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 44: correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 95: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 94: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 95: using PQexecParams
[NO_PID]: ecpg_execute on line 94: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 95: parameter 1 = 14
[NO_PID]: ecpg_free_params on line 94: parameter 1 = 14
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 95: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 94: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 57: query: fetch forward c; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
@ -95,39 +95,39 @@ DETAIL: Key (i)=(7) already exists.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 57: no data found on line 57
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 75: query: delete from test where i = $1 :: decimal; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 74: query: delete from test where i = $1 :: decimal; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 75: using PQexecParams
[NO_PID]: ecpg_execute on line 74: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 75: parameter 1 = 21.0
[NO_PID]: ecpg_free_params on line 74: parameter 1 = 21.0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 75: OK: DELETE 0
[NO_PID]: ecpg_process_output on line 74: OK: DELETE 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 75: no data found on line 75
[NO_PID]: raising sqlcode 100 on line 74: no data found on line 74
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 78: query: select 1 from test where i = 14; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 77: query: select 1 from test where i = 14; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 78: using PQexec
[NO_PID]: ecpg_execute on line 77: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 78: correctly got 1 tuples with 1 fields
[NO_PID]: ecpg_process_output on line 77: correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: query: select 1 from test where i = 147; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 80: query: select 1 from test where i = 147; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: using PQexec
[NO_PID]: ecpg_execute on line 80: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 81: correctly got 0 tuples with 1 fields
[NO_PID]: ecpg_process_output on line 80: correctly got 0 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 81: no data found on line 81
[NO_PID]: raising sqlcode 100 on line 80: no data found on line 80
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGtrans on line 84: action "commit"; connection "ecpg1_regression"
[NO_PID]: ECPGtrans on line 83: action "commit"; connection "ecpg1_regression"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 85: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 84: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 85: using PQexec
[NO_PID]: ecpg_execute on line 84: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 85: OK: DROP TABLE
[NO_PID]: ecpg_process_output on line 84: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 86: action "commit"; connection "ecpg1_regression"
[NO_PID]: ECPGtrans on line 85: action "commit"; connection "ecpg1_regression"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection ecpg1_regression closed
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -133,8 +133,6 @@ static void sql_check(const char *fn, const char *caller, int ignore)
}
}
int main(void)
{
/* exec sql begin declare section */
@ -144,71 +142,71 @@ int main(void)
#line 49 "test_informix2.pgc"
#line 47 "test_informix2.pgc"
int c ;
#line 50 "test_informix2.pgc"
#line 48 "test_informix2.pgc"
timestamp d ;
#line 51 "test_informix2.pgc"
#line 49 "test_informix2.pgc"
timestamp e ;
#line 52 "test_informix2.pgc"
#line 50 "test_informix2.pgc"
timestamp maxd ;
#line 53 "test_informix2.pgc"
#line 51 "test_informix2.pgc"
char dbname [ 30 ] ;
/* exec sql end declare section */
#line 54 "test_informix2.pgc"
#line 52 "test_informix2.pgc"
interval *intvl;
/* exec sql whenever sqlerror sqlprint ; */
#line 58 "test_informix2.pgc"
/* exec sql whenever sqlerror stop ; */
#line 56 "test_informix2.pgc"
ECPGdebug(1, stderr);
strcpy(dbname, "ecpg1_regression");
{ ECPGconnect(__LINE__, 1, dbname , NULL, NULL , NULL, 0);
#line 63 "test_informix2.pgc"
#line 61 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 63 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 61 "test_informix2.pgc"
sql_check("main", "connect", 0);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set DateStyle to 'DMY'", ECPGt_EOIT, ECPGt_EORT);
#line 66 "test_informix2.pgc"
#line 64 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 66 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 64 "test_informix2.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) )", ECPGt_EOIT, ECPGt_EORT);
#line 68 "test_informix2.pgc"
#line 66 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 68 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 66 "test_informix2.pgc"
sql_check("main", "create", 0);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' )", ECPGt_EOIT, ECPGt_EORT);
#line 73 "test_informix2.pgc"
#line 71 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 73 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 71 "test_informix2.pgc"
sql_check("main", "insert", 0);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select max ( timestamp ) from history", ECPGt_EOIT,
ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 78 "test_informix2.pgc"
#line 76 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 78 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 76 "test_informix2.pgc"
sql_check("main", "select max", 100);
@ -219,10 +217,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_timestamp,&(d),(long)1,(long)1,sizeof(timestamp),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 85 "test_informix2.pgc"
#line 83 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 85 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 83 "test_informix2.pgc"
sql_check("main", "select", 0);
@ -238,40 +236,40 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_timestamp,&(e),(long)1,(long)1,sizeof(timestamp),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 97 "test_informix2.pgc"
#line 95 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 97 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 95 "test_informix2.pgc"
sql_check("main", "update", 0);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 100 "test_informix2.pgc"
#line 98 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 100 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 98 "test_informix2.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table history", ECPGt_EOIT, ECPGt_EORT);
#line 102 "test_informix2.pgc"
#line 100 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 102 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 100 "test_informix2.pgc"
sql_check("main", "drop", 0);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 105 "test_informix2.pgc"
#line 103 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 105 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 103 "test_informix2.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 107 "test_informix2.pgc"
#line 105 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 107 "test_informix2.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 105 "test_informix2.pgc"
sql_check("main", "disconnect", 0);

View File

@ -2,63 +2,63 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 66: query: set DateStyle to 'DMY'; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 64: query: set DateStyle to 'DMY'; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 64: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 64: OK: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 66: query: create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 66: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 66: OK: SET
[NO_PID]: ecpg_process_output on line 66: OK: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 68: query: create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 69: query: insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 68: using PQexec
[NO_PID]: ecpg_execute on line 69: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 68: OK: CREATE TABLE
[NO_PID]: ecpg_process_output on line 69: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 71: query: insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 74: query: select max ( timestamp ) from history; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 71: using PQexec
[NO_PID]: ecpg_execute on line 74: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 71: OK: INSERT 0 1
[NO_PID]: ecpg_process_output on line 74: correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 76: query: select max ( timestamp ) from history; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_get_data on line 74: RESULT: Wed 07 May 13:28:34 2003 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 76: using PQexec
[NO_PID]: ecpg_execute on line 79: query: select customerid , timestamp from history where timestamp = $1 limit 1; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 76: correctly got 1 tuples with 1 fields
[NO_PID]: ecpg_execute on line 79: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 76: RESULT: Wed 07 May 13:28:34 2003 offset: -1; array: no
[NO_PID]: ecpg_free_params on line 79: parameter 1 = 2003-05-07 13:28:34
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: query: select customerid , timestamp from history where timestamp = $1 limit 1; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_process_output on line 79: correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: using PQexecParams
[NO_PID]: ecpg_get_data on line 79: RESULT: 1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 81: parameter 1 = 2003-05-07 13:28:34
[NO_PID]: ecpg_get_data on line 79: RESULT: Wed 07 May 13:28:34 2003 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 81: correctly got 1 tuples with 2 fields
[NO_PID]: ecpg_execute on line 93: query: insert into history ( customerid , timestamp , action_taken , narrative ) values ( $1 , $2 , 'test' , 'test' ); with 2 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 81: RESULT: 1 offset: -1; array: no
[NO_PID]: ecpg_execute on line 93: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 81: RESULT: Wed 07 May 13:28:34 2003 offset: -1; array: no
[NO_PID]: ecpg_free_params on line 93: parameter 1 = 2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 95: query: insert into history ( customerid , timestamp , action_taken , narrative ) values ( $1 , $2 , 'test' , 'test' ); with 2 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_free_params on line 93: parameter 2 = 2003-05-08 15:53:39
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 95: using PQexecParams
[NO_PID]: ecpg_process_output on line 93: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 95: parameter 1 = 2
[NO_PID]: ECPGtrans on line 98: action "commit"; connection "ecpg1_regression"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 95: parameter 2 = 2003-05-08 15:53:39
[NO_PID]: ecpg_execute on line 100: query: drop table history; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 95: OK: INSERT 0 1
[NO_PID]: ecpg_execute on line 100: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 100: action "commit"; connection "ecpg1_regression"
[NO_PID]: ecpg_process_output on line 100: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 102: query: drop table history; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 102: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 102: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 105: action "commit"; connection "ecpg1_regression"
[NO_PID]: ECPGtrans on line 103: action "commit"; connection "ecpg1_regression"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection ecpg1_regression closed
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -36,7 +36,7 @@ int main() {
/* exec sql whenever sql_warning do warn ( ) ; */
#line 18 "char_array.pgc"
/* exec sql whenever sqlerror sqlprint ; */
/* exec sql whenever sqlerror stop ; */
#line 19 "char_array.pgc"
@ -70,7 +70,7 @@ int main() {
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 31 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 31 "char_array.pgc"
@ -80,7 +80,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 33 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 33 "char_array.pgc"
{ ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( '' )", ECPGt_EOIT, ECPGt_EORT);
@ -89,7 +89,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 34 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 34 "char_array.pgc"
{ ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'AB' )", ECPGt_EOIT, ECPGt_EORT);
@ -98,7 +98,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 35 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 35 "char_array.pgc"
{ ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCD' )", ECPGt_EOIT, ECPGt_EORT);
@ -107,7 +107,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 36 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 36 "char_array.pgc"
{ ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDE' )", ECPGt_EOIT, ECPGt_EORT);
@ -116,7 +116,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 37 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 37 "char_array.pgc"
{ ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDEF' )", ECPGt_EOIT, ECPGt_EORT);
@ -125,7 +125,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 38 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 38 "char_array.pgc"
{ ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDEFGHIJ' )", ECPGt_EOIT, ECPGt_EORT);
@ -134,7 +134,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 39 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 39 "char_array.pgc"
@ -147,7 +147,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 42 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 42 "char_array.pgc"
@ -172,7 +172,7 @@ if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 50 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 50 "char_array.pgc"
printf("\"%s\": \"%s\" %d\n", bigstr, shortstr, shstr_ind);
@ -184,7 +184,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 54 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 54 "char_array.pgc"
{ ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "drop table strdbase", ECPGt_EOIT, ECPGt_EORT);
@ -193,7 +193,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 55 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 55 "char_array.pgc"
@ -205,7 +205,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 59 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 59 "char_array.pgc"
@ -215,7 +215,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 61 "char_array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 61 "char_array.pgc"

View File

@ -219,9 +219,6 @@ open_cur1(void)
if (sqlca.sqlcode < 0) exit (1);}
#line 40 "outofscope.pgc"
if (sqlca.sqlcode != 0)
exit(1);
}
static void
@ -238,28 +235,22 @@ get_record1(void)
ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof( struct mynulltype ),
ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,sizeof( struct mytype ),
ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_EORT);
#line 49 "outofscope.pgc"
#line 46 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 49 "outofscope.pgc"
#line 46 "outofscope.pgc"
if (sqlca.sqlcode != 0 && sqlca.sqlcode != ECPG_NOT_FOUND)
exit(1);
}
static void
close_cur1(void)
{
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur", ECPGt_EOIT, ECPGt_EORT);
#line 58 "outofscope.pgc"
#line 52 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 58 "outofscope.pgc"
#line 52 "outofscope.pgc"
if (sqlca.sqlcode != 0)
exit(1);
}
int
@ -274,54 +265,54 @@ main (void)
strcpy(msg, "connect");
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
#line 75 "outofscope.pgc"
#line 66 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 75 "outofscope.pgc"
#line 66 "outofscope.pgc"
strcpy(msg, "set");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
#line 78 "outofscope.pgc"
#line 69 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 78 "outofscope.pgc"
#line 69 "outofscope.pgc"
strcpy(msg, "create");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);
#line 81 "outofscope.pgc"
#line 72 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 81 "outofscope.pgc"
#line 72 "outofscope.pgc"
strcpy(msg, "insert");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
#line 84 "outofscope.pgc"
#line 75 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 84 "outofscope.pgc"
#line 75 "outofscope.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null )", ECPGt_EOIT, ECPGt_EORT);
#line 85 "outofscope.pgc"
#line 76 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 85 "outofscope.pgc"
#line 76 "outofscope.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' )", ECPGt_EOIT, ECPGt_EORT);
#line 86 "outofscope.pgc"
#line 77 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 86 "outofscope.pgc"
#line 77 "outofscope.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 89 "outofscope.pgc"
#line 80 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 89 "outofscope.pgc"
#line 80 "outofscope.pgc"
/* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE */
@ -329,10 +320,6 @@ if (sqlca.sqlcode < 0) exit (1);}
get_var1(&myvar, &mynullvar);
open_cur1();
/* exec sql whenever not found break ; */
#line 96 "outofscope.pgc"
for (loopcount = 0; loopcount < 100; loopcount++)
{
memset(myvar, 0, sizeof(MYTYPE));
@ -354,26 +341,26 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy(msg, "drop");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);
#line 118 "outofscope.pgc"
#line 107 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 118 "outofscope.pgc"
#line 107 "outofscope.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 121 "outofscope.pgc"
#line 110 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 121 "outofscope.pgc"
#line 110 "outofscope.pgc"
strcpy(msg, "disconnect");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 124 "outofscope.pgc"
#line 113 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 124 "outofscope.pgc"
#line 113 "outofscope.pgc"
return 0;

View File

@ -2,37 +2,37 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 78: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 69: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 78: using PQexec
[NO_PID]: ecpg_execute on line 69: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 78: OK: SET
[NO_PID]: ecpg_process_output on line 69: OK: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: query: create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 72: query: create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: using PQexec
[NO_PID]: ecpg_execute on line 72: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 81: OK: CREATE TABLE
[NO_PID]: ecpg_process_output on line 72: OK: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 84: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 75: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 84: using PQexec
[NO_PID]: ecpg_execute on line 75: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 84: OK: INSERT 0 1
[NO_PID]: ecpg_process_output on line 75: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 85: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 76: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 85: using PQexec
[NO_PID]: ecpg_execute on line 76: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 85: OK: INSERT 0 1
[NO_PID]: ecpg_process_output on line 76: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 86: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 77: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 86: using PQexec
[NO_PID]: ecpg_execute on line 77: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 86: OK: INSERT 0 1
[NO_PID]: ecpg_process_output on line 77: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 89: action "commit"; connection "ecpg1_regression"
[NO_PID]: ECPGtrans on line 80: action "commit"; connection "ecpg1_regression"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 40: query: declare mycur cursor for select * from a1; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
@ -40,75 +40,75 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 40: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: using PQexec
[NO_PID]: ecpg_execute on line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 49: correctly got 1 tuples with 5 fields
[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: 1 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: 1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: a offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: a offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: 1.0 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: 1.0 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: 2 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: 2 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: a offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: a offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: using PQexec
[NO_PID]: ecpg_execute on line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 49: correctly got 1 tuples with 5 fields
[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: 2 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: 2 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: using PQexec
[NO_PID]: ecpg_execute on line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 49: correctly got 1 tuples with 5 fields
[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: 3 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: 3 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: b offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: b offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: 2.0 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: 2.0 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: 3 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: 3 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 49: RESULT: b offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: b offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 49: using PQexec
[NO_PID]: ecpg_execute on line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 49: correctly got 0 tuples with 5 fields
[NO_PID]: ecpg_process_output on line 46: correctly got 0 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 49: no data found on line 49
[NO_PID]: raising sqlcode 100 on line 46: no data found on line 46
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 58: query: close mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 52: query: close mycur; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 58: using PQexec
[NO_PID]: ecpg_execute on line 52: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 58: OK: CLOSE CURSOR
[NO_PID]: ecpg_process_output on line 52: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 118: query: drop table a1; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 107: query: drop table a1; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 118: using PQexec
[NO_PID]: ecpg_execute on line 107: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 118: OK: DROP TABLE
[NO_PID]: ecpg_process_output on line 107: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 121: action "commit"; connection "ecpg1_regression"
[NO_PID]: ECPGtrans on line 110: action "commit"; connection "ecpg1_regression"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection ecpg1_regression closed
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -20,7 +20,7 @@
#line 3 "whenever_do_continue.pgc"
/* exec sql whenever sqlerror sqlprint ; */
/* exec sql whenever sqlerror stop ; */
#line 5 "whenever_do_continue.pgc"
@ -63,7 +63,7 @@ int main(void)
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
#line 23 "whenever_do_continue.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 23 "whenever_do_continue.pgc"
@ -71,7 +71,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table emp ( ename varchar , sal double precision , comm double precision )", ECPGt_EOIT, ECPGt_EORT);
#line 26 "whenever_do_continue.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 26 "whenever_do_continue.pgc"
@ -79,25 +79,25 @@ if (sqlca.sqlcode < 0) sqlprint();}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'Ram' , 111100 , 21 )", ECPGt_EOIT, ECPGt_EORT);
#line 29 "whenever_do_continue.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 29 "whenever_do_continue.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'aryan' , 11110 , null )", ECPGt_EOIT, ECPGt_EORT);
#line 30 "whenever_do_continue.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 30 "whenever_do_continue.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'josh' , 10000 , 10 )", ECPGt_EOIT, ECPGt_EORT);
#line 31 "whenever_do_continue.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 31 "whenever_do_continue.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'tom' , 20000 , null )", ECPGt_EOIT, ECPGt_EORT);
#line 32 "whenever_do_continue.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 32 "whenever_do_continue.pgc"
@ -108,7 +108,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c cursor for select ename , sal , comm from emp order by ename collate \"C\" asc", ECPGt_EOIT, ECPGt_EORT);
#line 36 "whenever_do_continue.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 36 "whenever_do_continue.pgc"

View File

@ -45,6 +45,10 @@ struct TBempl {
#line 14 "binary.pgc"
/* exec sql whenever sqlerror stop ; */
#line 16 "binary.pgc"
int
main (void)
{
@ -53,68 +57,59 @@ main (void)
#line 20 "binary.pgc"
#line 22 "binary.pgc"
struct TBempl empl ;
#line 21 "binary.pgc"
#line 23 "binary.pgc"
char * pointer = NULL ;
#line 22 "binary.pgc"
#line 24 "binary.pgc"
char * data = "\\001\\155\\000\\212" ;
/* exec sql end declare section */
#line 23 "binary.pgc"
#line 25 "binary.pgc"
int i;
ECPGdebug (1, stderr);
empl.idnum = 1;
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
#line 29 "binary.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
#line 31 "binary.pgc"
if (sqlca.sqlcode)
{
printf ("connect error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 31 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set bytea_output = escape", ECPGt_EOIT, ECPGt_EORT);}
#line 36 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set bytea_output = escape", ECPGt_EOIT, ECPGt_EORT);
#line 32 "binary.pgc"
if (sqlca.sqlcode)
{
printf ("set bytea_output error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 32 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea )", ECPGt_EOIT, ECPGt_EORT);}
#line 44 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea )", ECPGt_EOIT, ECPGt_EORT);
#line 34 "binary.pgc"
if (sqlca.sqlcode)
{
printf ("create error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 34 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into empl values ( 1 , 'first user' , 320 , $1 )",
ECPGt_char,&(data),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 51 "binary.pgc"
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 35 "binary.pgc"
if (sqlca.sqlcode)
{
printf ("insert error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 35 "binary.pgc"
ECPGset_var( 0, &( empl.idnum ), __LINE__);\
/* declare C cursor for select name , accs , byte from empl where idnum = $1 */
#line 58 "binary.pgc"
#line 36 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select name , accs , byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 59 "binary.pgc"
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 37 "binary.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 37 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch C", ECPGt_EOIT,
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
@ -122,30 +117,33 @@ main (void)
ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(empl.byte),(long)20,(long)1,(20)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 60 "binary.pgc"
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 38 "binary.pgc"
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 38 "binary.pgc"
printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT);}
#line 69 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT);
#line 41 "binary.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 41 "binary.pgc"
memset(empl.name, 0, 21L);
ECPGset_var( 1, &( empl.idnum ), __LINE__);\
/* declare B binary cursor for select name , accs , byte from empl where idnum = $1 */
#line 72 "binary.pgc"
#line 44 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare B binary cursor for select name , accs , byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 73 "binary.pgc"
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 45 "binary.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 45 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch B", ECPGt_EOIT,
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
@ -153,17 +151,17 @@ main (void)
ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(empl.byte),(long)20,(long)1,(20)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 74 "binary.pgc"
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 46 "binary.pgc"
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 46 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close B", ECPGt_EOIT, ECPGt_EORT);}
#line 81 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close B", ECPGt_EOIT, ECPGt_EORT);
#line 47 "binary.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 47 "binary.pgc"
/* do not print a.accs because big/little endian will have different outputs here */
@ -174,36 +172,44 @@ main (void)
ECPGset_var( 2, &( empl.idnum ), __LINE__);\
/* declare A binary cursor for select byte from empl where idnum = $1 */
#line 89 "binary.pgc"
#line 55 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare A binary cursor for select byte from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 90 "binary.pgc"
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 56 "binary.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 56 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch A", ECPGt_EOIT,
ECPGt_char,&(pointer),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 91 "binary.pgc"
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 57 "binary.pgc"
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 57 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close A", ECPGt_EOIT, ECPGt_EORT);}
#line 98 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close A", ECPGt_EOIT, ECPGt_EORT);
#line 58 "binary.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 58 "binary.pgc"
printf ("pointer=");
for (i=0; i<4; i++)
printf("(%o)", (unsigned char)pointer[i]);
printf("\n");
free(pointer);
if (pointer) {
printf ("pointer=");
for (i=0; i<4; i++)
printf("(%o)", (unsigned char)pointer[i]);
printf("\n");
free(pointer);
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 106 "binary.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 68 "binary.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 68 "binary.pgc"
exit (0);
}

View File

@ -2,101 +2,101 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 36: query: set bytea_output = escape; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 32: query: set bytea_output = escape; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 36: using PQexec
[NO_PID]: ecpg_execute on line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 36: OK: SET
[NO_PID]: ecpg_process_output on line 32: OK: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 43: query: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 33: query: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ); with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 43: using PQexec
[NO_PID]: ecpg_execute on line 33: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 43: OK: CREATE TABLE
[NO_PID]: ecpg_process_output on line 33: OK: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 51: query: insert into empl values ( 1 , 'first user' , 320 , $1 ); with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 35: query: insert into empl values ( 1 , 'first user' , 320 , $1 ); with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 51: using PQexecParams
[NO_PID]: ecpg_execute on line 35: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 51: parameter 1 = \001\155\000\212
[NO_PID]: ecpg_free_params on line 35: parameter 1 = \001\155\000\212
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 51: OK: INSERT 0 1
[NO_PID]: ecpg_process_output on line 35: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 59: query: declare C cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 37: query: declare C cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 59: using PQexecParams
[NO_PID]: ecpg_execute on line 37: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 59: parameter 1 = 1
[NO_PID]: ecpg_free_params on line 37: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 59: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 37: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 60: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 38: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 60: using PQexec
[NO_PID]: ecpg_execute on line 38: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 60: correctly got 1 tuples with 3 fields
[NO_PID]: ecpg_process_output on line 38: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 60: RESULT: first user offset: -1; array: no
[NO_PID]: ecpg_get_data on line 38: RESULT: first user offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 60: RESULT: 320 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 38: RESULT: 320 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 60: RESULT: \001m\000\212 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 38: RESULT: \001m\000\212 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 69: query: close C; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 41: query: close C; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 69: using PQexec
[NO_PID]: ecpg_execute on line 41: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 69: OK: CLOSE CURSOR
[NO_PID]: ecpg_process_output on line 41: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 73: query: declare B binary cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 45: query: declare B binary cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 73: using PQexecParams
[NO_PID]: ecpg_execute on line 45: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 73: parameter 1 = 1
[NO_PID]: ecpg_free_params on line 45: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 73: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 45: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 74: query: fetch B; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 46: query: fetch B; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 74: using PQexec
[NO_PID]: ecpg_execute on line 46: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 74: correctly got 1 tuples with 3 fields
[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 74: RESULT: BINARY offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: BINARY offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 74: RESULT: BINARY offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: BINARY offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 74: RESULT: BINARY offset: -1; array: no
[NO_PID]: ecpg_get_data on line 46: RESULT: BINARY offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: query: close B; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 47: query: close B; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 81: using PQexec
[NO_PID]: ecpg_execute on line 47: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 81: OK: CLOSE CURSOR
[NO_PID]: ecpg_process_output on line 47: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 90: query: declare A binary cursor for select byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 56: query: declare A binary cursor for select byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 90: using PQexecParams
[NO_PID]: ecpg_execute on line 56: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_free_params on line 90: parameter 1 = 1
[NO_PID]: ecpg_free_params on line 56: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 90: OK: DECLARE CURSOR
[NO_PID]: ecpg_process_output on line 56: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 91: query: fetch A; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 57: query: fetch A; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 91: using PQexec
[NO_PID]: ecpg_execute on line 57: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 91: correctly got 1 tuples with 1 fields
[NO_PID]: ecpg_process_output on line 57: correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_store_result on line 91: allocating memory for 1 tuples
[NO_PID]: ecpg_store_result on line 57: allocating memory for 1 tuples
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 91: RESULT: BINARY offset: -1; array: no
[NO_PID]: ecpg_get_data on line 57: RESULT: BINARY offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 98: query: close A; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 58: query: close A; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 98: using PQexec
[NO_PID]: ecpg_execute on line 58: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 98: OK: CLOSE CURSOR
[NO_PID]: ecpg_process_output on line 58: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection ecpg1_regression closed
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -44,7 +44,7 @@ int main() {
/* exec sql whenever sql_warning sqlprint ; */
#line 16 "fetch.pgc"
/* exec sql whenever sqlerror sqlprint ; */
/* exec sql whenever sqlerror stop ; */
#line 17 "fetch.pgc"
@ -54,7 +54,7 @@ int main() {
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 19 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 19 "fetch.pgc"
@ -64,7 +64,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 21 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 21 "fetch.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 2 , 'text2' )", ECPGt_EOIT, ECPGt_EORT);
@ -73,7 +73,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 22 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 22 "fetch.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 3 , 'text3' )", ECPGt_EOIT, ECPGt_EORT);
@ -82,7 +82,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 23 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 23 "fetch.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 4 , 'text4' )", ECPGt_EOIT, ECPGt_EORT);
@ -91,7 +91,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 24 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 24 "fetch.pgc"
@ -105,7 +105,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 28 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 28 "fetch.pgc"
@ -126,7 +126,7 @@ if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 32 "fetch.pgc"
printf("%d: %s\n", i, str);
@ -141,7 +141,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 37 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 37 "fetch.pgc"
@ -157,7 +157,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 39 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 39 "fetch.pgc"
printf("%d: %s\n", i, str);
@ -168,7 +168,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 42 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 42 "fetch.pgc"
@ -184,60 +184,53 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 46 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 46 "fetch.pgc"
/* exec sql whenever not found break ; */
#line 48 "fetch.pgc"
for (loopcount = 0; loopcount < 100; loopcount++) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in D", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in D", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 50 "fetch.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 50 "fetch.pgc"
#line 48 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 50 "fetch.pgc"
#line 48 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 50 "fetch.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 48 "fetch.pgc"
printf("%d: %s\n", i, str);
printf("%d: %s\n", i, str);
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close D", ECPGt_EOIT, ECPGt_EORT);
#line 53 "fetch.pgc"
#line 51 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 53 "fetch.pgc"
#line 51 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 53 "fetch.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 51 "fetch.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table My_Table", ECPGt_EOIT, ECPGt_EORT);
#line 55 "fetch.pgc"
#line 53 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 55 "fetch.pgc"
#line 53 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 55 "fetch.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 53 "fetch.pgc"
{ ECPGdisconnect(__LINE__, "ALL");
#line 57 "fetch.pgc"
#line 55 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 57 "fetch.pgc"
#line 55 "fetch.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 57 "fetch.pgc"
if (sqlca.sqlcode < 0) exit (1);}
#line 55 "fetch.pgc"
return 0;

View File

@ -116,35 +116,27 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 46: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 50: query: fetch 1 in D; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 48: query: fetch 1 in D; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 50: using PQexec
[NO_PID]: ecpg_execute on line 48: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 50: correctly got 1 tuples with 2 fields
[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 50: RESULT: 1 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 48: RESULT: 1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 50: RESULT: text1 offset: -1; array: no
[NO_PID]: ecpg_get_data on line 48: RESULT: text1 offset: -1; array: no
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 50: query: fetch 1 in D; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 51: query: close D; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 50: using PQexec
[NO_PID]: ecpg_execute on line 51: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 50: correctly got 0 tuples with 2 fields
[NO_PID]: ecpg_process_output on line 51: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 50: no data found on line 50
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 53: query: close D; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: ecpg_execute on line 53: query: drop table My_Table; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 53: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 53: OK: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 55: query: drop table My_Table; with 0 parameter(s) on connection ecpg1_regression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 55: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_process_output on line 55: OK: DROP TABLE
[NO_PID]: ecpg_process_output on line 53: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection ecpg1_regression closed
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -47,7 +47,7 @@ int main() {
/* exec sql whenever sql_warning sqlprint ; */
#line 17 "quote.pgc"
/* exec sql whenever sqlerror sqlprint ; */
/* exec sql whenever sqlerror stop ; */
#line 18 "quote.pgc"
@ -57,7 +57,7 @@ int main() {
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 20 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 20 "quote.pgc"
@ -67,7 +67,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 22 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 22 "quote.pgc"
@ -79,7 +79,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 24 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 24 "quote.pgc"
printf("Standard conforming strings: %s\n", var);
@ -91,7 +91,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 28 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 28 "quote.pgc"
/* this is a\\b */
@ -101,7 +101,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 30 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 30 "quote.pgc"
@ -111,7 +111,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 32 "quote.pgc"
@ -123,7 +123,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 34 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 34 "quote.pgc"
printf("Standard conforming strings: %s\n", var);
@ -135,7 +135,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 38 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 38 "quote.pgc"
/* this is a\\b */
@ -145,7 +145,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 40 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 40 "quote.pgc"
@ -155,7 +155,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 42 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 42 "quote.pgc"
/* declare C cursor for select * from \"My_Table\" */
@ -168,7 +168,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 45 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 45 "quote.pgc"
@ -191,7 +191,7 @@ if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 51 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 51 "quote.pgc"
printf("value: %d %s\n", i, var);
@ -203,7 +203,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 55 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 55 "quote.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table \"My_Table\"", ECPGt_EOIT, ECPGt_EORT);
@ -212,7 +212,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 56 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 56 "quote.pgc"
@ -222,7 +222,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 58 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) exit (1);}
#line 58 "quote.pgc"

View File

@ -38,27 +38,18 @@ static void
open_cur1(void)
{
exec sql open mycur;
if (sqlca.sqlcode != 0)
exit(1);
}
static void
get_record1(void)
{
exec sql fetch mycur;
if (sqlca.sqlcode != 0 && sqlca.sqlcode != ECPG_NOT_FOUND)
exit(1);
}
static void
close_cur1(void)
{
exec sql close mycur;
if (sqlca.sqlcode != 0)
exit(1);
}
int
@ -93,8 +84,6 @@ main (void)
get_var1(&myvar, &mynullvar);
open_cur1();
exec sql whenever not found do break;
for (loopcount = 0; loopcount < 100; loopcount++)
{
memset(myvar, 0, sizeof(MYTYPE));

View File

@ -2,7 +2,7 @@
exec sql include ../regression;
exec sql whenever sqlerror sqlprint;
exec sql whenever sqlerror stop;
int main(void)
{

View File

@ -13,6 +13,8 @@ struct TBempl
};
EXEC SQL END DECLARE SECTION;
EXEC SQL WHENEVER SQLERROR STOP;
int
main (void)
{
@ -27,43 +29,13 @@ main (void)
empl.idnum = 1;
EXEC SQL connect to REGRESSDB1;
if (sqlca.sqlcode)
{
printf ("connect error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL set bytea_output = escape;
if (sqlca.sqlcode)
{
printf ("set bytea_output error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL create table empl
(idnum integer, name char (20), accs smallint, byte bytea);
if (sqlca.sqlcode)
{
printf ("create error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL insert into empl values (1, 'first user', 320, :data);
if (sqlca.sqlcode)
{
printf ("insert error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL DECLARE C CURSOR FOR select name, accs, byte from empl where idnum =:empl.idnum;
EXEC SQL OPEN C;
EXEC SQL FETCH C INTO:empl.name,:empl.accs,:empl.byte;
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
EXEC SQL CLOSE C;
@ -72,12 +44,6 @@ main (void)
EXEC SQL DECLARE B BINARY CURSOR FOR select name, accs, byte from empl where idnum =:empl.idnum;
EXEC SQL OPEN B;
EXEC SQL FETCH B INTO :empl.name,:empl.accs,:empl.byte;
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL CLOSE B;
/* do not print a.accs because big/little endian will have different outputs here */
@ -89,19 +55,15 @@ main (void)
EXEC SQL DECLARE A BINARY CURSOR FOR select byte from empl where idnum =:empl.idnum;
EXEC SQL OPEN A;
EXEC SQL FETCH A INTO :pointer;
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL CLOSE A;
printf ("pointer=");
for (i=0; i<4; i++)
printf("(%o)", (unsigned char)pointer[i]);
printf("\n");
free(pointer);
if (pointer) {
printf ("pointer=");
for (i=0; i<4; i++)
printf("(%o)", (unsigned char)pointer[i]);
printf("\n");
free(pointer);
}
EXEC SQL disconnect;
exit (0);

View File

@ -14,7 +14,7 @@ int main() {
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL WHENEVER SQLERROR STOP;
EXEC SQL CREATE TABLE My_Table ( Item1 int, Item2 text );
@ -45,11 +45,9 @@ int main() {
EXEC SQL OPEN D using 1;
EXEC SQL WHENEVER NOT FOUND DO BREAK;
for (loopcount = 0; loopcount < 100; loopcount++) {
EXEC SQL FETCH 1 IN D INTO :i, :str;
printf("%d: %s\n", i, str);
}
EXEC SQL FETCH 1 IN D INTO :i, :str;
printf("%d: %s\n", i, str);
EXEC SQL CLOSE D;
EXEC SQL DROP TABLE My_Table;

View File

@ -15,7 +15,7 @@ int main() {
EXEC SQL SET AUTOCOMMIT TO ON;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL WHENEVER SQLERROR STOP;
EXEC SQL CREATE TABLE "My_Table" ( Item1 int, Item2 text );