Commit 4b8378a6 authored by Michael Meskes's avatar Michael Meskes

Removed compiler warnings

parent 27458bb4
#include "sqltypes.h" #include "sqltypes.h"
#include <stdlib.h>
#
$include ../regression; $include ../regression;
$define NUMBER 12; $define NUMBER 12;
......
...@@ -3,40 +3,39 @@ exec sql include sqlca; ...@@ -3,40 +3,39 @@ exec sql include sqlca;
enum e { ENUM0, ENUM1 }; enum e { ENUM0, ENUM1 };
struct sa { int member; }; struct sa { int member; };
int static int fa(void)
fa(void)
{ {
printf("in fa\n"); printf("in fa\n");
return 2; return 2;
} }
int static int
fb(int x) fb(int x)
{ {
printf("in fb (%d)\n", x); printf("in fb (%d)\n", x);
return x; return x;
} }
int static int
fc(const char *x) fc(const char *x)
{ {
printf("in fc (%s)\n", x); printf("in fc (%s)\n", x);
return *x; return *x;
} }
int fd(const char *x,int i) static int fd(const char *x,int i)
{ {
printf("in fd (%s, %d)\n", x, i); printf("in fd (%s, %d)\n", x, i);
return (*x)*i; return (*x)*i;
} }
int fe(enum e x) static int fe(enum e x)
{ {
printf("in fe (%d)\n", (int) x); printf("in fe (%d)\n", (int) x);
return (int)x; return (int)x;
} }
void sqlnotice(char *notice, short trans) static void sqlnotice(char *notice, short trans)
{ {
if (!notice) if (!notice)
notice = "-empty-"; notice = "-empty-";
...@@ -56,7 +55,7 @@ namespace N ...@@ -56,7 +55,7 @@ namespace N
int main(void) int main(void)
{ {
struct sa x,*y; struct sa x = { 14 },*y = &x;
exec sql begin declare section; exec sql begin declare section;
int a=(int)2; int a=(int)2;
int b=2+2; int b=2+2;
...@@ -83,6 +82,9 @@ int main(void) ...@@ -83,6 +82,9 @@ int main(void)
ECPGdebug(1, stderr); ECPGdebug(1, stderr);
printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j);
iax = iay = 0;
printf("%ld %lld\n", iay, iax);
exec sql whenever sqlerror do fa(); exec sql whenever sqlerror do fa();
exec sql select now(); exec sql select now();
exec sql whenever sqlerror do fb(20); exec sql whenever sqlerror do fb(20);
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
#line 1 "test_informix.pgc" #line 1 "test_informix.pgc"
#include "sqltypes.h" #include "sqltypes.h"
#include <stdlib.h>
#
#line 1 "./../regression.h" #line 1 "./../regression.h"
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
#line 3 "test_informix.pgc" #line 4 "test_informix.pgc"
...@@ -31,36 +32,36 @@ static void dosqlprint(void) { ...@@ -31,36 +32,36 @@ static void dosqlprint(void) {
int main(void) int main(void)
{ {
#line 13 "test_informix.pgc" #line 14 "test_informix.pgc"
int i = 14 ; int i = 14 ;
#line 13 "test_informix.pgc" #line 14 "test_informix.pgc"
#line 14 "test_informix.pgc" #line 15 "test_informix.pgc"
decimal j , m , n ; decimal j , m , n ;
#line 14 "test_informix.pgc" #line 15 "test_informix.pgc"
ECPGdebug(1, stderr); ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do dosqlprint ( ) ; */ /* exec sql whenever sqlerror do dosqlprint ( ) ; */
#line 17 "test_informix.pgc" #line 18 "test_informix.pgc"
{ ECPGconnect(__LINE__, 1, "regress1" , NULL,NULL , NULL, 0); { ECPGconnect(__LINE__, 1, "regress1" , NULL,NULL , NULL, 0);
#line 19 "test_informix.pgc" #line 20 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 19 "test_informix.pgc" #line 20 "test_informix.pgc"
if (sqlca.sqlcode != 0) exit(1); if (sqlca.sqlcode != 0) exit(1);
{ ECPGdo(__LINE__, 1, 1, NULL, "create table test ( i int primary key , j int ) ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, "create table test ( i int primary key , j int ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "test_informix.pgc" #line 23 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 22 "test_informix.pgc" #line 23 "test_informix.pgc"
/* this INSERT works */ /* this INSERT works */
...@@ -68,74 +69,74 @@ if (sqlca.sqlcode < 0) dosqlprint ( );} ...@@ -68,74 +69,74 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
{ ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values( 7 , ? )", { ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values( 7 , ? )",
ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 26 "test_informix.pgc" #line 27 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 26 "test_informix.pgc" #line 27 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 27 "test_informix.pgc" #line 28 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 27 "test_informix.pgc" #line 28 "test_informix.pgc"
/* this INSERT should fail because i is a unique column */ /* this INSERT should fail because i is a unique column */
{ ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values( 7 , 12 )", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values( 7 , 12 )", ECPGt_EOIT, ECPGt_EORT);
#line 30 "test_informix.pgc" #line 31 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 30 "test_informix.pgc" #line 31 "test_informix.pgc"
printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback"); if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
#line 32 "test_informix.pgc" #line 33 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 32 "test_informix.pgc" #line 33 "test_informix.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values( ? , 1 )", { ECPGdo(__LINE__, 1, 1, NULL, "insert into test ( i , j ) values( ? , 1 )",
ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 34 "test_informix.pgc" #line 35 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 34 "test_informix.pgc" #line 35 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 35 "test_informix.pgc" #line 36 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 35 "test_informix.pgc" #line 36 "test_informix.pgc"
/* this will fail (more than one row in subquery) */ /* this will fail (more than one row in subquery) */
{ ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test ) ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test ) ", ECPGt_EOIT, ECPGt_EORT);
#line 38 "test_informix.pgc" #line 39 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 38 "test_informix.pgc" #line 39 "test_informix.pgc"
/* this however should be ok */ /* this however should be ok */
{ ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test limit 1 ) ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test limit 1 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 41 "test_informix.pgc" #line 42 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 41 "test_informix.pgc" #line 42 "test_informix.pgc"
printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback"); if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
#line 43 "test_informix.pgc" #line 44 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 43 "test_informix.pgc" #line 44 "test_informix.pgc"
ECPG_informix_set_var( 0, &( i ), __LINE__);\ ECPG_informix_set_var( 0, &( i ), __LINE__);\
/* declare c cursor for select * from test where i <= ? */ /* declare c cursor for select * from test where i <= ? */
#line 45 "test_informix.pgc" #line 46 "test_informix.pgc"
openit(); openit();
...@@ -148,10 +149,10 @@ if (sqlca.sqlcode < 0) dosqlprint ( );} ...@@ -148,10 +149,10 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 52 "test_informix.pgc" #line 53 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 52 "test_informix.pgc" #line 53 "test_informix.pgc"
if (sqlca.sqlcode == 100) break; if (sqlca.sqlcode == 100) break;
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode); else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
...@@ -173,53 +174,53 @@ if (sqlca.sqlcode < 0) dosqlprint ( );} ...@@ -173,53 +174,53 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
{ ECPGdo(__LINE__, 1, 1, NULL, "delete from test where i = ?", { ECPGdo(__LINE__, 1, 1, NULL, "delete from test where i = ?",
ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal), ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 70 "test_informix.pgc" #line 71 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 70 "test_informix.pgc" #line 71 "test_informix.pgc"
printf("DELETE: %ld\n", sqlca.sqlcode); printf("DELETE: %ld\n", sqlca.sqlcode);
{ ECPGdo(__LINE__, 1, 1, NULL, "select 1 from test where i = 14 ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, "select 1 from test where i = 14 ", ECPGt_EOIT, ECPGt_EORT);
#line 73 "test_informix.pgc" #line 74 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 73 "test_informix.pgc" #line 74 "test_informix.pgc"
printf("Exists: %ld\n", sqlca.sqlcode); printf("Exists: %ld\n", sqlca.sqlcode);
{ ECPGdo(__LINE__, 1, 1, NULL, "select 1 from test where i = 147 ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, "select 1 from test where i = 147 ", ECPGt_EOIT, ECPGt_EORT);
#line 76 "test_informix.pgc" #line 77 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 76 "test_informix.pgc" #line 77 "test_informix.pgc"
printf("Does not exist: %ld\n", sqlca.sqlcode); printf("Does not exist: %ld\n", sqlca.sqlcode);
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 79 "test_informix.pgc" #line 80 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 79 "test_informix.pgc" #line 80 "test_informix.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 80 "test_informix.pgc" #line 81 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 80 "test_informix.pgc" #line 81 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 81 "test_informix.pgc" #line 82 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 81 "test_informix.pgc" #line 82 "test_informix.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT"); { ECPGdisconnect(__LINE__, "CURRENT");
#line 83 "test_informix.pgc" #line 84 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 83 "test_informix.pgc" #line 84 "test_informix.pgc"
return 0; return 0;
...@@ -230,10 +231,10 @@ static void openit(void) ...@@ -230,10 +231,10 @@ static void openit(void)
{ ECPGdo(__LINE__, 1, 1, NULL, "declare c cursor for select * from test where i <= ? ", { ECPGdo(__LINE__, 1, 1, NULL, "declare c cursor for select * from test where i <= ? ",
ECPGt_int,&(*( int *)(ECPG_informix_get_var( 0))),(long)1,(long)1,sizeof(int), 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); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 90 "test_informix.pgc" #line 91 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 90 "test_informix.pgc" #line 91 "test_informix.pgc"
} }
...@@ -2,93 +2,93 @@ ...@@ -2,93 +2,93 @@
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22: QUERY: create table test ( i int primary key , j int ) on connection regress1 [NO_PID]: ECPGexecute line 23: QUERY: create table test ( i int primary key , j int ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: CREATE TABLE [NO_PID]: ECPGexecute line 23 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( i , j ) values( 7 , 0 ) on connection regress1 [NO_PID]: ECPGexecute line 27: QUERY: insert into test ( i , j ) values( 7 , 0 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1 [NO_PID]: ECPGexecute line 27 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 27 action = commit connection = regress1 [NO_PID]: ECPGtrans line 28 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: QUERY: insert into test ( i , j ) values( 7 , 12 ) on connection regress1 [NO_PID]: ECPGexecute line 31: QUERY: insert into test ( i , j ) values( 7 , 12 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: Error: ERROR: duplicate key violates unique constraint "test_pkey" [NO_PID]: ECPGexecute line 31: Error: ERROR: duplicate key violates unique constraint "test_pkey"
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 23505 (sqlcode: -239) in line 30, ''duplicate key violates unique constraint "test_pkey"' in line 30.'. [NO_PID]: raising sqlstate 23505 (sqlcode: -239) in line 31, ''duplicate key violates unique constraint "test_pkey"' in line 31.'.
[NO_PID]: sqlca: code: -239, state: 23505 [NO_PID]: sqlca: code: -239, state: 23505
[NO_PID]: ECPGtrans line 32 action = rollback connection = regress1 [NO_PID]: ECPGtrans line 33 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34: QUERY: insert into test ( i , j ) values( 14 , 1 ) on connection regress1 [NO_PID]: ECPGexecute line 35: QUERY: insert into test ( i , j ) values( 14 , 1 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1 [NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 35 action = commit connection = regress1 [NO_PID]: ECPGtrans line 36 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38: QUERY: select i from test where j = ( select j from test ) on connection regress1 [NO_PID]: ECPGexecute line 39: QUERY: select i from test where j = ( select j from test ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38: Error: ERROR: more than one row returned by a subquery used as an expression [NO_PID]: ECPGexecute line 39: Error: ERROR: more than one row returned by a subquery used as an expression
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 21000 (sqlcode: -284) in line 38, ''more than one row returned by a subquery used as an expression' in line 38.'. [NO_PID]: raising sqlstate 21000 (sqlcode: -284) in line 39, ''more than one row returned by a subquery used as an expression' in line 39.'.
[NO_PID]: sqlca: code: -284, state: 21000 [NO_PID]: sqlca: code: -284, state: 21000
[NO_PID]: ECPGexecute line 41: QUERY: select i from test where j = ( select j from test limit 1 ) on connection regress1 [NO_PID]: ECPGexecute line 42: QUERY: select i from test where j = ( select j from test limit 1 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 41: Error: ERROR: current transaction is aborted, commands ignored until end of transaction block [NO_PID]: ECPGexecute line 42: Error: ERROR: current transaction is aborted, commands ignored until end of transaction block
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 25P02 (sqlcode: -400) in line 41, ''current transaction is aborted, commands ignored until end of transaction block' in line 41.'. [NO_PID]: raising sqlstate 25P02 (sqlcode: -400) in line 42, ''current transaction is aborted, commands ignored until end of transaction block' in line 42.'.
[NO_PID]: sqlca: code: -400, state: 25P02 [NO_PID]: sqlca: code: -400, state: 25P02
[NO_PID]: ECPGtrans line 43 action = rollback connection = regress1 [NO_PID]: ECPGtrans line 44 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 90: QUERY: declare c cursor for select * from test where i <= 14 on connection regress1 [NO_PID]: ECPGexecute line 91: QUERY: declare c cursor for select * from test where i <= 14 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 90 Ok: DECLARE CURSOR [NO_PID]: ECPGexecute line 91 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: fetch forward from c on connection regress1 [NO_PID]: ECPGexecute line 53: QUERY: fetch forward from c on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 2 fields [NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 7 offset: 4 array: Yes [NO_PID]: ECPGget_data line 53: RESULT: 7 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 0 offset: 52 array: Yes [NO_PID]: ECPGget_data line 53: RESULT: 0 offset: 52 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: fetch forward from c on connection regress1 [NO_PID]: ECPGexecute line 53: QUERY: fetch forward from c on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 2 fields [NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 14 offset: 4 array: Yes [NO_PID]: ECPGget_data line 53: RESULT: 14 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 1 offset: 52 array: Yes [NO_PID]: ECPGget_data line 53: RESULT: 1 offset: 52 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: fetch forward from c on connection regress1 [NO_PID]: ECPGexecute line 53: QUERY: fetch forward from c on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: Correctly got 0 tuples with 2 fields [NO_PID]: ECPGexecute line 53: Correctly got 0 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 52, 'No data found in line 52.'. [NO_PID]: raising sqlcode 100 in line 53, 'No data found in line 53.'.
[NO_PID]: sqlca: code: 100, state: 02000 [NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 70: QUERY: delete from test where i = 21.0 on connection regress1 [NO_PID]: ECPGexecute line 71: QUERY: delete from test where i = 21.0 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70 Ok: DELETE 0 [NO_PID]: ECPGexecute line 71 Ok: DELETE 0
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 70, 'No data found in line 70.'. [NO_PID]: raising sqlcode 100 in line 71, 'No data found in line 71.'.
[NO_PID]: sqlca: code: 100, state: 02000 [NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 73: QUERY: select 1 from test where i = 14 on connection regress1 [NO_PID]: ECPGexecute line 74: QUERY: select 1 from test where i = 14 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 73: Correctly got 1 tuples with 1 fields [NO_PID]: ECPGexecute line 74: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76: QUERY: select 1 from test where i = 147 on connection regress1 [NO_PID]: ECPGexecute line 77: QUERY: select 1 from test where i = 147 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76: Correctly got 0 tuples with 1 fields [NO_PID]: ECPGexecute line 77: Correctly got 0 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 76, 'No data found in line 76.'. [NO_PID]: raising sqlcode 100 in line 77, 'No data found in line 77.'.
[NO_PID]: sqlca: code: 100, state: 02000 [NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGtrans line 79 action = commit connection = regress1 [NO_PID]: ECPGtrans line 80 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 80: QUERY: drop table test on connection regress1 [NO_PID]: ECPGexecute line 81: QUERY: drop table test on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 80 Ok: DROP TABLE [NO_PID]: ECPGexecute line 81 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 81 action = commit connection = regress1 [NO_PID]: ECPGtrans line 82 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed. [NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
doSQLprint: Error: 'duplicate key violates unique constraint "test_pkey"' in line 30. doSQLprint: Error: 'duplicate key violates unique constraint "test_pkey"' in line 31.
INSERT: -239='duplicate key violates unique constraint "test_pkey"' in line 30. INSERT: -239='duplicate key violates unique constraint "test_pkey"' in line 31.
doSQLprint: Error: 'more than one row returned by a subquery used as an expression' in line 38. doSQLprint: Error: 'more than one row returned by a subquery used as an expression' in line 39.
doSQLprint: Error: 'current transaction is aborted, commands ignored until end of transaction block' in line 41. doSQLprint: Error: 'current transaction is aborted, commands ignored until end of transaction block' in line 42.
SELECT: -400='current transaction is aborted, commands ignored until end of transaction block' in line 41. SELECT: -400='current transaction is aborted, commands ignored until end of transaction block' in line 42.
7 0 7 0
14 1 14 1
DELETE: 100 DELETE: 100
......
...@@ -82,40 +82,39 @@ struct sqlca_t *ECPGget_sqlca(void); ...@@ -82,40 +82,39 @@ struct sqlca_t *ECPGget_sqlca(void);
enum e { ENUM0, ENUM1 }; enum e { ENUM0, ENUM1 };
struct sa { int member; }; struct sa { int member; };
int static int fa(void)
fa(void)
{ {
printf("in fa\n"); printf("in fa\n");
return 2; return 2;
} }
int static int
fb(int x) fb(int x)
{ {
printf("in fb (%d)\n", x); printf("in fb (%d)\n", x);
return x; return x;
} }
int static int
fc(const char *x) fc(const char *x)
{ {
printf("in fc (%s)\n", x); printf("in fc (%s)\n", x);
return *x; return *x;
} }
int fd(const char *x,int i) static int fd(const char *x,int i)
{ {
printf("in fd (%s, %d)\n", x, i); printf("in fd (%s, %d)\n", x, i);
return (*x)*i; return (*x)*i;
} }
int fe(enum e x) static int fe(enum e x)
{ {
printf("in fe (%d)\n", (int) x); printf("in fe (%d)\n", (int) x);
return (int)x; return (int)x;
} }
void sqlnotice(char *notice, short trans) static void sqlnotice(char *notice, short trans)
{ {
if (!notice) if (!notice)
notice = "-empty-"; notice = "-empty-";
...@@ -135,7 +134,7 @@ namespace N ...@@ -135,7 +134,7 @@ namespace N
int main(void) int main(void)
{ {
struct sa x,*y; struct sa x = { 14 },*y = &x;
/* exec sql begin declare section */ /* exec sql begin declare section */
...@@ -151,43 +150,43 @@ int main(void) ...@@ -151,43 +150,43 @@ int main(void)
/* = 1L */ /* = 1L */
/* = 40000000000LL */ /* = 40000000000LL */
#line 61 "init.pgc" #line 60 "init.pgc"
int a = ( int ) 2 ; int a = ( int ) 2 ;
#line 62 "init.pgc" #line 61 "init.pgc"
int b = 2 + 2 ; int b = 2 + 2 ;
#line 63 "init.pgc" #line 62 "init.pgc"
int b2 = ( 14 * 7 ) ; int b2 = ( 14 * 7 ) ;
#line 64 "init.pgc" #line 63 "init.pgc"
int d = x . member ; int d = x . member ;
#line 65 "init.pgc" #line 64 "init.pgc"
int g = fb ( 2 ) ; int g = fb ( 2 ) ;
#line 66 "init.pgc" #line 65 "init.pgc"
int i = 3 ^ 1 ; int i = 3 ^ 1 ;
#line 67 "init.pgc" #line 66 "init.pgc"
int j = 1 ? 1 : 2 ; int j = 1 ? 1 : 2 ;
#line 69 "init.pgc" #line 68 "init.pgc"
int e = y -> member ; int e = y -> member ;
#line 70 "init.pgc" #line 69 "init.pgc"
int c = 10 >> 2 ; int c = 10 >> 2 ;
#line 71 "init.pgc" #line 70 "init.pgc"
bool h = 2 || 1 ; bool h = 2 || 1 ;
#line 72 "init.pgc" #line 71 "init.pgc"
long iay ; long iay ;
#line 73 "init.pgc" #line 72 "init.pgc"
long long iax ; long long iax ;
/* exec sql end declare section */ /* exec sql end declare section */
#line 74 "init.pgc" #line 73 "init.pgc"
int f=fa(); int f=fa();
...@@ -196,68 +195,71 @@ int main(void) ...@@ -196,68 +195,71 @@ int main(void)
/* exec sql begin declare section */ /* exec sql begin declare section */
/* compile error */ /* compile error */
#line 80 "init.pgc" #line 79 "init.pgc"
int k = N : : i ; int k = N : : i ;
/* exec sql end declare section */ /* exec sql end declare section */
#line 81 "init.pgc" #line 80 "init.pgc"
#endif #endif
ECPGdebug(1, stderr); ECPGdebug(1, stderr);
printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j);
iax = iay = 0;
printf("%ld %lld\n", iay, iax);
/* exec sql whenever sqlerror do fa ( ) ; */ /* exec sql whenever sqlerror do fa ( ) ; */
#line 86 "init.pgc" #line 88 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 87 "init.pgc" #line 89 "init.pgc"
if (sqlca.sqlcode < 0) fa ( );} if (sqlca.sqlcode < 0) fa ( );}
#line 87 "init.pgc" #line 89 "init.pgc"
/* exec sql whenever sqlerror do fb ( 20 ) ; */ /* exec sql whenever sqlerror do fb ( 20 ) ; */
#line 88 "init.pgc" #line 90 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 89 "init.pgc" #line 91 "init.pgc"
if (sqlca.sqlcode < 0) fb ( 20 );} if (sqlca.sqlcode < 0) fb ( 20 );}
#line 89 "init.pgc" #line 91 "init.pgc"
/* exec sql whenever sqlerror do fc ( \"50\" ) ; */ /* exec sql whenever sqlerror do fc ( \"50\" ) ; */
#line 90 "init.pgc" #line 92 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 91 "init.pgc" #line 93 "init.pgc"
if (sqlca.sqlcode < 0) fc ( "50" );} if (sqlca.sqlcode < 0) fc ( "50" );}
#line 91 "init.pgc" #line 93 "init.pgc"
/* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */ /* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */
#line 92 "init.pgc" #line 94 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 93 "init.pgc" #line 95 "init.pgc"
if (sqlca.sqlcode < 0) fd ( "50" , 1 );} if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
#line 93 "init.pgc" #line 95 "init.pgc"
/* exec sql whenever sqlerror do fe ( ENUM0 ) ; */ /* exec sql whenever sqlerror do fe ( ENUM0 ) ; */
#line 94 "init.pgc" #line 96 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 95 "init.pgc" #line 97 "init.pgc"
if (sqlca.sqlcode < 0) fe ( ENUM0 );} if (sqlca.sqlcode < 0) fe ( ENUM0 );}
#line 95 "init.pgc" #line 97 "init.pgc"
/* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */ /* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */
#line 96 "init.pgc" #line 98 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 97 "init.pgc" #line 99 "init.pgc"
if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );} if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
#line 97 "init.pgc" #line 99 "init.pgc"
return 0; return 0;
} }
[NO_PID]: ECPGdebug: set to 1 [NO_PID]: ECPGdebug: set to 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -220 in line 87, 'No such connection NULL in line 87.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 89, 'No such connection NULL in line 89.'. [NO_PID]: raising sqlcode -220 in line 89, 'No such connection NULL in line 89.'.
[NO_PID]: sqlca: code: -220, state: 08003 [NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 91, 'No such connection NULL in line 91.'. [NO_PID]: raising sqlcode -220 in line 91, 'No such connection NULL in line 91.'.
...@@ -12,3 +10,5 @@ ...@@ -12,3 +10,5 @@
[NO_PID]: sqlca: code: -220, state: 08003 [NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 97, 'No such connection NULL in line 97.'. [NO_PID]: raising sqlcode -220 in line 97, 'No such connection NULL in line 97.'.
[NO_PID]: sqlca: code: -220, state: 08003 [NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 99, 'No such connection NULL in line 99.'.
[NO_PID]: sqlca: code: -220, state: 08003
in fb (2) in fb (2)
in fa in fa
2 4 98 2 14 14 2 2 1 2 1
0 0
in fa in fa
in fb (20) in fb (20)
in fc (50) in fc (50)
......
#! /bin/sh #! /bin/sh
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.2 2006/08/03 13:11:03 meskes Exp $ # $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.3 2006/08/03 14:50:11 meskes Exp $
me=`basename $0` me=`basename $0`
...@@ -106,9 +106,9 @@ for i in \ ...@@ -106,9 +106,9 @@ for i in \
# echo "$runprg > $outfile_stdout 2> $outfile_stderr" # echo "$runprg > $outfile_stdout 2> $outfile_stderr"
$runprg > "$outfile_stdout" 2> "$outfile_stderr" $runprg > "$outfile_stdout" 2> "$outfile_stderr"
DIFFER="" DIFFER=""
diff -c3 expected/$outprg.stderr "$outputdir"/$outprg.stderr >/dev/null 2>&1 || DIFFER="$DIFFER, log" diff -C3 expected/$outprg.stderr "$outputdir"/$outprg.stderr >/dev/null 2>&1 || DIFFER="$DIFFER, log"
diff -c3 expected/$outprg.stdout "$outputdir"/$outprg.stdout >/dev/null 2>&1 || DIFFER="$DIFFER, output" diff -C3 expected/$outprg.stdout "$outputdir"/$outprg.stdout >/dev/null 2>&1 || DIFFER="$DIFFER, output"
diff -c3 expected/$outprg.c "$outputdir"/$outprg.c >/dev/null 2>&1 || DIFFER="$DIFFER, source" diff -C3 expected/$outprg.c "$outputdir"/$outprg.c >/dev/null 2>&1 || DIFFER="$DIFFER, source"
DIFFER=${DIFFER#, } DIFFER=${DIFFER#, }
if [ "x$DIFFER" = "x" ]; then if [ "x$DIFFER" = "x" ]; then
echo ok echo ok
...@@ -117,7 +117,7 @@ for i in \ ...@@ -117,7 +117,7 @@ for i in \
fi fi
done done
diff -c3 -r expected/ $outputdir > regression.diff && rm regression.diff diff -C3 -r expected/ $outputdir > regression.diff && rm regression.diff
[ $? -ne 0 ] && exit [ $? -ne 0 ] && exit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment