mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Made sure sqlca is reset for declare cursor in Informix mode as pointed out by
Böszörményi Zoltán <zb@cybertec.at>.
This commit is contained in:
@ -45,7 +45,9 @@ int main(void)
|
||||
printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||
if (sqlca.sqlcode != 0) $rollback;
|
||||
|
||||
sqlca.sqlcode = 100;
|
||||
$declare c cursor for select * from test where i <= :i;
|
||||
printf ("%ld\n", sqlca.sqlcode);
|
||||
openit();
|
||||
|
||||
deccvint(0, &j);
|
||||
|
@ -146,10 +146,12 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 46 "test_informix.pgc"
|
||||
|
||||
|
||||
sqlca.sqlcode = 100;
|
||||
ECPG_informix_set_var( 0, &( i ), __LINE__);\
|
||||
/* declare c cursor for select * from test where i <= $1 */
|
||||
#line 48 "test_informix.pgc"
|
||||
ECPG_informix_reset_sqlca(); /* declare c cursor for select * from test where i <= $1 */
|
||||
#line 49 "test_informix.pgc"
|
||||
|
||||
printf ("%ld\n", sqlca.sqlcode);
|
||||
openit();
|
||||
|
||||
deccvint(0, &j);
|
||||
@ -163,10 +165,10 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_string,(c),(long)10,(long)1,(10)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 55 "test_informix.pgc"
|
||||
#line 57 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 55 "test_informix.pgc"
|
||||
#line 57 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
|
||||
@ -188,53 +190,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 73 "test_informix.pgc"
|
||||
#line 75 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 73 "test_informix.pgc"
|
||||
#line 75 "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 76 "test_informix.pgc"
|
||||
#line 78 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 76 "test_informix.pgc"
|
||||
#line 78 "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 79 "test_informix.pgc"
|
||||
#line 81 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 79 "test_informix.pgc"
|
||||
#line 81 "test_informix.pgc"
|
||||
|
||||
printf("Does not exist: %ld\n", sqlca.sqlcode);
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "commit");
|
||||
#line 82 "test_informix.pgc"
|
||||
#line 84 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 82 "test_informix.pgc"
|
||||
#line 84 "test_informix.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 83 "test_informix.pgc"
|
||||
#line 85 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 83 "test_informix.pgc"
|
||||
#line 85 "test_informix.pgc"
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "commit");
|
||||
#line 84 "test_informix.pgc"
|
||||
#line 86 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 84 "test_informix.pgc"
|
||||
#line 86 "test_informix.pgc"
|
||||
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");
|
||||
#line 86 "test_informix.pgc"
|
||||
#line 88 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 86 "test_informix.pgc"
|
||||
#line 88 "test_informix.pgc"
|
||||
|
||||
|
||||
return 0;
|
||||
@ -245,10 +247,10 @@ 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 *)(ECPG_informix_get_var( 0))),(long)1,(long)1,sizeof(int),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 93 "test_informix.pgc"
|
||||
#line 95 "test_informix.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) dosqlprint ( );}
|
||||
#line 93 "test_informix.pgc"
|
||||
#line 95 "test_informix.pgc"
|
||||
|
||||
}
|
||||
|
||||
|
@ -55,79 +55,79 @@ DETAIL: Key (i)=(7) already exists.
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 44: correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 93: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 95: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 93: using PQexecParams
|
||||
[NO_PID]: ecpg_execute on line 95: using PQexecParams
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: free_params on line 93: parameter 1 = 14
|
||||
[NO_PID]: free_params on line 95: parameter 1 = 14
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 93: OK: DECLARE CURSOR
|
||||
[NO_PID]: ecpg_execute on line 95: OK: DECLARE CURSOR
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: using PQexec
|
||||
[NO_PID]: ecpg_execute on line 57: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 3 fields
|
||||
[NO_PID]: ecpg_execute on line 57: correctly got 1 tuples with 3 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 55: RESULT: 7 offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 57: RESULT: 7 offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 55: RESULT: 0 offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 57: RESULT: 0 offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 55: RESULT: test offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 57: RESULT: test offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: using PQexec
|
||||
[NO_PID]: ecpg_execute on line 57: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 3 fields
|
||||
[NO_PID]: ecpg_execute on line 57: correctly got 1 tuples with 3 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 55: RESULT: 14 offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 57: RESULT: 14 offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 55: RESULT: 1 offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 57: RESULT: 1 offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_get_data on line 55: RESULT: a offset: -1; array: yes
|
||||
[NO_PID]: ecpg_get_data on line 57: RESULT: a offset: -1; array: yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: using PQexec
|
||||
[NO_PID]: ecpg_execute on line 57: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 55: correctly got 0 tuples with 3 fields
|
||||
[NO_PID]: ecpg_execute on line 57: correctly got 0 tuples with 3 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: raising sqlcode 100 on line 55: no data found on line 55
|
||||
[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 73: query: delete from test where i = $1 :: decimal; with 1 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 75: query: delete from test where i = $1 :: decimal; with 1 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 73: using PQexecParams
|
||||
[NO_PID]: ecpg_execute on line 75: using PQexecParams
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: free_params on line 73: parameter 1 = 21.0
|
||||
[NO_PID]: free_params on line 75: parameter 1 = 21.0
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 73: OK: DELETE 0
|
||||
[NO_PID]: ecpg_execute on line 75: OK: DELETE 0
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: raising sqlcode 100 on line 73: no data found on line 73
|
||||
[NO_PID]: raising sqlcode 100 on line 75: no data found on line 75
|
||||
[NO_PID]: sqlca: code: 100, state: 02000
|
||||
[NO_PID]: ecpg_execute on line 76: query: select 1 from test where i = 14; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 78: query: select 1 from test where i = 14; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 76: using PQexec
|
||||
[NO_PID]: ecpg_execute on line 78: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 76: correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: ecpg_execute on line 78: correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 79: query: select 1 from test where i = 147; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: ecpg_execute on line 81: query: select 1 from test where i = 147; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 79: using PQexec
|
||||
[NO_PID]: ecpg_execute on line 81: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 79: correctly got 0 tuples with 1 fields
|
||||
[NO_PID]: ecpg_execute on line 81: correctly got 0 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: raising sqlcode 100 on line 79: no data found on line 79
|
||||
[NO_PID]: raising sqlcode 100 on line 81: no data found on line 81
|
||||
[NO_PID]: sqlca: code: 100, state: 02000
|
||||
[NO_PID]: ECPGtrans on line 82: action "commit"; connection "regress1"
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 83: query: drop table test; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 83: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 83: OK: DROP TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGtrans on line 84: action "commit"; connection "regress1"
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 85: query: drop table test; with 0 parameter(s) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 85: using PQexec
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_execute on line 85: OK: DROP TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGtrans on line 86: action "commit"; connection "regress1"
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: connection regress1 closed
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -2,6 +2,7 @@ doSQLprint: Error: duplicate key value violates unique constraint "test_pkey" on
|
||||
INSERT: -239=duplicate key value violates unique constraint "test_pkey" on line 32
|
||||
doSQLprint: Error: more than one row returned by a subquery used as an expression on line 40
|
||||
SELECT: 0=
|
||||
0
|
||||
7 0 "test"
|
||||
14 1 "a"
|
||||
DELETE: 100
|
||||
|
@ -47,7 +47,7 @@
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: raising sqlcode -402 on line 53: could not connect to database "nonexistant" on line 53
|
||||
[NO_PID]: sqlca: code: -402, state: 08001
|
||||
[NO_PID]: raising sqlcode -220 on line 54: no such connection CURRENT on line 54
|
||||
[NO_PID]: raising sqlcode -220 on line 54: connection "CURRENT" does not exist on line 54
|
||||
[NO_PID]: sqlca: code: -220, state: 08003
|
||||
[NO_PID]: ECPGconnect: opening database connectdb on localhost port <REGRESSION_PORT> for user connectuser
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
Reference in New Issue
Block a user