1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-07 11:02:12 +03:00

Reverted changes made by pgindent

Made show.pgc set all variables before displaying them.
This commit is contained in:
Michael Meskes 2006-10-04 10:09:03 +00:00
parent f99a569a2e
commit fcc2fbac22
43 changed files with 2607 additions and 4143 deletions

View File

@ -13,11 +13,9 @@
#include <stdlib.h>
#include <sqltypes.h>
int
main(void)
int main(void)
{
char t1[] = "abc def ghi ";
/* 123456789012345 */
char buf[50];
int k;

View File

@ -47,9 +47,10 @@ TODO:
char* decs[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4",
"2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4",
".500001", "-.5000001",
"1234567890123456789012345678.91", /* 30 digits should fit into decimal */
"1234567890123456789012345678.921", /* 31 digits should NOT fit into
* decimal */
"1234567890123456789012345678.91", /* 30 digits should fit
into decimal */
"1234567890123456789012345678.921", /* 31 digits should NOT
fit into decimal */
"not a number",
NULL};
@ -62,16 +63,10 @@ static void
int
main(void)
{
decimal *dec,
*din;
decimal *dec, *din;
char buf[BUFSIZE];
long l;
int i,
j,
k,
q,
r,
count = 0;
int i, j, k, q, r, count = 0;
double dbl;
decimal **decarr = (decimal **) calloc(1, sizeof(decimal));
@ -91,60 +86,50 @@ main(void)
decarr[count++] = dec;
r = dectoasc(dec, buf, BUFSIZE-1, -1);
if (r < 0)
check_errno();
if (r < 0) check_errno();
printf("dec[%d,1]: r: %d, %s\n", i, r, buf);
r = dectoasc(dec, buf, BUFSIZE-1, 0);
if (r < 0)
check_errno();
if (r < 0) check_errno();
printf("dec[%d,2]: r: %d, %s\n", i, r, buf);
r = dectoasc(dec, buf, BUFSIZE-1, 1);
if (r < 0)
check_errno();
if (r < 0) check_errno();
printf("dec[%d,3]: r: %d, %s\n", i, r, buf);
r = dectoasc(dec, buf, BUFSIZE-1, 2);
if (r < 0)
check_errno();
if (r < 0) check_errno();
printf("dec[%d,4]: r: %d, %s\n", i, r, buf);
din = PGTYPESdecimal_new();
r = dectoasc(din, buf, BUFSIZE-1, 2);
if (r < 0)
check_errno();
if (r < 0) check_errno();
printf("dec[%d,5]: r: %d, %s\n", i, r, buf);
r = dectolong(dec, &l);
if (r)
check_errno();
if (r) check_errno();
printf("dec[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
if (r == 0)
{
r = deccvlong(l, din);
if (r)
check_errno();
if (r) check_errno();
dectoasc(din, buf, BUFSIZE-1, 2);
q = deccmp(dec, din);
printf("dec[%d,7]: %s (r: %d - cmp: %d)\n", i, buf, r, q);
}
r = dectoint(dec, &k);
if (r)
check_errno();
if (r) check_errno();
printf("dec[%d,8]: %d (r: %d)\n", i, r?0:k, r);
if (r == 0)
{
r = deccvint(k, din);
if (r)
check_errno();
if (r) check_errno();
dectoasc(din, buf, BUFSIZE-1, 2);
q = deccmp(dec, din);
printf("dec[%d,9]: %s (r: %d - cmp: %d)\n", i, buf, r, q);
}
r = dectodbl(dec, &dbl);
if (r)
check_errno();
if (r) check_errno();
printf("dec[%d,10]: %g (r: %d)\n", i, r?0.0:dbl, r);
PGTYPESdecimal_free(din);
@ -163,22 +148,16 @@ main(void)
risnull(CDECIMALTYPE, (char *) decarr[0]) ? "" : "NOT ");
r = dectoasc(decarr[3], buf, -1, -1);
check_errno();
printf("dectoasc with len == -1: r: %d\n", r);
check_errno(); printf("dectoasc with len == -1: r: %d\n", r);
r = dectoasc(decarr[3], buf, 0, -1);
check_errno();
printf("dectoasc with len == 0: r: %d\n", r);
check_errno(); printf("dectoasc with len == 0: r: %d\n", r);
for (i = 0; i < count; i++)
{
for (j = 0; j < count; j++)
{
decimal a,
s,
m,
d;
decimal a, s, m, d;
int c;
c = deccmp(decarr[i], decarr[j]);
printf("dec[c,%d,%d]: %d\n", i, j, c);

View File

@ -28,8 +28,7 @@ date_test_strdate(char *input)
{
static int i;
date d;
int r,
q;
int r, q;
char dbuf[11];
r = rstrdate(input, &d);
@ -55,8 +54,7 @@ date_test_defmt(char *fmt, char *input)
static int i;
char dbuf[11];
date d;
int q,
r;
int q, r;
r = rdefmtdate(&d, fmt, input);
printf("r: %d ", r);

View File

@ -30,8 +30,7 @@ test_null(int type, char *ptr)
printf("null: %d\n", risnull(type, ptr));
}
int
main(void)
int main(void)
{
#line 15 "rnull.pgc"
@ -99,37 +98,27 @@ main(void)
#line 27 "rnull.pgc"
{
ECPGconnect(__LINE__, 1, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 1, "regress1" , NULL,NULL , NULL, 0);
#line 29 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 29 "rnull.pgc"
{
ECPGdo(__LINE__, 1, 0, NULL, "create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 1, 0, NULL, "create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) ", ECPGt_EOIT, ECPGt_EORT);
#line 33 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 33 "rnull.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 34 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 34 "rnull.pgc"
{
ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl ) values( 1 , ? , ? , ? , ? , ? , ? , ? ) ",
{ ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , ? , ? , ? , ? , ? , ? , ? ) ",
ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
@ -146,18 +135,13 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 38 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 38 "rnull.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 39 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 39 "rnull.pgc"
@ -172,8 +156,7 @@ main(void)
rsetnull(CDATETYPE, (char *) &dat);
rsetnull(CDTIMETYPE, (char *) &tmp);
{
ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values( 2 , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ",
{ ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values ( 2 , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ",
ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
@ -196,25 +179,19 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 54 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 54 "rnull.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 55 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 55 "rnull.pgc"
printf("first select\n");
{
ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 ", ECPGt_EOIT,
ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
@ -237,9 +214,7 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 61 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 61 "rnull.pgc"
@ -256,8 +231,7 @@ main(void)
printf("second select\n");
{
ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 ", ECPGt_EOIT,
ECPGt_char,(c),(long)sizeof("abc "),(long)1,(sizeof("abc "))*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
@ -280,9 +254,7 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 78 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 78 "rnull.pgc"
@ -297,32 +269,23 @@ main(void)
test_null(CDATETYPE, (char *) &dat);
test_null(CDTIMETYPE, (char *) &tmp);
{
ECPGdo(__LINE__, 1, 0, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 1, 0, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 91 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 91 "rnull.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 92 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 92 "rnull.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 94 "rnull.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 94 "rnull.pgc"

View File

@ -25,14 +25,11 @@
static void openit(void);
static void
dosqlprint(void)
{
static void dosqlprint(void) {
printf("doSQLprint: Error: %s\n", sqlca.sqlerrm.sqlerrmc);
}
int
main(void)
int main(void)
{
#line 14 "test_informix.pgc"
@ -42,9 +39,7 @@ main(void)
#line 15 "test_informix.pgc"
decimal j,
m,
n;
decimal j , m , n ;
#line 15 "test_informix.pgc"
@ -54,138 +49,98 @@ main(void)
#line 18 "test_informix.pgc"
{
ECPGconnect(__LINE__, 1, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 1, "regress1" , NULL,NULL , NULL, 0);
#line 20 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#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 23 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 23 "test_informix.pgc"
/* this INSERT works */
rsetnull(CDECIMALTYPE, (char *)&j);
{
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_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 27 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 27 "test_informix.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 28 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 28 "test_informix.pgc"
/* 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 31 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 31 "test_informix.pgc"
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 33 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#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_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 35 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 35 "test_informix.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 36 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 36 "test_informix.pgc"
/* 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 39 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 39 "test_informix.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 40 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 40 "test_informix.pgc"
/* this however should be ok */
{
ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test order by i limit 1 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test order by i limit 1 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 43 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 43 "test_informix.pgc"
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 45 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 45 "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 <= ? */
#line 47 "test_informix.pgc"
@ -195,23 +150,18 @@ main(void)
while (1)
{
{
ECPGdo(__LINE__, 1, 1, NULL, "fetch forward from c", ECPGt_EOIT,
{ ECPGdo(__LINE__, 1, 1, NULL, "fetch forward from c", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 54 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 54 "test_informix.pgc"
if (sqlca.sqlcode == 100)
break;
else if (sqlca.sqlcode != 0)
printf("Error: %ld\n", sqlca.sqlcode);
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);
@ -227,94 +177,70 @@ main(void)
deccvint(7, &j);
deccvint(14, &m);
decadd(&j, &m, &n);
{
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_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 72 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 72 "test_informix.pgc"
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 75 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 75 "test_informix.pgc"
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 78 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 78 "test_informix.pgc"
printf("Does not exist: %ld\n", sqlca.sqlcode);
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 81 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 81 "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 82 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 82 "test_informix.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 83 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 83 "test_informix.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 85 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 85 "test_informix.pgc"
return 0;
}
static void
openit(void)
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_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 92 "test_informix.pgc"
if (sqlca.sqlcode < 0)
dosqlprint();
}
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 92 "test_informix.pgc"
}

View File

@ -79,6 +79,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 5 "test_informix2.pgc"
@ -96,8 +97,7 @@ struct sqlca_t *ECPGget_sqlca(void);
/* Check SQLCODE, and produce a "standard error" if it's wrong! */
static void
sql_check(char *fn, char *caller, int ignore)
static void sql_check(char *fn, char *caller, int ignore)
{
char errorstring[255];
@ -114,18 +114,14 @@ sql_check(char *fn, char *caller, int ignore)
printf("%s\n", errorstring);
/* attempt a ROLLBACK */
{
ECPGtrans(__LINE__, NULL, "rollback");
}
{ ECPGtrans(__LINE__, NULL, "rollback");}
#line 27 "test_informix2.pgc"
if (SQLCODE == 0)
{
sprintf(errorstring, "Rollback successful.\n");
}
else
{
} else {
sprintf(errorstring, "Rollback failed with code %ld.\n", SQLCODE);
}
@ -139,8 +135,7 @@ sql_check(char *fn, char *caller, int ignore)
int
main(void)
int main(void)
{
/* exec sql begin declare section */
@ -163,7 +158,6 @@ main(void)
#line 53 "test_informix2.pgc"
char dbname [ 30 ] ;
/* exec sql end declare section */
#line 54 "test_informix2.pgc"
@ -177,64 +171,48 @@ main(void)
ECPGdebug(1, stderr);
strcpy(dbname, "regress1");
{
ECPGconnect(__LINE__, 1, dbname, NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 1, dbname , NULL,NULL , NULL, 0);
#line 63 "test_informix2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 63 "test_informix2.pgc"
sql_check("main", "connect", 0);
{
ECPGdo(__LINE__, 1, 1, NULL, "set DateStyle to 'DMY'", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 1, 1, NULL, "set DateStyle to 'DMY'", ECPGt_EOIT, ECPGt_EORT);
#line 66 "test_informix2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 66 "test_informix2.pgc"
{
ECPGdo(__LINE__, 1, 1, NULL, "create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 1, 1, NULL, "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"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 68 "test_informix2.pgc"
sql_check("main", "create", 0);
{
ECPGdo(__LINE__, 1, 1, NULL, "insert into history ( customerid , timestamp , action_taken , narrative ) values( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 1, 1, NULL, "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"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 73 "test_informix2.pgc"
sql_check("main", "insert", 0);
{
ECPGdo(__LINE__, 1, 1, NULL, "select max ( timestamp ) from history ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 1, 1, NULL, "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"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 78 "test_informix2.pgc"
sql_check("main", "select max", 100);
{
ECPGdo(__LINE__, 1, 1, NULL, "select customerid , timestamp from history where timestamp = ? limit 1 ",
{ ECPGdo(__LINE__, 1, 1, NULL, "select customerid , timestamp from history where timestamp = ? limit 1 ",
ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_int,&(c),(long)1,(long)1,sizeof(int),
@ -243,9 +221,7 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 85 "test_informix2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 85 "test_informix2.pgc"
sql_check("main", "select", 0);
@ -257,59 +233,44 @@ main(void)
c++;
{
ECPGdo(__LINE__, 1, 1, NULL, "insert into history ( customerid , timestamp , action_taken , narrative ) values( ? , ? , 'test' , 'test' ) ",
{ ECPGdo(__LINE__, 1, 1, NULL, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( ? , ? , 'test' , 'test' ) ",
ECPGt_int,&(c),(long)1,(long)1,sizeof(int),
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"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 97 "test_informix2.pgc"
sql_check("main", "update", 0);
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 100 "test_informix2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 100 "test_informix2.pgc"
{
ECPGdo(__LINE__, 1, 1, NULL, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 1, 1, NULL, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
#line 102 "test_informix2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 102 "test_informix2.pgc"
sql_check("main", "drop", 0);
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 105 "test_informix2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 105 "test_informix2.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 107 "test_informix2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 107 "test_informix2.pgc"
sql_check("main", "disconnect", 0);

View File

@ -33,176 +33,117 @@ main(void)
#line 17 "test1.pgc"
char pw [ 200 ] ;
/* exec sql end declare section */
#line 18 "test1.pgc"
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 22 "test1.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
#line 23 "test1.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 24 "test1.pgc"
/* <-- "main" not specified */
{
ECPGconnect(__LINE__, 0, "connectdb@localhost", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb@localhost" , NULL,NULL , "main", 0); }
#line 26 "test1.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 27 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "@localhost", "connectdb", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "@localhost" , "connectdb" , NULL , "main", 0); }
#line 29 "test1.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 30 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb@localhost:55432", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb@localhost:55432" , NULL,NULL , "main", 0); }
#line 32 "test1.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 33 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "@localhost:55432", "connectdb", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "@localhost:55432" , "connectdb" , NULL , "main", 0); }
#line 35 "test1.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 36 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb:55432", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb:55432" , NULL,NULL , "main", 0); }
#line 38 "test1.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 39 "test1.pgc"
{
ECPGconnect(__LINE__, 0, ":55432", "connectdb", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, ":55432" , "connectdb" , NULL , "main", 0); }
#line 41 "test1.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 42 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/connectdb", "connectuser", "connectpw", NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
#line 44 "test1.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 45 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/", "connectdb", NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/" , "connectdb" , NULL , NULL, 0); }
#line 47 "test1.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 48 "test1.pgc"
strcpy(pw, "connectpw");
strcpy(db, "tcp:postgresql://localhost:55432/connectdb");
{
ECPGconnect(__LINE__, 0, db, "connectuser", pw, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, db , "connectuser" , pw , NULL, 0); }
#line 52 "test1.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 53 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb", "connectuser", "connectpw", NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
#line 55 "test1.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 56 "test1.pgc"
{
ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb", "connectuser", NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , NULL , NULL, 0); }
#line 58 "test1.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 59 "test1.pgc"
/* wrong db */
{
ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/nonexistant", "connectuser", "connectpw", NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/nonexistant" , "connectuser" , "connectpw" , NULL, 0); }
#line 62 "test1.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 63 "test1.pgc"
/* wrong port */
{
ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:20/connectdb", "connectuser", "connectpw", NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:20/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
#line 66 "test1.pgc"
/* no disconnect necessary */
/* wrong password */
{
ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb", "connectuser", "wrongpw", NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "wrongpw" , NULL, 0); }
#line 70 "test1.pgc"
/* no disconnect necessary */

View File

@ -40,7 +40,6 @@ main(void)
#line 18 "test2.pgc"
char res [ 200 ] ;
/* exec sql end declare section */
#line 19 "test2.pgc"
@ -48,78 +47,56 @@ main(void)
ECPGdebug(1, stderr);
strcpy(id, "first");
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, id, 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , id, 0); }
#line 24 "test2.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, "second", 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "second", 0); }
#line 25 "test2.pgc"
/* this selects from "second" which was opened last */
{
ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 28 "test2.pgc"
{
ECPGdo(__LINE__, 0, 1, "first", "select current_database () ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, "first", "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 29 "test2.pgc"
{
ECPGdo(__LINE__, 0, 1, "second", "select current_database () ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, "second", "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "test2.pgc"
{
ECPGsetconn(__LINE__, "first");
}
{ ECPGsetconn(__LINE__, "first");}
#line 32 "test2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 33 "test2.pgc"
/* this will disconnect from "first" */
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 36 "test2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 37 "test2.pgc"
/* error here since "first" is already disconnected */
{
ECPGdisconnect(__LINE__, id);
}
{ ECPGdisconnect(__LINE__, id);}
#line 40 "test2.pgc"
/* disconnect from "second" */
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 43 "test2.pgc"

View File

@ -39,7 +39,6 @@ main(void)
#line 17 "test3.pgc"
char res [ 200 ] ;
/* exec sql end declare section */
#line 18 "test3.pgc"
@ -47,81 +46,58 @@ main(void)
ECPGdebug(1, stderr);
strcpy(id, "first");
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, id, 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , id, 0); }
#line 23 "test3.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, "second", 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "second", 0); }
#line 24 "test3.pgc"
/* this selects from "second" which was opened last */
{
ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 27 "test3.pgc"
/* will close "second" */
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 30 "test3.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select current_database () ", ECPGt_EOIT,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 31 "test3.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, "second", 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "second", 0); }
#line 33 "test3.pgc"
/* will close "second" */
{
ECPGdisconnect(__LINE__, "DEFAULT");
}
{ ECPGdisconnect(__LINE__, "DEFAULT");}
#line 35 "test3.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "second", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "second", 0); }
#line 37 "test3.pgc"
{
ECPGdisconnect(__LINE__, "ALL");
}
{ ECPGdisconnect(__LINE__, "ALL");}
#line 38 "test3.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 40 "test3.pgc"
{
ECPGdisconnect(__LINE__, "DEFAULT");
}
{ ECPGdisconnect(__LINE__, "DEFAULT");}
#line 41 "test3.pgc"
{
ECPGdisconnect(__LINE__, "ALL");
}
{ ECPGdisconnect(__LINE__, "ALL");}
#line 42 "test3.pgc"
/*
* exec sql disconnect; exec sql disconnect name;
* exec sql disconnect;
* exec sql disconnect name;
*
* are used in other tests
*/

View File

@ -28,21 +28,15 @@ main(void)
{
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "main", 0); }
#line 13 "test4.pgc"
{
ECPGsetconn(__LINE__, "main");
}
{ ECPGsetconn(__LINE__, "main");}
#line 15 "test4.pgc"
{
ECPGdisconnect(__LINE__, "DEFAULT");
}
{ ECPGdisconnect(__LINE__, "DEFAULT");}
#line 17 "test4.pgc"

View File

@ -30,173 +30,114 @@ main(void)
#line 17 "test5.pgc"
char id [ 200 ] ;
/* exec sql end declare section */
#line 18 "test5.pgc"
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 22 "test5.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
#line 23 "test5.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 24 "test5.pgc"
/* <-- "main" not specified */
strcpy(db, "connectdb");
strcpy(id, "main");
{
ECPGconnect(__LINE__, 0, db, NULL, NULL, id, 0);
}
{ ECPGconnect(__LINE__, 0, db , NULL,NULL , id, 0); }
#line 28 "test5.pgc"
{
ECPGdisconnect(__LINE__, id);
}
{ ECPGdisconnect(__LINE__, id);}
#line 29 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 31 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 32 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 34 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 35 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 37 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 38 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "", "connectdb", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "" , "connectdb" , NULL , "main", 0); }
#line 40 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 41 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb", "connectuser", "connectdb", "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , "connectuser" , "connectdb" , "main", 0); }
#line 43 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 44 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb", "connectuser", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb" , "connectuser" , NULL , "main", 0); }
#line 46 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 47 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb", "connectuser", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb" , "connectuser" , NULL , "main", 0); }
#line 49 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 50 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb", "connectuser", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb" , "connectuser" , NULL , "main", 0); }
#line 52 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 53 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/connectdb", "connectuser", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/connectdb" , "connectuser" , NULL , "main", 0); }
#line 55 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 56 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/", "connectdb", NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "connectdb" , NULL , "main", 0); }
#line 58 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 59 "test5.pgc"
/* connect twice */
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 62 "test5.pgc"
{
ECPGconnect(__LINE__, 0, "connectdb", NULL, NULL, "main", 0);
}
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 63 "test5.pgc"
{
ECPGdisconnect(__LINE__, "main");
}
{ ECPGdisconnect(__LINE__, "main");}
#line 64 "test5.pgc"
/* not connected */
{
ECPGdisconnect(__LINE__, "nonexistant");
}
{ ECPGdisconnect(__LINE__, "nonexistant");}
#line 67 "test5.pgc"

View File

@ -41,20 +41,16 @@ main(void)
timestamp ts1 ;
#line 16 "dt_test.pgc"
interval *iv1,
iv2;
interval * iv1 , iv2 ;
#line 17 "dt_test.pgc"
char * text ;
/* exec sql end declare section */
#line 18 "dt_test.pgc"
date date2;
int mdy[3] = { 4, 19, 1998 };
char *fmt,
*out,
*in;
char *fmt, *out, *in;
char *d1 = "Mon Jan 17 1966";
char *t1 = "2000-7-12 17:34:29";
int i;
@ -63,53 +59,40 @@ main(void)
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 27 "dt_test.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 28 "dt_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 28 "dt_test.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table date_test ( d date , ts timestamp ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table date_test ( d date , ts timestamp ) ", ECPGt_EOIT, ECPGt_EORT);
#line 29 "dt_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 29 "dt_test.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
#line 30 "dt_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 30 "dt_test.pgc"
date1 = PGTYPESdate_from_asc(d1, NULL);
ts1 = PGTYPEStimestamp_from_asc(t1, NULL);
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into date_test ( d , ts ) values( ? , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into date_test ( d , ts ) values ( ? , ? ) ",
ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_timestamp,&(ts1),(long)1,(long)1,sizeof(timestamp),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 35 "dt_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 35 "dt_test.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from date_test where d = ? ",
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from date_test where d = ? ",
ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
@ -118,26 +101,21 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 37 "dt_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 37 "dt_test.pgc"
text = PGTYPESdate_to_asc(date1);
printf ("Date: %s\n", text);
free(text);
text = PGTYPEStimestamp_to_asc(ts1);
printf ("timestamp: %s\n", text);
free(text);
iv1 = PGTYPESinterval_from_asc("13556 days 12 hours 34 minutes 14 seconds ", NULL);
PGTYPESinterval_copy(iv1, &iv2);
text = PGTYPESinterval_to_asc(&iv2);
printf ("interval: %s\n", text);
free(text);
@ -153,7 +131,6 @@ main(void)
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
out = (char*) malloc(strlen(fmt) + 1);
date1 = PGTYPESdate_from_timestamp(ts1);
@ -165,154 +142,115 @@ main(void)
/* rdate_defmt_asc() */
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "yy/mm/dd";
in = "In the year 1995, the month of December, it is the 25th day";
/*
* 0123456789012345678901234567890123456789012345678901234567890 0
* 1 2 3 4 5 6
/* 0123456789012345678901234567890123456789012345678901234567890
* 0 1 2 3 4 5 6
*/
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc1: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "mmmm. dd. yyyy";
in = "12/25/95";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc2: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "yy/mm/dd";
in = "95/12/25";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc3: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "yy/mm/dd";
in = "1995, December 25th";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc4: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "dd-mm-yy";
in = "This is 25th day of December, 1995";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc5: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "mmddyy";
in = "Dec. 25th, 1995";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc6: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "mmm. dd. yyyy";
in = "dec 25th 1995";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc7: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "mmm. dd. yyyy";
in = "DEC-25-1995";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc8: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "mm yy dd.";
in = "12199525";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc9: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "yyyy fierj mm dd.";
in = "19951225";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc10: %s\n", text);
free(text);
date1 = 0;
text = "";
date1 = 0; text = "";
fmt = "mm/dd/yy";
in = "122595";
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc12: %s\n", text);
free(text);
PGTYPEStimestamp_current(&ts1);
text = PGTYPEStimestamp_to_asc(ts1);
/* can't output this in regression mode */
/* printf("timestamp_current: Now: %s\n", text); */
free(text);
ts1 = PGTYPEStimestamp_from_asc("96-02-29", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_to_asc1: %s\n", text);
free(text);
ts1 = PGTYPEStimestamp_from_asc("1994-02-11 3:10:35", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_to_asc2: %s\n", text);
free(text);
ts1 = PGTYPEStimestamp_from_asc("1994-02-11 26:10:35", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_to_asc3: %s\n", text);
free(text);
@ -328,7 +266,6 @@ main(void)
in = "This is a 4/12/80 3-39l12test";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -336,7 +273,6 @@ main(void)
in = "Tue Jul 22 17:28:44 +0200 2003";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -344,7 +280,6 @@ main(void)
in = "Tue Feb 29 17:28:44 +0200 2000";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -352,7 +287,6 @@ main(void)
in = "Tue Feb 29 17:28:44 +0200 1900";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
free(text);
@ -360,7 +294,6 @@ main(void)
in = "Tue Feb 29 17:28:44 +0200 1996";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -368,7 +301,6 @@ main(void)
in = " Jul 31 17:28:44 +0200 1996";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -376,7 +308,6 @@ main(void)
in = " Jul 32 17:28:44 +0200 1996";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
free(text);
@ -384,7 +315,6 @@ main(void)
in = "Tue Feb 29 17:28:44 +0200 1997";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
free(text);
@ -392,7 +322,6 @@ main(void)
in = "Tue Jul 22 17:28:44 +0200 2003";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
free(text);
@ -400,7 +329,6 @@ main(void)
in = "Tue Jul 22 17:28:44 +0200 2003";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
free(text);
@ -408,7 +336,6 @@ main(void)
in = " Jul, 22 17_28 `44 +0200 2003 ";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -416,7 +343,6 @@ main(void)
in = "Tue Jul %22 17:28:44 CEST 2003";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -424,7 +350,6 @@ main(void)
in = "Tue Jul %22 17:28:44 CEST 2003";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -432,7 +357,6 @@ main(void)
in = "abc\n 19 October %22 17:28:44 CEST 2003";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -440,7 +364,6 @@ main(void)
in = "abc\n 18 October %34 17:28:44 CEST 80";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
free(text);
@ -448,7 +371,6 @@ main(void)
in = "abc\n 18 October %34 17:28:44 CEST 80";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
free(text);
@ -456,7 +378,6 @@ main(void)
in = "1980-04-12 3:49:44 ";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, NULL) = %s, error: %d\n", in, text, i);
free(text);
@ -464,7 +385,6 @@ main(void)
in = "July 14, 1988. Time: 9:15am";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -472,7 +392,6 @@ main(void)
fmt = "%B %d at %I:%M %p in the year %Y";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -480,7 +399,6 @@ main(void)
fmt = "%Y, %B %d. Time: %I:%M %p";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -488,7 +406,6 @@ main(void)
fmt = "%Y, %B %d. Time: %I:%M%p";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
@ -496,28 +413,22 @@ main(void)
fmt = "%Y, %P %B %d. Time: %I:%M";
i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
free(text);
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 350 "dt_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 350 "dt_test.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 351 "dt_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 351 "dt_test.pgc"
return (0);
}

View File

@ -76,8 +76,7 @@ main(void)
date date1 ;
#line 52 "dt_test2.pgc"
timestamp ts1,
ts2;
timestamp ts1 , ts2 ;
#line 53 "dt_test2.pgc"
char * text ;
@ -87,13 +86,11 @@ main(void)
#line 55 "dt_test2.pgc"
date * dc ;
/* exec sql end declare section */
#line 56 "dt_test2.pgc"
int i,
j;
int i, j;
char *endptr;
ECPGdebug(1, stderr);
@ -108,7 +105,6 @@ main(void)
dc = PGTYPESdate_new();
*dc = date1;
text = PGTYPESdate_to_asc(*dc);
printf("Date of timestamp: %s\n", text);
free(text);
PGTYPESdate_free(dc);
@ -116,14 +112,11 @@ main(void)
for (i = 0; dates[i]; i++)
{
bool err = false;
date1 = PGTYPESdate_from_asc(dates[i], &endptr);
if (date1 == INT_MIN)
{
if (date1 == INT_MIN) {
err = true;
}
text = PGTYPESdate_to_asc(date1);
printf("Date[%d]: %s (%c - %c)\n",
i, err ? "-" : text,
endptr ? 'N' : 'Y',
@ -138,13 +131,10 @@ main(void)
+ strlen(times[j])
+ 1;
char* t = malloc(length);
sprintf(t, "%s %s", dates[i], times[j]);
ts1 = PGTYPEStimestamp_from_asc(t, NULL);
text = PGTYPEStimestamp_to_asc(ts1);
if (i != 19 || j != 3) /* timestamp as integer or double
* differ for this case */
if (i != 19 || j != 3) /* timestamp as integer or double differ for this case */
printf("TS[%d,%d]: %s\n",
i, j, errno ? "-" : text);
free(text);
@ -157,7 +147,6 @@ main(void)
for (i = 0; intervals[i]; i++)
{
interval *ic;
i1 = PGTYPESinterval_from_asc(intervals[i], &endptr);
if (*endptr)
printf("endptr set to %s\n", endptr);
@ -170,14 +159,12 @@ main(void)
if (j < 0)
continue;
text = PGTYPESinterval_to_asc(i1);
printf("interval[%d]: %s\n", i, text ? text : "-");
free(text);
ic = PGTYPESinterval_new();
PGTYPESinterval_copy(i1, ic);
text = PGTYPESinterval_to_asc(i1);
printf("interval_copy[%d]: %s\n", i, text ? text : "-");
free(text);
PGTYPESinterval_free(ic);
@ -185,3 +172,4 @@ main(void)
return (0);
}

View File

@ -35,23 +35,18 @@ int
main(void)
{
char *text="error\n";
numeric *value1,
*value2,
*res;
numeric *value1, *value2, *res;
/* exec sql begin declare section */
/* = {0, 0, 0, 0, 0, NULL, NULL} ; */
#line 22 "num_test.pgc"
numeric * des ;
/* exec sql end declare section */
#line 24 "num_test.pgc"
double d;
long l1,
l2;
long l1, l2;
int i;
ECPGdebug(1, stderr);
@ -59,39 +54,29 @@ main(void)
#line 30 "num_test.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 32 "num_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 32 "num_test.pgc"
{
ECPGsetcommit(__LINE__, "off", NULL);
{ ECPGsetcommit(__LINE__, "off", NULL);
#line 34 "num_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 34 "num_test.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 35 "num_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 35 "num_test.pgc"
value1 = PGTYPESnumeric_new();
PGTYPESnumeric_from_int(1407, value1);
text = PGTYPESnumeric_to_asc(value1, -1);
printf("from int = %s\n", text);
free(text);
PGTYPESnumeric_free(value1);
@ -101,28 +86,23 @@ main(void)
res = PGTYPESnumeric_new();
PGTYPESnumeric_add(value1, value2, res);
text = PGTYPESnumeric_to_asc(res, -1);
printf("add = %s\n", text);
free(text);
PGTYPESnumeric_sub(res, value2, res);
text = PGTYPESnumeric_to_asc(res, -1);
printf("sub = %s\n", text);
free(text);
PGTYPESnumeric_free(value2);
des = PGTYPESnumeric_new();
PGTYPESnumeric_copy(res, des);
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( text , num ) values( 'test' , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( text , num ) values ( 'test' , ? ) ",
ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 60 "num_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 60 "num_test.pgc"
@ -130,21 +110,17 @@ main(void)
PGTYPESnumeric_mul(value1, value2, res);
PGTYPESnumeric_free(value2);
{
ECPGdo(__LINE__, 0, 1, NULL, "select num from test where text = 'test' ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select num from test where text = 'test' ", ECPGt_EOIT,
ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 66 "num_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 66 "num_test.pgc"
PGTYPESnumeric_mul(res, des, res);
text = PGTYPESnumeric_to_asc(res, -1);
printf("mul = %s\n", text);
free(text);
PGTYPESnumeric_free(des);
@ -152,7 +128,6 @@ main(void)
value2 = PGTYPESnumeric_from_asc("10000", NULL);
PGTYPESnumeric_div(res, value2, res);
text = PGTYPESnumeric_to_asc(res, -1);
PGTYPESnumeric_to_double(res, &d);
printf("div = %s %e\n", text, d);
@ -166,24 +141,19 @@ main(void)
PGTYPESnumeric_free(value2);
PGTYPESnumeric_free(res);
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 90 "num_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 90 "num_test.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 91 "num_test.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 91 "num_test.pgc"
return (0);
}

View File

@ -35,9 +35,10 @@ NOTE: This file has a different expect file for regression tests on MinGW32
char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4",
"2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4",
".500001", "-.5000001",
"1234567890123456789012345678.91", /* 30 digits should fit into decimal */
"1234567890123456789012345678.921", /* 31 digits should NOT fit into
* decimal */
"1234567890123456789012345678.91", /* 30 digits should fit
into decimal */
"1234567890123456789012345678.921", /* 31 digits should NOT
fit into decimal */
"not a number",
NULL};
@ -50,16 +51,10 @@ main(void)
{
char *text="error\n";
char *endptr;
numeric *num,
*nin;
numeric *num, *nin;
decimal *dec;
long l;
int i,
j,
k,
q,
r,
count = 0;
int i, j, k, q, r, count = 0;
double d;
numeric **numarr = (numeric **) calloc(1, sizeof(numeric));
@ -68,113 +63,81 @@ main(void)
for (i = 0; nums[i]; i++)
{
num = PGTYPESnumeric_from_asc(nums[i], &endptr);
if (!num)
check_errno();
if (!num) check_errno();
if (endptr != NULL)
{
printf("endptr of %d is not NULL\n", i);
if (*endptr != '\0')
printf("*endptr of %d is not \\0\n", i);
}
if (!num)
continue;
if (!num) continue;
numarr = realloc(numarr, sizeof(numeric *) * (count + 1));
numarr[count++] = num;
text = PGTYPESnumeric_to_asc(num, -1);
if (!text)
check_errno();
printf("num[%d,1]: %s\n", i, text);
free(text);
if (!text) check_errno();
printf("num[%d,1]: %s\n", i, text); free(text);
text = PGTYPESnumeric_to_asc(num, 0);
if (!text)
check_errno();
printf("num[%d,2]: %s\n", i, text);
free(text);
if (!text) check_errno();
printf("num[%d,2]: %s\n", i, text); free(text);
text = PGTYPESnumeric_to_asc(num, 1);
if (!text)
check_errno();
printf("num[%d,3]: %s\n", i, text);
free(text);
if (!text) check_errno();
printf("num[%d,3]: %s\n", i, text); free(text);
text = PGTYPESnumeric_to_asc(num, 2);
if (!text)
check_errno();
printf("num[%d,4]: %s\n", i, text);
free(text);
if (!text) check_errno();
printf("num[%d,4]: %s\n", i, text); free(text);
nin = PGTYPESnumeric_new();
text = PGTYPESnumeric_to_asc(nin, 2);
if (!text)
check_errno();
printf("num[%d,5]: %s\n", i, text);
free(text);
if (!text) check_errno();
printf("num[%d,5]: %s\n", i, text); free(text);
r = PGTYPESnumeric_to_long(num, &l);
if (r)
check_errno();
if (r) check_errno();
printf("num[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
if (r == 0)
{
r = PGTYPESnumeric_from_long(l, nin);
if (r)
check_errno();
if (r) check_errno();
text = PGTYPESnumeric_to_asc(nin, 2);
q = PGTYPESnumeric_cmp(num, nin);
printf("num[%d,7]: %s (r: %d - cmp: %d)\n", i, text, r, q);
free(text);
}
r = PGTYPESnumeric_to_int(num, &k);
if (r)
check_errno();
if (r) check_errno();
printf("num[%d,8]: %d (r: %d)\n", i, r?0:k, r);
if (r == 0)
{
r = PGTYPESnumeric_from_int(k, nin);
if (r)
check_errno();
if (r) check_errno();
text = PGTYPESnumeric_to_asc(nin, 2);
q = PGTYPESnumeric_cmp(num, nin);
printf("num[%d,9]: %s (r: %d - cmp: %d)\n", i, text, r, q);
free(text);
}
r = PGTYPESnumeric_to_double(num, &d);
if (r)
check_errno();
if (r) check_errno();
printf("num[%d,10]: %g (r: %d)\n", i, r?0.0:d, r);
/*
* do not test double to numeric because - extra digits are different
* on different architectures - PGTYPESnumeric_from_double internally
* calls PGTYPESnumeric_from_asc anyway
/* do not test double to numeric because
* - extra digits are different on different architectures
* - PGTYPESnumeric_from_double internally calls PGTYPESnumeric_from_asc anyway
*/
dec = PGTYPESdecimal_new();
r = PGTYPESnumeric_to_decimal(num, dec);
if (r)
check_errno();
/*
* we have no special routine for outputting decimal, it would convert
* to a numeric anyway
*/
if (r) check_errno();
/* we have no special routine for outputting decimal, it would
* convert to a numeric anyway */
printf("num[%d,11]: - (r: %d)\n", i, r);
if (r == 0)
{
r = PGTYPESnumeric_from_decimal(dec, nin);
if (r)
check_errno();
if (r) check_errno();
text = PGTYPESnumeric_to_asc(nin, 2);
q = PGTYPESnumeric_cmp(num, nin);
printf("num[%d,12]: %s (r: %d - cmp: %d)\n", i, text, r, q);
free(text);
@ -193,7 +156,6 @@ main(void)
numeric* s = PGTYPESnumeric_new();
numeric* m = PGTYPESnumeric_new();
numeric* d = PGTYPESnumeric_new();
r = PGTYPESnumeric_add(numarr[i], numarr[j], a);
if (r)
{
@ -203,7 +165,6 @@ main(void)
else
{
text = PGTYPESnumeric_to_asc(a, 10);
printf("num[a,%d,%d]: %s\n", i, j, text);
free(text);
}
@ -216,7 +177,6 @@ main(void)
else
{
text = PGTYPESnumeric_to_asc(s, 10);
printf("num[s,%d,%d]: %s\n", i, j, text);
free(text);
}
@ -229,7 +189,6 @@ main(void)
else
{
text = PGTYPESnumeric_to_asc(m, 10);
printf("num[m,%d,%d]: %s\n", i, j, text);
free(text);
}
@ -242,7 +201,6 @@ main(void)
else
{
text = PGTYPESnumeric_to_asc(d, 10);
printf("num[d,%d,%d]: %s\n", i, j, text);
free(text);
}
@ -252,7 +210,6 @@ main(void)
for (i = 0; i < count; i++)
{
text = PGTYPESnumeric_to_asc(numarr[i], -1);
printf("%d: %s\n", i, text);
free(text);
}

View File

@ -21,28 +21,23 @@
/* just a test comment */ int i;
/* just a test comment int j*/;
/****************************************************************************/
/* Test comment */
/*--------------------------------------------------------------------------*/
int
main(void)
int main(void)
{
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 17 "comment.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 19 "comment.pgc"
exit (0);
}

View File

@ -61,74 +61,55 @@ main(void)
#line 26 "define.pgc"
int not_used ;
#endif
/* exec sql end declare section */
#line 29 "define.pgc"
int i,
j;
int i,j;
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 34 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 34 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 36 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "define.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 37 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 39 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 40 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "define.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 41 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
ECPGt_char,(name),(long)8,(long)6,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(amount),(long)1,(long)6,sizeof(int),
@ -137,9 +118,7 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 43 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 43 "define.pgc"
@ -150,12 +129,10 @@ main(void)
#line 48 "define.pgc"
char n[8],
l = letter[i][0];
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
#line 49 "define.pgc"
int a = amount [ i ] ;
/* exec sql end declare section */
#line 50 "define.pgc"
@ -164,31 +141,22 @@ main(void)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 56 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 56 "define.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 57 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 57 "define.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 58 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 58 "define.pgc"

View File

@ -73,22 +73,16 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 1 "init.pgc"
enum e
{
ENUM0, ENUM1
};
struct sa
{
int member;
};
enum e { ENUM0, ENUM1 };
struct sa { int member; };
static int
fa(void)
static int fa(void)
{
printf("in fa\n");
return 2;
@ -108,22 +102,19 @@ fc(const char *x)
return *x;
}
static int
fd(const char *x, int i)
static int fd(const char *x,int i)
{
printf("in fd (%s, %d)\n", x, i);
return (*x)*i;
}
static int
fe(enum e x)
static int fe(enum e x)
{
printf("in fe (%d)\n", (int) x);
return (int)x;
}
static void
sqlnotice(char *notice, short trans)
static void sqlnotice(char *notice, short trans)
{
if (!notice)
notice = "-empty-";
@ -141,11 +132,9 @@ namespace N
};
#endif
int
main(void)
int main(void)
{
struct sa x = { 14 },*y = &x;
/* exec sql begin declare section */
@ -192,7 +181,6 @@ main(void)
#line 71 "init.pgc"
long iay ;
/* exec sql end declare section */
#line 72 "init.pgc"
@ -205,9 +193,9 @@ main(void)
#line 78 "init.pgc"
int k = N : : i ;
/* exec sql end declare section */
#line 79 "init.pgc"
#endif
ECPGdebug(1, stderr);
@ -218,73 +206,55 @@ main(void)
/* exec sql whenever sqlerror do fa ( ) ; */
#line 87 "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 88 "init.pgc"
if (sqlca.sqlcode < 0)
fa();
}
if (sqlca.sqlcode < 0) fa ( );}
#line 88 "init.pgc"
/* exec sql whenever sqlerror do fb ( 20 ) ; */
#line 89 "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 90 "init.pgc"
if (sqlca.sqlcode < 0)
fb(20);
}
if (sqlca.sqlcode < 0) fb ( 20 );}
#line 90 "init.pgc"
/* exec sql whenever sqlerror do fc ( \"50\" ) ; */
#line 91 "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 92 "init.pgc"
if (sqlca.sqlcode < 0)
fc("50");
}
if (sqlca.sqlcode < 0) fc ( "50" );}
#line 92 "init.pgc"
/* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */
#line 93 "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 94 "init.pgc"
if (sqlca.sqlcode < 0)
fd("50", 1);
}
if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
#line 94 "init.pgc"
/* exec sql whenever sqlerror do fe ( ENUM0 ) ; */
#line 95 "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 96 "init.pgc"
if (sqlca.sqlcode < 0)
fe(ENUM0);
}
if (sqlca.sqlcode < 0) fe ( ENUM0 );}
#line 96 "init.pgc"
/* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */
#line 97 "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 98 "init.pgc"
if (sqlca.sqlcode < 0)
sqlnotice(NULL, 0);
}
if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
#line 98 "init.pgc"
return 0;

View File

@ -57,8 +57,7 @@ typedef char *c;
struct TBempl
{
struct TBempl {
#line 19 "type.pgc"
mmInteger idnum ;
@ -68,7 +67,6 @@ struct TBempl
#line 21 "type.pgc"
mmSmallInt accs ;
} ;/* exec sql end declare section */
#line 23 "type.pgc"
@ -95,15 +93,13 @@ main(void)
c ptr = NULL ;
#line 36 "type.pgc"
struct varchar_vc
{
struct varchar_vc {
#line 34 "type.pgc"
int len ;
#line 35 "type.pgc"
char text [ 10 ] ;
} vc ;
/* exec sql end declare section */
#line 37 "type.pgc"
@ -114,9 +110,7 @@ main(void)
ECPGdebug (1, stderr);
empl.idnum = 1;
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 43 "type.pgc"
if (sqlca.sqlcode)
@ -125,9 +119,7 @@ main(void)
exit (sqlca.sqlcode);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 51 "type.pgc"
if (sqlca.sqlcode)
@ -136,9 +128,7 @@ main(void)
exit (sqlca.sqlcode);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 58 "type.pgc"
if (sqlca.sqlcode)
@ -147,8 +137,7 @@ main(void)
exit (sqlca.sqlcode);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = ? ",
{ ECPGdo(__LINE__, 0, 1, NULL, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = ? ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
@ -162,8 +151,7 @@ main(void)
ECPGt_char,&(ptr),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_varchar,&(vc),(long)10,(long)1,sizeof(struct varchar_vc),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 68 "type.pgc"
if (sqlca.sqlcode)
@ -173,9 +161,7 @@ main(void)
}
printf ("id=%ld name='%s' accs=%d str='%s' ptr='%s' vc='%10.10s'\n", empl.idnum, empl.name, empl.accs, str, ptr, vc.text);
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 76 "type.pgc"

View File

@ -39,11 +39,7 @@ typedef char *c;
} */
#line 11 "variable.pgc"
typedef union
{
int integer;
short smallint;
} ind;
typedef union { int integer; short smallint; } ind;
#define BUFFERSIZ 8
/* exec sql type str is [ BUFFERSIZ ] */
@ -57,15 +53,13 @@ typedef union
int
main (void)
{
struct birthinfo
{
struct birthinfo {
#line 23 "variable.pgc"
long born ;
#line 23 "variable.pgc"
short age ;
} ;
#line 23 "variable.pgc"
/* exec sql begin declare section */
@ -78,22 +72,16 @@ main(void)
#line 27 "variable.pgc"
struct personal_struct
{
struct personal_struct {
#line 25 "variable.pgc"
struct varchar_name
{
int len;
char arr[BUFFERSIZ];
} name;
struct varchar_name { int len; char arr[ BUFFERSIZ ]; } name ;
#line 26 "variable.pgc"
struct birthinfo birth ;
} personal , * p ;
#line 30 "variable.pgc"
struct personal_indicator
{
struct personal_indicator {
#line 28 "variable.pgc"
int ind_name ;
@ -103,7 +91,6 @@ main(void)
#line 31 "variable.pgc"
ind ind_children ;
/* exec sql end declare section */
#line 32 "variable.pgc"
@ -132,104 +119,74 @@ main(void)
ECPGdebug(1, stderr);
strcpy(msg, "connect");
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 43 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 43 "variable.pgc"
strcpy(msg, "set");
{
ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
#line 46 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 46 "variable.pgc"
strcpy(msg, "create");
{
ECPGdo(__LINE__, 0, 1, NULL, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
#line 49 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 49 "variable.pgc"
strcpy(msg, "insert");
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 52 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 52 "variable.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 53 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 53 "variable.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 1' , 16 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 1' , 16 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 54 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 54 "variable.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 2' , 14 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 2' , 14 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 55 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 55 "variable.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 3' , 9 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 3' , 9 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 56 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 56 "variable.pgc"
strcpy(msg, "commit");
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 59 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 59 "variable.pgc"
strcpy(msg, "open");
{
ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from family ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from family ", ECPGt_EOIT, ECPGt_EORT);
#line 62 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 62 "variable.pgc"
@ -240,11 +197,9 @@ main(void)
p=&personal;
i=&ind_personal;
memset(i, 0, sizeof(ind_personal));
while (1)
{
while (1) {
strcpy(msg, "fetch");
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch cur", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch cur", ECPGt_EOIT,
ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name),
ECPGt_int,&(i->ind_name),(long)1,(long)1,sizeof(int),
ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof(long),
@ -257,13 +212,10 @@ main(void)
ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT);
#line 71 "variable.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND)
break;
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 71 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 71 "variable.pgc"
printf("%8.8s", personal.name.arr);
@ -282,46 +234,34 @@ main(void)
}
strcpy(msg, "close");
{
ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
#line 88 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 88 "variable.pgc"
strcpy(msg, "drop");
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table family ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table family ", ECPGt_EOIT, ECPGt_EORT);
#line 91 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 91 "variable.pgc"
strcpy(msg, "commit");
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 94 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 94 "variable.pgc"
strcpy(msg, "disconnect");
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 97 "variable.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 97 "variable.pgc"

View File

@ -24,28 +24,24 @@
#line 5 "whenever.pgc"
static void
print(char *msg)
static void print(char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
}
static void
print2(void)
static void print2(void)
{
fprintf(stderr, "Found another error\n");
sqlprint();
}
static void
warn(void)
static void warn(void)
{
fprintf(stderr, "Warning: At least one column was truncated\n");
}
int
main(void)
int main(void)
{
#line 26 "whenever.pgc"
@ -62,249 +58,186 @@ main(void)
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 31 "whenever.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 31 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( i int , c char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( i int , c char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 32 "whenever.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 1 , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 1 , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 33 "whenever.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 33 "whenever.pgc"
/* exec sql whenever sql_warning do warn ( ) ; */
#line 35 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(c),(long)6,(long)1,(6)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 36 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 36 "whenever.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "whenever.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 37 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 37 "whenever.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 39 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 39 "whenever.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "whenever.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 40 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 40 "whenever.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "whenever.pgc"
/* exec sql whenever sqlerror do print ( \"select\" ) ; */
#line 42 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 43 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 43 "whenever.pgc"
if (sqlca.sqlcode < 0)
print("select");
}
if (sqlca.sqlcode < 0) print ( "select" );}
#line 43 "whenever.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 44 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 44 "whenever.pgc"
if (sqlca.sqlcode < 0)
print("select");
}
if (sqlca.sqlcode < 0) print ( "select" );}
#line 44 "whenever.pgc"
/* exec sql whenever sqlerror call print2 ( ) ; */
#line 46 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 47 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 47 "whenever.pgc"
if (sqlca.sqlcode < 0)
print2();
}
if (sqlca.sqlcode < 0) print2 ( );}
#line 47 "whenever.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 48 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 48 "whenever.pgc"
if (sqlca.sqlcode < 0)
print2();
}
if (sqlca.sqlcode < 0) print2 ( );}
#line 48 "whenever.pgc"
/* exec sql whenever sqlerror continue ; */
#line 50 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 51 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
}
if (sqlca.sqlwarn[0] == 'W') warn ( );}
#line 51 "whenever.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 52 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
}
if (sqlca.sqlwarn[0] == 'W') warn ( );}
#line 52 "whenever.pgc"
/* exec sql whenever sqlerror goto error ; */
#line 54 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 55 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 55 "whenever.pgc"
if (sqlca.sqlcode < 0)
goto error;
}
if (sqlca.sqlcode < 0) goto error;}
#line 55 "whenever.pgc"
printf("Should not be reachable\n");
error:
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 59 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 59 "whenever.pgc"
if (sqlca.sqlcode < 0)
goto error;
}
if (sqlca.sqlcode < 0) goto error;}
#line 59 "whenever.pgc"
/* exec sql whenever sqlerror stop ; */
#line 61 "whenever.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 62 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 62 "whenever.pgc"
if (sqlca.sqlcode < 0)
exit(1);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 62 "whenever.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 63 "whenever.pgc"
if (sqlca.sqlwarn[0] == 'W')
warn();
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 63 "whenever.pgc"
if (sqlca.sqlcode < 0)
exit(1);
}
if (sqlca.sqlcode < 0) exit (1);}
#line 63 "whenever.pgc"
exit (0);

View File

@ -81,6 +81,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 7 "array.pgc"
@ -124,7 +125,6 @@ main(void)
#line 19 "array.pgc"
double f ;
/* exec sql end declare section */
#line 20 "array.pgc"
@ -134,72 +134,53 @@ main(void)
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 27 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 27 "array.pgc"
{
ECPGsetcommit(__LINE__, "on", NULL);
{ ECPGsetcommit(__LINE__, "on", NULL);
#line 29 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "array.pgc"
{
ECPGtrans(__LINE__, NULL, "begin transaction ");
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 31 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 31 "array.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 33 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 33 "array.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 35 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 35 "array.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 140787.0 , 2 , ? , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 140787.0 , 2 , ? , ? ) ",
ECPGt_int,(a),(long)1,(long)10,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 37 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "array.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 14.07 , ? , ? , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 14.07 , ? , ? , ? ) ",
ECPGt_int,&(did),(long)1,(long)0,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(a),(long)1,(long)10,sizeof(int),
@ -208,51 +189,39 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 39 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "array.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 41 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "array.pgc"
{
ECPGtrans(__LINE__, NULL, "begin transaction ");
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 43 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 43 "array.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select f , text from test where i = 1 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select f , text from test where i = 1 ", ECPGt_EOIT,
ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 48 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 48 "array.pgc"
printf("Found f=%f text=%10.10s\n", f, text);
f=140787;
{
ECPGdo(__LINE__, 0, 1, NULL, "select a , text from test where f = ? ",
{ ECPGdo(__LINE__, 0, 1, NULL, "select a , text from test where f = ? ",
ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_int,(a),(long)1,(long)10,sizeof(int),
@ -261,9 +230,7 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 56 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 56 "array.pgc"
@ -272,49 +239,37 @@ main(void)
printf("Found text=%10.10s\n", t);
{
ECPGdo(__LINE__, 0, 1, NULL, "select a from test where f = ? ",
{ ECPGdo(__LINE__, 0, 1, NULL, "select a from test where f = ? ",
ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 66 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 66 "array.pgc"
printf("Found text=%s\n", text);
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 70 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 70 "array.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 72 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 72 "array.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 74 "array.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 74 "array.pgc"

View File

@ -29,8 +29,7 @@
struct TBempl
{
struct TBempl {
#line 9 "binary.pgc"
long idnum ;
@ -43,7 +42,6 @@ struct TBempl
#line 12 "binary.pgc"
char byte [ 20 ] ;
} ;/* exec sql end declare section */
#line 14 "binary.pgc"
@ -59,7 +57,6 @@ main(void)
#line 21 "binary.pgc"
char * data = "\\001\\155\\000\\212" ;
/* exec sql end declare section */
#line 22 "binary.pgc"
@ -68,9 +65,7 @@ main(void)
ECPGdebug (1, stderr);
empl.idnum = 1;
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 28 "binary.pgc"
if (sqlca.sqlcode)
@ -79,9 +74,7 @@ main(void)
exit (sqlca.sqlcode);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 36 "binary.pgc"
if (sqlca.sqlcode)
@ -90,11 +83,9 @@ main(void)
exit (sqlca.sqlcode);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values ( 1 , 'first user' , 320 , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values ( 1 , 'first user' , 320 , ? ) ",
ECPGt_char,&(data),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 43 "binary.pgc"
if (sqlca.sqlcode)
@ -103,28 +94,21 @@ main(void)
exit (sqlca.sqlcode);
}
/*
* declare C cursor for select name , accs , byte from empl where
* idnum = ?
*/
/* declare C cursor for select name , accs , byte from empl where idnum = ? */
#line 50 "binary.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare C cursor for select name , accs , byte from empl where idnum = ? ",
{ ECPGdo(__LINE__, 0, 1, NULL, "declare C cursor for select name , accs , byte from empl where idnum = ? ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 51 "binary.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch C", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch C", ECPGt_EOIT,
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
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);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 52 "binary.pgc"
if (sqlca.sqlcode)
@ -137,29 +121,21 @@ main(void)
memset(empl.name, 0, 21L);
memset(empl.byte, '#', 20L);
/*
* declare B binary cursor for select name , accs , byte from empl
* where idnum = ?
*/
/* declare B binary cursor for select name , accs , byte from empl where idnum = ? */
#line 63 "binary.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare B binary cursor for select name , accs , byte from empl where idnum = ? ",
{ ECPGdo(__LINE__, 0, 1, NULL, "declare B binary cursor for select name , accs , byte from empl where idnum = ? ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 64 "binary.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch B", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch B", ECPGt_EOIT,
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
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);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 65 "binary.pgc"
if (sqlca.sqlcode)
@ -168,16 +144,11 @@ main(void)
exit (sqlca.sqlcode);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "close B", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "close B", ECPGt_EOIT, ECPGt_EORT);}
#line 72 "binary.pgc"
/*
* do not print a.accs because big/little endian will have different
* outputs here
*/
/* do not print a.accs because big/little endian will have different outputs here */
printf ("name=%s, byte=", empl.name);
for (i=0; i<20; i++)
{
@ -186,9 +157,7 @@ main(void)
printf("(%o)", (unsigned char)empl.byte[i]);
}
printf("\n");
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 83 "binary.pgc"
exit (0);

View File

@ -73,6 +73,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 1 "code100.pgc"
@ -91,14 +92,12 @@ struct sqlca_t *ECPGget_sqlca(void);
int
main(int argc, char **argv)
int main(int argc, char **argv)
{ /* exec sql begin declare section */
#line 9 "code100.pgc"
int index ;
/* exec sql end declare section */
#line 10 "code100.pgc"
@ -106,94 +105,60 @@ main(int argc, char **argv)
ECPGdebug(1,stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 15 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( \"index\" numeric ( 3 ) primary key , \"payload\" int4 not null ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( \"index\" numeric ( 3 ) primary key , \"payload\" int4 not null ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 20 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
{
ECPGtrans(__LINE__, NULL, "commit");
}
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 22 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
for (index=0;index<10;++index)
{
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( payload , index ) values( 0 , ? ) ",
{ { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( payload , index ) values ( 0 , ? ) ",
ECPGt_int,&(index),(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 28 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
}
{
ECPGtrans(__LINE__, NULL, "commit");
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 31 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{
ECPGdo(__LINE__, 0, 1, NULL, "update test set payload = payload + 1 where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "update test set payload = payload + 1 where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);}
#line 35 "code100.pgc"
if (sqlca.sqlcode != 100)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{
ECPGdo(__LINE__, 0, 1, NULL, "delete from test where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "delete from test where index = - 1 ", ECPGt_EOIT, ECPGt_EORT);}
#line 38 "code100.pgc"
if (sqlca.sqlcode != 100)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( select * from test where index = - 1 ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( select * from test where index = - 1 ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 41 "code100.pgc"
if (sqlca.sqlcode != 100)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);}
#line 44 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
{
ECPGtrans(__LINE__, NULL, "commit");
}
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 46 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 49 "code100.pgc"
if (sqlca.sqlcode)
printf("%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
return 0;
}

View File

@ -75,6 +75,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 3 "copystdout.pgc"
@ -105,49 +106,34 @@ main()
ECPGdebug (1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 19 "copystdout.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 19 "copystdout.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table foo ( a int , b varchar ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table foo ( a int , b varchar ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "copystdout.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 20 "copystdout.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values( 5 , 'abc' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values ( 5 , 'abc' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 21 "copystdout.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "copystdout.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values( 6 , 'def' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values ( 6 , 'def' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "copystdout.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "copystdout.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values( 7 , 'ghi' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values ( 7 , 'ghi' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "copystdout.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "copystdout.pgc"
@ -155,24 +141,18 @@ main()
/* EXEC SQL COPY foo TO:fname WITH DELIMITER ','; */
/* printf ("copy to /tmp/foo : sqlca.sqlcode = %ld", sqlca.sqlcode); */
{
ECPGdo(__LINE__, 0, 1, NULL, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT);
#line 29 "copystdout.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "copystdout.pgc"
printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 32 "copystdout.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "copystdout.pgc"

View File

@ -73,6 +73,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 1 "define.pgc"
@ -91,8 +92,7 @@ struct sqlca_t *ECPGget_sqlca(void);
int
main(void)
int main(void)
{
/* exec sql begin declare section */
@ -103,7 +103,6 @@ main(void)
#line 11 "define.pgc"
char s [ 200 ] ;
/* exec sql end declare section */
#line 12 "define.pgc"
@ -113,43 +112,31 @@ main(void)
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 16 "define.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 17 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 17 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 19 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 19 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 29 , 'abcdef' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 29 , 'abcdef' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 20 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( null , 'defined' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , 'defined' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 23 "define.pgc"
@ -159,30 +146,24 @@ main(void)
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( null , 'someothervar not defined' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , 'someothervar not defined' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 31 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 31 "define.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select 1 , 29 :: text || '-' || 'abcdef' ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select 1 , 29 :: text || '-' || 'abcdef' ", ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(s),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 36 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 36 "define.pgc"
@ -190,13 +171,10 @@ main(void)
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 29 , 'no string' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 29 , 'no string' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 42 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 42 "define.pgc"
@ -209,24 +187,18 @@ main(void)
{
ECPGdo(__LINE__, 0, 1, NULL, "set TIMEZONE to 'UTC'", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "set TIMEZONE to 'UTC'", ECPGt_EOIT, ECPGt_EORT);
#line 53 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 53 "define.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 56 "define.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 56 "define.pgc"
return 0;

View File

@ -48,20 +48,16 @@ main(void)
int val1 = 1 ;
#line 13 "desc.pgc"
char val2[4] = "one",
val2output[] = "AAA";
char val2 [ 4 ] = "one" , val2output [] = "AAA" ;
#line 14 "desc.pgc"
int val1output = 2,
val2i = 0;
int val1output = 2 , val2i = 0 ;
#line 15 "desc.pgc"
int val2null = - 1 ;
#line 16 "desc.pgc"
int ind1,
ind2;
int ind1 , ind2 ;
/* exec sql end declare section */
#line 17 "desc.pgc"
@ -71,205 +67,154 @@ main(void)
ECPGallocate_desc(__LINE__, "indesc");
#line 21 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint();
#line 21 "desc.pgc"
ECPGallocate_desc(__LINE__, "outdesc");
#line 22 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint();
#line 22 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 1, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 24 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 2, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 25 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 25 "desc.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 27 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 27 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test1 ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test1 ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 29 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "desc.pgc"
{
ECPGprepare(__LINE__, "foo1", stmt1);
{ ECPGprepare(__LINE__, "foo1" , stmt1);
#line 30 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 30 "desc.pgc"
{
ECPGprepare(__LINE__, "foo2", stmt2);
{ ECPGprepare(__LINE__, "foo2" , stmt2);
#line 31 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 31 "desc.pgc"
{
ECPGprepare(__LINE__, "foo3", stmt3);
{ ECPGprepare(__LINE__, "foo3" , stmt3);
#line 32 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(ECPGprepared_statement("foo1")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 34 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 34 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 1, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
#line 36 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 2, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
ECPGt_int,&(val2null),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 37 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(ECPGprepared_statement("foo1")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 39 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 1, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"3",(long)1,(long)1,strlen("3"), ECPGd_EODT);
#line 41 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 2, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
ECPGt_const,"this is a long test",(long)19,(long)1,strlen("this is a long test"), ECPGd_indicator,
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 42 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 42 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(ECPGprepared_statement("foo1")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 44 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 44 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 1, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 46 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 46 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 2, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 47 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 47 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(ECPGprepared_statement("foo2")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
@ -278,21 +223,16 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 49 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 49 "desc.pgc"
{
ECPGget_desc(__LINE__, "outdesc", 1, ECPGd_data,
{ ECPGget_desc(__LINE__, "outdesc", 1,ECPGd_data,
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char), ECPGd_EODT);
#line 51 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 51 "desc.pgc"
printf("output = %s\n", val2output);
@ -300,156 +240,121 @@ main(void)
/* declare c1 cursor for ? */
#line 54 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare c1 cursor for ?",
{ ECPGdo(__LINE__, 0, 1, NULL, "declare c1 cursor for ?",
ECPGt_char_variable,(ECPGprepared_statement("foo2")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 55 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 55 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c1", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c1", ECPGt_EOIT,
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int),
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
ECPGt_int,&(ind2),(long)1,(long)1,sizeof(int), ECPGt_EORT);
#line 57 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 57 "desc.pgc"
printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",
val1output, ind1, val2output, ind2);
{
ECPGdo(__LINE__, 0, 1, NULL, "close c1", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "close c1", ECPGt_EOIT, ECPGt_EORT);
#line 61 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 61 "desc.pgc"
{
ECPGset_desc_header(__LINE__, "indesc", (int) (1));
{ ECPGset_desc_header(__LINE__, "indesc", (int)(1));
#line 63 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 63 "desc.pgc"
{
ECPGset_desc(__LINE__, "indesc", 1, ECPGd_data,
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
#line 64 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 64 "desc.pgc"
/* declare c2 cursor for ? */
#line 66 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare c2 cursor for ?",
{ ECPGdo(__LINE__, 0, 1, NULL, "declare c2 cursor for ?",
ECPGt_char_variable,(ECPGprepared_statement("foo3")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_descriptor, "indesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 67 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 67 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c2", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c2", ECPGt_EOIT,
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
#line 69 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 69 "desc.pgc"
printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
{
ECPGdo(__LINE__, 0, 1, NULL, "close c2", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "close c2", ECPGt_EOIT, ECPGt_EORT);
#line 72 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 72 "desc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from test1 where a = 3 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test1 where a = 3 ", ECPGt_EOIT,
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
#line 74 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 74 "desc.pgc"
printf("val1=%d val2=%c%c%c%c warn=%c truncate=%d\n", val1output, val2output[0], val2output[1], val2output[2], val2output[3], sqlca.sqlwarn[0], val2i);
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test1 ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test1 ", ECPGt_EOIT, ECPGt_EORT);
#line 77 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 77 "desc.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 78 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 78 "desc.pgc"
ECPGdeallocate_desc(__LINE__, "indesc");
#line 80 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint();
#line 80 "desc.pgc"
ECPGdeallocate_desc(__LINE__, "outdesc");
#line 81 "desc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint();
#line 81 "desc.pgc"

View File

@ -74,6 +74,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 2 "dynalloc.pgc"
@ -90,8 +91,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#line 4 "dynalloc.pgc"
int
main(void)
int main(void)
{
/* exec sql begin declare section */
@ -160,7 +160,6 @@ main(void)
#line 26 "dynalloc.pgc"
int * i9 = 0 ;
/* exec sql end declare section */
#line 27 "dynalloc.pgc"
@ -171,213 +170,154 @@ main(void)
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 32 "dynalloc.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 33 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 33 "dynalloc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to mdy", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to mdy", ECPGt_EOIT, ECPGt_EORT);
#line 35 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 35 "dynalloc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ) ", ECPGt_EOIT, ECPGt_EORT);
#line 37 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 37 "dynalloc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( b , c , d , e , f , g , h , i ) values( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 38 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 38 "dynalloc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( b , c , d , e , f , g , h , i ) values( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ) ", ECPGt_EOIT, ECPGt_EORT);
#line 39 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 39 "dynalloc.pgc"
ECPGallocate_desc(__LINE__, "mydesc");
#line 41 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint ( );
#line 41 "dynalloc.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select a , b , c , d , e , f , g , h , i from test order by a", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select a , b , c , d , e , f , g , h , i from test order by a", ECPGt_EOIT,
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 42 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 42 "dynalloc.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 1, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 1,ECPGd_indicator,
ECPGt_int,&(i1),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_int,&(d1),(long)1,(long)0,sizeof(int), ECPGd_EODT);
#line 43 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 43 "dynalloc.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 2, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 2,ECPGd_indicator,
ECPGt_int,&(i2),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_double,&(d2),(long)1,(long)0,sizeof(double), ECPGd_EODT);
#line 44 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 44 "dynalloc.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 3, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 3,ECPGd_indicator,
ECPGt_int,&(i3),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_char,&(d3),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
#line 45 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 45 "dynalloc.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 4, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 4,ECPGd_indicator,
ECPGt_int,&(i4),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_char,&(d4),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
#line 46 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 46 "dynalloc.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 5, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 5,ECPGd_indicator,
ECPGt_int,&(i5),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_char,&(d5),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
#line 47 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 47 "dynalloc.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 6, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 6,ECPGd_indicator,
ECPGt_int,&(i6),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_char,&(d6),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
#line 48 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 48 "dynalloc.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 7, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 7,ECPGd_indicator,
ECPGt_int,&(i7),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_char,&(d7),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
#line 49 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 49 "dynalloc.pgc"
/* skip box for now */
/* exec sql get descriptor mydesc value 8 :d8=DATA, :i8=INDICATOR; */
{
ECPGget_desc(__LINE__, "mydesc", 9, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 9,ECPGd_indicator,
ECPGt_int,&(i9),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_char,&(d9),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
#line 52 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 52 "dynalloc.pgc"
printf("Result:\n");
for (i=0;i<sqlca.sqlerrd[2];++i)
{
if (i1[i])
printf("NULL, ");
else
printf("%d, ", d1[i]);
if (i1[i]) printf("NULL, ");
else printf("%d, ",d1[i]);
if (i2[i])
printf("NULL, ");
else
printf("%f, ", d2[i]);
if (i2[i]) printf("NULL, ");
else printf("%f, ",d2[i]);
if (i3[i])
printf("NULL, ");
else
printf("'%s', ", d3[i]);
if (i3[i]) printf("NULL, ");
else printf("'%s', ",d3[i]);
if (i4[i])
printf("NULL, ");
else
printf("'%s', ", d4[i]);
if (i4[i]) printf("NULL, ");
else printf("'%s', ",d4[i]);
if (i5[i])
printf("NULL, ");
else
printf("'%s', ", d5[i]);
if (i5[i]) printf("NULL, ");
else printf("'%s', ",d5[i]);
if (i6[i])
printf("NULL, ");
else
printf("'%s', ", d6[i]);
if (i6[i]) printf("NULL, ");
else printf("'%s', ",d6[i]);
if (i7[i])
printf("NULL, ");
else
printf("'%s', ", d7[i]);
if (i7[i]) printf("NULL, ");
else printf("'%s', ",d7[i]);
if (i9[i])
printf("NULL, ");
else
printf("'%s', ", d9[i]);
if (i9[i]) printf("NULL, ");
else printf("'%s', ",d9[i]);
printf("\n");
}
@ -387,17 +327,13 @@ main(void)
ECPGdeallocate_desc(__LINE__, "mydesc");
#line 86 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint ( );
#line 86 "dynalloc.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 87 "dynalloc.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 87 "dynalloc.pgc"
return 0;

View File

@ -74,6 +74,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 2 "dynalloc2.pgc"
@ -90,8 +91,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#line 4 "dynalloc2.pgc"
int
main(void)
int main(void)
{
/* exec sql begin declare section */
@ -114,7 +114,6 @@ main(void)
#line 13 "dynalloc2.pgc"
int colnum ;
/* exec sql end declare section */
#line 14 "dynalloc2.pgc"
@ -125,155 +124,111 @@ main(void)
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 19 "dynalloc2.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 20 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 20 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to postgres", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to postgres", ECPGt_EOIT, ECPGt_EORT);
#line 22 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 22 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 24 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 24 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 1 , 'one' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 1 , 'one' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 25 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 2 , 'two' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 2 , 'two' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 26 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 26 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( null , 'three' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , 'three' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 27 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 27 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 4 , 'four' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 4 , 'four' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 28 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 28 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 5 , null ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 5 , null ) ", ECPGt_EOIT, ECPGt_EORT);
#line 29 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 29 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( null , null ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( null , null ) ", ECPGt_EOIT, ECPGt_EORT);
#line 30 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 30 "dynalloc2.pgc"
ECPGallocate_desc(__LINE__, "mydesc");
#line 32 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint ( );
#line 32 "dynalloc2.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 33 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 33 "dynalloc2.pgc"
{
ECPGget_desc_header(__LINE__, "mydesc", &(colnum));
{ ECPGget_desc_header(__LINE__, "mydesc", &(colnum));
#line 34 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 34 "dynalloc2.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 1, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 1,ECPGd_indicator,
ECPGt_int,&(ipointer1),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_int,&(ip1),(long)1,(long)0,sizeof(int), ECPGd_EODT);
#line 35 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 35 "dynalloc2.pgc"
{
ECPGget_desc(__LINE__, "mydesc", 2, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "mydesc", 2,ECPGd_indicator,
ECPGt_int,&(ipointer2),(long)1,(long)0,sizeof(int), ECPGd_data,
ECPGt_char,&(cp2),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
#line 36 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 36 "dynalloc2.pgc"
printf("Result (%d columns):\n", colnum);
for (i=0;i < sqlca.sqlerrd[2];++i)
{
if (ipointer1[i])
printf("NULL, ");
else
printf("%d, ", ip1[i]);
if (ipointer1[i]) printf("NULL, ");
else printf("%d, ",ip1[i]);
if (ipointer2[i])
printf("NULL, ");
else
printf("'%s', ", cp2[i]);
if (ipointer2[i]) printf("NULL, ");
else printf("'%s', ",cp2[i]);
printf("\n");
}
ECPGfree_auto_mem();
@ -282,26 +237,19 @@ main(void)
ECPGdeallocate_desc(__LINE__, "mydesc");
#line 51 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
if (sqlca.sqlcode < 0) sqlprint ( );
#line 51 "dynalloc2.pgc"
{
ECPGtrans(__LINE__, NULL, "rollback");
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 52 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 52 "dynalloc2.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 53 "dynalloc2.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 53 "dynalloc2.pgc"
return 0;

View File

@ -56,6 +56,7 @@ enum
SQL3_DDT_ILLEGAL /* not a datetime data type (not part of
* standard) */
};
#endif /* !_ECPG_SQL3TYPES_H */
#line 7 "dyntest.pgc"
@ -126,6 +127,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 8 "dyntest.pgc"
@ -176,19 +178,13 @@ main(int argc, char **argv)
int INDICATOR ;
#line 26 "dyntest.pgc"
int TYPE,
LENGTH,
OCTET_LENGTH,
PRECISION,
SCALE,
RETURNED_OCTET_LENGTH;
int TYPE , LENGTH , OCTET_LENGTH , PRECISION , SCALE , RETURNED_OCTET_LENGTH ;
#line 27 "dyntest.pgc"
int DATETIME_INTERVAL_CODE ;
#line 28 "dyntest.pgc"
char NAME[120],
BOOLVAR;
char NAME [ 120 ] , BOOLVAR ;
#line 29 "dyntest.pgc"
char STRINGVAR [ 1024 ] ;
@ -198,7 +194,6 @@ main(int argc, char **argv)
#line 31 "dyntest.pgc"
char * QUERY ;
/* exec sql end declare section */
#line 32 "dyntest.pgc"
@ -219,109 +214,81 @@ main(int argc, char **argv)
ECPGallocate_desc(__LINE__, "MYDESC");
#line 45 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
if (sqlca.sqlcode < 0) error ( );
#line 45 "dyntest.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 47 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 47 "dyntest.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to german", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to german", ECPGt_EOIT, ECPGt_EORT);
#line 49 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 49 "dyntest.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date ) ", ECPGt_EOIT, ECPGt_EORT);
#line 53 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 53 "dyntest.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 54 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 54 "dyntest.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 55 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 55 "dyntest.pgc"
{
ECPGprepare(__LINE__, "MYQUERY", QUERY);
{ ECPGprepare(__LINE__, "MYQUERY" , QUERY);
#line 57 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 57 "dyntest.pgc"
/* declare MYCURS cursor for ? */
#line 58 "dyntest.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare MYCURS cursor for ?",
{ ECPGdo(__LINE__, 0, 1, NULL, "declare MYCURS cursor for ?",
ECPGt_char_variable,(ECPGprepared_statement("MYQUERY")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 60 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 60 "dyntest.pgc"
while (1)
{
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch in MYCURS", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch in MYCURS", ECPGt_EOIT,
ECPGt_descriptor, "MYDESC", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 64 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 64 "dyntest.pgc"
if (sqlca.sqlcode)
break;
{
ECPGget_desc_header(__LINE__, "MYDESC", &(COUNT));
{ ECPGget_desc_header(__LINE__, "MYDESC", &(COUNT));
#line 69 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 69 "dyntest.pgc"
if (!done)
@ -332,8 +299,7 @@ main(int argc, char **argv)
for (INDEX = 1; INDEX <= COUNT; ++INDEX)
{
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_indicator,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_indicator,
ECPGt_int,&(INDICATOR),(long)1,(long)1,sizeof(int), ECPGd_name,
ECPGt_char,(NAME),(long)120,(long)1,(120)*sizeof(char), ECPGd_scale,
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_precision,
@ -345,9 +311,7 @@ main(int argc, char **argv)
#line 86 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 86 "dyntest.pgc"
printf ("%2d\t%s (type: %d length: %d precision: %d scale: %d = " , INDEX, NAME, TYPE, LENGTH, PRECISION, SCALE);
@ -378,15 +342,12 @@ main(int argc, char **argv)
printf ("double precision");
break;
case SQL3_DATE_TIME_TIMESTAMP:
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_di_code,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_di_code,
ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 116 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 116 "dyntest.pgc"
switch (DATETIME_INTERVAL_CODE)
@ -438,88 +399,70 @@ main(int argc, char **argv)
switch (TYPE)
{
case SQL3_BOOLEAN:
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_data,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);
#line 166 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 166 "dyntest.pgc"
printf ("%s\n", BOOLVAR ? "true" : "false");
break;
case SQL3_INTEGER:
case SQL3_SMALLINT:
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_data,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 171 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 171 "dyntest.pgc"
printf ("%d\n", INTVAR);
break;
case SQL3_DOUBLE_PRECISION:
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_data,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);
#line 175 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 175 "dyntest.pgc"
printf ("%.*f\n", PRECISION, DOUBLEVAR);
break;
case SQL3_DATE_TIME_TIMESTAMP:
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_data,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_di_code,
ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 181 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 181 "dyntest.pgc"
printf ("%d \"%s\"\n", DATETIME_INTERVAL_CODE, STRINGVAR);
break;
case SQL3_CHARACTER:
case SQL3_CHARACTER_VARYING:
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_data,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
#line 186 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 186 "dyntest.pgc"
printf ("\"%s\"\n", STRINGVAR);
break;
default:
{
ECPGget_desc(__LINE__, "MYDESC", INDEX, ECPGd_data,
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
#line 190 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 190 "dyntest.pgc"
printf ("<\"%s\">\n", STRINGVAR);
@ -528,21 +471,17 @@ main(int argc, char **argv)
}
}
{
ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
#line 197 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
}
if (sqlca.sqlcode < 0) error ( );}
#line 197 "dyntest.pgc"
ECPGdeallocate_desc(__LINE__, "MYDESC");
#line 199 "dyntest.pgc"
if (sqlca.sqlcode < 0)
error();
if (sqlca.sqlcode < 0) error ( );
#line 199 "dyntest.pgc"

View File

@ -51,148 +51,112 @@ main(void)
#line 18 "execute.pgc"
char command [ 128 ] ;
/* exec sql end declare section */
#line 19 "execute.pgc"
int i,
j;
int i,j;
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, "main", 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "main", 0);
#line 24 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "execute.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 25 "execute.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 26 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 26 "execute.pgc"
sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 29 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "execute.pgc"
sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 32 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "execute.pgc"
sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 35 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 35 "execute.pgc"
printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
sprintf(command, "insert into test (name, amount, letter) select name, amount+?, letter from test");
{
ECPGprepare(__LINE__, "I", command);
{ ECPGprepare(__LINE__, "I" , command);
#line 40 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "execute.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "?",
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
ECPGt_char_variable,(ECPGprepared_statement("I")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(increment),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 41 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "execute.pgc"
printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 45 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 45 "execute.pgc"
sprintf (command, "select * from test");
{
ECPGprepare(__LINE__, "F", command);
{ ECPGprepare(__LINE__, "F" , command);
#line 49 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 49 "execute.pgc"
/* declare CUR cursor for ? */
#line 50 "execute.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare CUR cursor for ?",
{ ECPGdo(__LINE__, 0, 1, NULL, "declare CUR cursor for ?",
ECPGt_char_variable,(ECPGprepared_statement("F")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 52 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 52 "execute.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch 8 in CUR", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch 8 in CUR", ECPGt_EOIT,
ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
@ -201,9 +165,7 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 53 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 53 "execute.pgc"
@ -214,12 +176,10 @@ main(void)
#line 58 "execute.pgc"
char n[8],
l = letter[i][0];
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
#line 59 "execute.pgc"
int a = amount [ i ] ;
/* exec sql end declare section */
#line 60 "execute.pgc"
@ -228,46 +188,36 @@ main(void)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "close CUR", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "close CUR", ECPGt_EOIT, ECPGt_EORT);
#line 66 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 66 "execute.pgc"
sprintf (command, "select * from test where amount = ?");
{
ECPGprepare(__LINE__, "F", command);
{ ECPGprepare(__LINE__, "F" , command);
#line 70 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 70 "execute.pgc"
/* declare CUR2 cursor for ? */
#line 71 "execute.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare CUR2 cursor for ?",
{ ECPGdo(__LINE__, 0, 1, NULL, "declare CUR2 cursor for ?",
ECPGt_char_variable,(ECPGprepared_statement("F")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_const,"1",(long)1,(long)1,strlen("1"),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 73 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 73 "execute.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch in CUR2", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch in CUR2", ECPGt_EOIT,
ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
@ -276,9 +226,7 @@ main(void)
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 74 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 74 "execute.pgc"
@ -289,12 +237,10 @@ main(void)
#line 79 "execute.pgc"
char n[8],
l = letter[i][0];
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
#line 80 "execute.pgc"
int a = amount [ i ] ;
/* exec sql end declare section */
#line 81 "execute.pgc"
@ -303,40 +249,28 @@ main(void)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
{
ECPGdo(__LINE__, 0, 1, NULL, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
#line 87 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 87 "execute.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 88 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 88 "execute.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 89 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 89 "execute.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 90 "execute.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 90 "execute.pgc"

View File

@ -22,9 +22,7 @@
#line 5 "fetch.pgc"
int
main(int argc, char *argv[])
{
int main(int argc, char* argv[]) {
/* exec sql begin declare section */
@ -33,17 +31,13 @@ main(int argc, char *argv[])
char str [ 25 ] ;
#line 10 "fetch.pgc"
int i,
how_many = 1;
int i , how_many = 1 ;
/* exec sql end declare section */
#line 11 "fetch.pgc"
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 14 "fetch.pgc"
@ -54,70 +48,50 @@ main(int argc, char *argv[])
#line 17 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 19 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 19 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 19 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 1 , 'text1' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 1 , 'text1' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 21 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 21 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 2 , 'text2' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 2 , 'text2' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 22 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 3 , 'text3' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 3 , 'text3' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 23 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 4 , 'text4' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 4 , 'text4' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 24 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 24 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "fetch.pgc"
@ -125,44 +99,34 @@ main(int argc, char *argv[])
#line 26 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "declare C cursor for select * from My_Table ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "declare C cursor for select * from My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 28 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 28 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 28 "fetch.pgc"
/* exec sql whenever not found break ; */
#line 30 "fetch.pgc"
while (1)
{
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch 1 in C", ECPGt_EOIT,
while (1) {
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch 1 in C", 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 32 "fetch.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND)
break;
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 32 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "fetch.pgc"
printf("%d: %s\n", i, str);
@ -171,22 +135,17 @@ main(int argc, char *argv[])
/* exec sql whenever not found continue ; */
#line 36 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT);
#line 37 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 37 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "fetch ? in C",
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch ? in C",
ECPGt_int,&(how_many),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
@ -195,56 +154,41 @@ main(int argc, char *argv[])
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 39 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 39 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "fetch.pgc"
printf("%d: %s\n", i, str);
{
ECPGdo(__LINE__, 0, 1, NULL, "close C", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "close C", ECPGt_EOIT, ECPGt_EORT);
#line 42 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 42 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 42 "fetch.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 44 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 44 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 44 "fetch.pgc"
{
ECPGdisconnect(__LINE__, "ALL");
{ ECPGdisconnect(__LINE__, "ALL");
#line 46 "fetch.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 46 "fetch.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 46 "fetch.pgc"

View File

@ -22,20 +22,14 @@
#line 5 "func.pgc"
int
main(int argc, char *argv[])
{
int main(int argc, char* argv[]) {
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 10 "func.pgc"
{
ECPGsetcommit(__LINE__, "on", NULL);
}
{ ECPGsetcommit(__LINE__, "on", NULL);}
#line 12 "func.pgc"
/* exec sql whenever sql_warning sqlprint ; */
@ -45,130 +39,94 @@ main(int argc, char *argv[])
#line 14 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 16 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 16 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 16 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create function My_Table_Check () returns trigger as $test$\
{ ECPGdo(__LINE__, 0, 1, NULL, "create function My_Table_Check () returns trigger as $test$\
BEGIN\
RAISE WARNING 'Notice: TG_NAME=%, TG WHEN=%', TG_NAME, TG_WHEN;\
RETURN NEW;\
END; $test$ language plpgsql", ECPGt_EOIT, ECPGt_EORT);
#line 24 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 24 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( )", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( )", ECPGt_EOIT, ECPGt_EORT);
#line 30 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 30 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 30 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values( 1234 , 'Some random text' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 1234 , 'Some random text' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 32 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values( 5678 , 'The Quick Brown' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 5678 , 'The Quick Brown' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 33 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 33 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 33 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop trigger My_Table_Check_Trigger on My_Table ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop trigger My_Table_Check_Trigger on My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 35 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 35 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 35 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop function My_Table_Check () ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop function My_Table_Check () ", ECPGt_EOIT, ECPGt_EORT);
#line 36 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 36 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "func.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 37 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 37 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "func.pgc"
{
ECPGdisconnect(__LINE__, "ALL");
{ ECPGdisconnect(__LINE__, "ALL");
#line 39 "func.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 39 "func.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "func.pgc"

View File

@ -75,6 +75,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#ifdef __cplusplus
}
#endif
#endif
#line 3 "indicators.pgc"
@ -91,8 +92,7 @@ struct sqlca_t *ECPGget_sqlca(void);
int
main(int argc, char **argv)
int main(int argc, char **argv)
{
/* exec sql begin declare section */
@ -103,121 +103,87 @@ main(int argc, char **argv)
#line 11 "indicators.pgc"
int nullind = - 1 ;
/* exec sql end declare section */
#line 12 "indicators.pgc"
ECPGdebug(1,stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 16 "indicators.pgc"
{
ECPGsetcommit(__LINE__, "off", NULL);
}
{ ECPGsetcommit(__LINE__, "off", NULL);}
#line 17 "indicators.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( \"id\" int primary key , \"str\" text not null , val int null ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( \"id\" int primary key , \"str\" text not null , val int null ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 22 "indicators.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 23 "indicators.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values( 1 , 'Hello' , 0 ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values ( 1 , 'Hello' , 0 ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 25 "indicators.pgc"
/* use indicator in insert */
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values( 2 , 'Hi there' , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values ( 2 , 'Hi there' , ? ) ",
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int, &(nullind), (long) 1, (long) 1, sizeof(int), ECPGt_EOIT, ECPGt_EORT);
}
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
#line 28 "indicators.pgc"
nullind = 0;
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values( 3 , 'Good evening' , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( id , str , val ) values ( 3 , 'Good evening' , ? ) ",
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int, &(nullind), (long) 1, (long) 1, sizeof(int), ECPGt_EOIT, ECPGt_EORT);
}
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
#line 30 "indicators.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 31 "indicators.pgc"
/* use indicators to get information about selects */
{
ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 1 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 1 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 34 "indicators.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 2 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 2 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int, &(nullind), (long) 1, (long) 1, sizeof(int), ECPGt_EORT);
}
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
#line 35 "indicators.pgc"
printf("intvar: %d, nullind: %d\n", intvar, nullind);
{
ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 3 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 3 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int, &(nullind), (long) 1, (long) 1, sizeof(int), ECPGt_EORT);
}
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
#line 37 "indicators.pgc"
printf("intvar: %d, nullind: %d\n", intvar, nullind);
/* use indicators for update */
intvar = 5;
nullind = -1;
{
ECPGdo(__LINE__, 0, 1, NULL, "update test set val = ? where id = 1 ",
intvar = 5; nullind = -1;
{ ECPGdo(__LINE__, 0, 1, NULL, "update test set val = ? where id = 1 ",
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int, &(nullind), (long) 1, (long) 1, sizeof(int), ECPGt_EOIT, ECPGt_EORT);
}
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
#line 42 "indicators.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 1 ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select val from test where id = 1 ", ECPGt_EOIT,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
ECPGt_int, &(nullind), (long) 1, (long) 1, sizeof(int), ECPGt_EORT);
}
ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
#line 43 "indicators.pgc"
printf("intvar: %d, nullind: %d\n", intvar, nullind);
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);}
#line 46 "indicators.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 47 "indicators.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 49 "indicators.pgc"
return 0;

View File

@ -22,29 +22,22 @@
#line 5 "quote.pgc"
int
main(int argc, char *argv[])
{
int main(int argc, char* argv[]) {
/* exec sql begin declare section */
#line 9 "quote.pgc"
char var [ 25 ] ;
/* exec sql end declare section */
#line 10 "quote.pgc"
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 13 "quote.pgc"
{
ECPGsetcommit(__LINE__, "on", NULL);
}
{ ECPGsetcommit(__LINE__, "on", NULL);}
#line 15 "quote.pgc"
/* exec sql whenever sql_warning sqlprint ; */
@ -54,148 +47,108 @@ main(int argc, char *argv[])
#line 17 "quote.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table \"My_Table\" ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table \"My_Table\" ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 19 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 19 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 19 "quote.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "show standard_conforming_strings", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "show standard_conforming_strings", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 21 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 21 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "quote.pgc"
printf("Standard conforming strings: %s\n", var);
/* this is a\\b actually */
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 25 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 25 "quote.pgc"
/* this is a\b */
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 27 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 27 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 27 "quote.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);
#line 29 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 29 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "quote.pgc"
/* this is a\\b actually */
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 32 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "quote.pgc"
/* this is a\b */
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 34 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 34 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 34 "quote.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select * from \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
#line 36 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 36 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "quote.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
#line 38 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 38 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 38 "quote.pgc"
{
ECPGdisconnect(__LINE__, "ALL");
{ ECPGdisconnect(__LINE__, "ALL");
#line 40 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 40 "quote.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "quote.pgc"

View File

@ -22,23 +22,18 @@
#line 5 "show.pgc"
int
main(int argc, char *argv[])
{
int main(int argc, char* argv[]) {
/* exec sql begin declare section */
#line 9 "show.pgc"
char var [ 25 ] ;
/* exec sql end declare section */
#line 10 "show.pgc"
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 13 "show.pgc"
@ -49,106 +44,102 @@ main(int argc, char *argv[])
#line 16 "show.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "show search_path", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);
#line 18 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 18 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 18 "show.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "show search_path", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 18 "show.pgc"
#line 19 "show.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
#line 18 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 19 "show.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
#line 18 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 19 "show.pgc"
printf("Var: Search path: %s\n", var);
{
ECPGdo(__LINE__, 0, 1, NULL, "show wal_buffers", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
#line 22 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 22 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "show.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "show standard_conforming_strings", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 21 "show.pgc"
#line 23 "show.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
#line 21 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 23 "show.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
#line 21 "show.pgc"
printf("Var: WAL buffers: %s\n", var);
{
ECPGdo(__LINE__, 0, 1, NULL, "show standard_conforming_strings", ECPGt_EOIT,
ECPGt_char, (var), (long) 25, (long) 1, (25) * sizeof(char),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
#line 24 "show.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
#line 24 "show.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
#line 24 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "show.pgc"
printf("Var: Standard conforming strings: %s\n", var);
{
ECPGdo(__LINE__, 0, 1, NULL, "show time zone", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "set time zone PST8PDT", ECPGt_EOIT, ECPGt_EORT);
#line 26 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 26 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 26 "show.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "show time zone", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 27 "show.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 27 "show.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 27 "show.pgc"
printf("Time Zone: %s\n", var);
{
ECPGdo(__LINE__, 0, 1, NULL, "show transaction isolation level", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "set transaction isolation level read committed", ECPGt_EOIT, ECPGt_EORT);
#line 30 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 30 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 30 "show.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "show transaction isolation level", ECPGt_EOIT,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 30 "show.pgc"
#line 31 "show.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
#line 30 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 31 "show.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
#line 30 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 31 "show.pgc"
printf("Transaction isolation level: %s\n", var);
/* Do not ask for the user name, it may differ in a regression test */
/* EXEC SQL SHOW SESSION AUTHORIZATION INTO :var; */
{ ECPGdisconnect(__LINE__, "ALL");
#line 34 "show.pgc"
{
ECPGdisconnect(__LINE__, "ALL");
#line 36 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 34 "show.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
#line 36 "show.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
#line 36 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 34 "show.pgc"
return 0;

View File

@ -2,35 +2,45 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18: QUERY: show search_path on connection regress1
[NO_PID]: ECPGexecute line 18: QUERY: set search_path to 'public' on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18: Correctly got 1 tuples with 1 fields
[NO_PID]: ECPGexecute line 18 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 18: RESULT: "$user",public offset: -1 array: Yes
[NO_PID]: ECPGexecute line 19: QUERY: show search_path on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21: QUERY: show wal_buffers on connection regress1
[NO_PID]: ECPGexecute line 19: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21: Correctly got 1 tuples with 1 fields
[NO_PID]: ECPGget_data line 19: RESULT: public offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: 8 offset: -1 array: Yes
[NO_PID]: ECPGexecute line 22: QUERY: set standard_conforming_strings to off on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24: QUERY: show standard_conforming_strings on connection regress1
[NO_PID]: ECPGexecute line 22 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24: Correctly got 1 tuples with 1 fields
[NO_PID]: ECPGexecute line 23: QUERY: show standard_conforming_strings on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 24: RESULT: off offset: -1 array: Yes
[NO_PID]: ECPGexecute line 23: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 23: RESULT: off offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: set time zone PST8PDT on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27: QUERY: show time zone on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 27: RESULT: PST8PDT offset: -1 array: Yes
[NO_PID]: ECPGget_data line 27: RESULT: pst8pdt offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: QUERY: show transaction isolation level on connection regress1
[NO_PID]: ECPGexecute line 30: QUERY: set transaction isolation level read committed on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: Correctly got 1 tuples with 1 fields
[NO_PID]: ECPGexecute line 30 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 30: RESULT: read committed offset: -1 array: Yes
[NO_PID]: ECPGexecute line 31: QUERY: show transaction isolation level on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 31: RESULT: read committed offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -1,5 +1,4 @@
Var: Search path: "$user",public
Var: WAL buffers: 8
Var: Search path: public
Var: Standard conforming strings: off
Time Zone: PST8PDT
Time Zone: pst8pdt
Transaction isolation level: read committed

View File

@ -22,24 +22,18 @@
#line 5 "update.pgc"
int
main(int argc, char *argv[])
{
int main(int argc, char* argv[]) {
/* exec sql begin declare section */
#line 9 "update.pgc"
int i1[3],
i2[3];
int i1 [ 3 ] , i2 [ 3 ] ;
/* exec sql end declare section */
#line 10 "update.pgc"
ECPGdebug(1, stderr);
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 13 "update.pgc"
@ -50,131 +44,95 @@ main(int argc, char *argv[])
#line 16 "update.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b int ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b int ) ", ECPGt_EOIT, ECPGt_EORT);
#line 18 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 18 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 18 "update.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values( 1 , 1 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values ( 1 , 1 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 20 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 20 "update.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values( 2 , 2 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values ( 2 , 2 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 21 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 21 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "update.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values( 3 , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( a , b ) values ( 3 , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 22 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "update.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "update test set a = a + 1 ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "update test set a = a + 1 ", ECPGt_EOIT, ECPGt_EORT);
#line 24 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 24 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "update.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "update test set ( a , b )=( 5 , 5 ) where a = 4 ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "update test set ( a , b )= ( 5 , 5 ) where a = 4 ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 25 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 25 "update.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "update test set a = 4 where a = 3 ", ECPGt_EOIT, ECPGt_EORT);
{ ECPGdo(__LINE__, 0, 1, NULL, "update test set a = 4 where a = 3 ", ECPGt_EOIT, ECPGt_EORT);
#line 26 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 26 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 26 "update.pgc"
;
{
ECPGdo(__LINE__, 0, 1, NULL, "select a , b from test order by a", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select a , b from test order by a", ECPGt_EOIT,
ECPGt_int,(i1),(long)1,(long)3,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,(i2),(long)1,(long)3,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 28 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 28 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 28 "update.pgc"
printf("test\na b\n%d %d\n%d %d\n%d %d\n", i1[0], i2[0], i1[1], i2[1], i1[2], i2[2]);
{
ECPGdisconnect(__LINE__, "ALL");
{ ECPGdisconnect(__LINE__, "ALL");
#line 32 "update.pgc"
if (sqlca.sqlwarn[0] == 'W')
sqlprint();
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "update.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "update.pgc"

View File

@ -41,59 +41,42 @@ void *test_thread(void *arg);
int nthreads = 10;
int iterations = 20;
int
main(int argc, char *argv[])
int main(int argc, char *argv[])
{
pthread_t *threads;
int n;
/* exec sql begin declare section */
#line 31 "thread.pgc"
int l_rows ;
/* exec sql end declare section */
#line 32 "thread.pgc"
/*
* Switch off debug output for regression tests. The threads get executed
* in more or less random order
*/
/* Switch off debug output for regression tests. The threads get executed in
* more or less random order */
ECPGdebug(0, stderr);
/* setup test_thread table */
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 41 "thread.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
#line 42 "thread.pgc"
/* DROP might fail */
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 43 "thread.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 48 "thread.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 49 "thread.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 50 "thread.pgc"
@ -117,26 +100,18 @@ main(int argc, char *argv[])
free(threads);
/* and check results */
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 72 "thread.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 73 "thread.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 74 "thread.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 75 "thread.pgc"
if( l_rows == (nthreads * iterations) )
@ -147,11 +122,9 @@ main(int argc, char *argv[])
return( 0 );
}
void *
test_thread(void *arg)
void *test_thread(void *arg)
{
long threadnum = (long)arg;
/* exec sql begin declare section */
@ -161,7 +134,6 @@ test_thread(void *arg)
#line 89 "thread.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
#line 90 "thread.pgc"
@ -171,13 +143,10 @@ test_thread(void *arg)
/* exec sql whenever sqlerror sqlprint ; */
#line 94 "thread.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, l_connection, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , l_connection, 0);
#line 95 "thread.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 95 "thread.pgc"
if( sqlca.sqlcode != 0 )
@ -185,13 +154,10 @@ test_thread(void *arg)
printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL );
}
{
ECPGtrans(__LINE__, l_connection, "begin transaction ");
{ ECPGtrans(__LINE__, l_connection, "begin transaction ");
#line 101 "thread.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 101 "thread.pgc"
@ -201,17 +167,14 @@ test_thread(void *arg)
#ifdef DEBUG
printf("%s: inserting %d\n", l_connection, l_i);
#endif
{
ECPGdo(__LINE__, 0, 1, l_connection, "insert into test_thread ( thread , iteration ) values( ? , ? ) ",
{ ECPGdo(__LINE__, 0, 1, l_connection, "insert into test_thread ( thread , iteration ) values ( ? , ? ) ",
ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 109 "thread.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 109 "thread.pgc"
#ifdef DEBUG
@ -223,22 +186,16 @@ test_thread(void *arg)
}
/* all done */
{
ECPGtrans(__LINE__, l_connection, "commit");
{ ECPGtrans(__LINE__, l_connection, "commit");
#line 119 "thread.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 119 "thread.pgc"
{
ECPGdisconnect(__LINE__, l_connection);
{ ECPGdisconnect(__LINE__, l_connection);
#line 120 "thread.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 120 "thread.pgc"
#ifdef DEBUG
@ -246,5 +203,4 @@ test_thread(void *arg)
#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */

View File

@ -42,59 +42,42 @@ void *test_thread(void *arg);
int nthreads = 10;
int iterations = 20;
int
main(int argc, char *argv[])
int main(int argc, char *argv[])
{
pthread_t *threads;
int n;
/* exec sql begin declare section */
#line 32 "thread_implicit.pgc"
int l_rows ;
/* exec sql end declare section */
#line 33 "thread_implicit.pgc"
/*
* Switch off debug output for regression tests. The threads get executed
* in more or less random order
*/
/* Switch off debug output for regression tests. The threads get executed in
* more or less random order */
ECPGdebug(0, stderr);
/* setup test_thread table */
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 42 "thread_implicit.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test_thread ", ECPGt_EOIT, ECPGt_EORT);}
#line 43 "thread_implicit.pgc"
/* DROP might fail */
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 44 "thread_implicit.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test_thread ( tstamp timestamp not null default cast( timeofday () as timestamp ) , thread TEXT not null , iteration integer not null , primary key( thread , iteration ) ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 49 "thread_implicit.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 50 "thread_implicit.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 51 "thread_implicit.pgc"
@ -118,26 +101,18 @@ main(int argc, char *argv[])
free(threads);
/* and check results */
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, NULL, 0);
}
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 73 "thread_implicit.pgc"
{
ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
{ ECPGdo(__LINE__, 0, 1, NULL, "select count (*) from test_thread ", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 74 "thread_implicit.pgc"
{
ECPGtrans(__LINE__, NULL, "commit");
}
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 75 "thread_implicit.pgc"
{
ECPGdisconnect(__LINE__, "CURRENT");
}
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 76 "thread_implicit.pgc"
if( l_rows == (nthreads * iterations) )
@ -148,11 +123,9 @@ main(int argc, char *argv[])
return( 0 );
}
void *
test_thread(void *arg)
void *test_thread(void *arg)
{
long threadnum = (long)arg;
/* exec sql begin declare section */
@ -162,7 +135,6 @@ test_thread(void *arg)
#line 90 "thread_implicit.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
#line 91 "thread_implicit.pgc"
@ -172,13 +144,10 @@ test_thread(void *arg)
/* exec sql whenever sqlerror sqlprint ; */
#line 95 "thread_implicit.pgc"
{
ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, l_connection, 0);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , l_connection, 0);
#line 96 "thread_implicit.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 96 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
@ -186,13 +155,10 @@ test_thread(void *arg)
printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL );
}
{
ECPGtrans(__LINE__, NULL, "begin transaction ");
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 102 "thread_implicit.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 102 "thread_implicit.pgc"
@ -202,17 +168,14 @@ test_thread(void *arg)
#ifdef DEBUG
printf("%s: inserting %d\n", l_connection, l_i);
#endif
{
ECPGdo(__LINE__, 0, 1, NULL, "insert into test_thread ( thread , iteration ) values( ? , ? ) ",
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test_thread ( thread , iteration ) values ( ? , ? ) ",
ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 110 "thread_implicit.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 110 "thread_implicit.pgc"
#ifdef DEBUG
@ -224,22 +187,16 @@ test_thread(void *arg)
}
/* all done */
{
ECPGtrans(__LINE__, NULL, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 120 "thread_implicit.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 120 "thread_implicit.pgc"
{
ECPGdisconnect(__LINE__, l_connection);
{ ECPGdisconnect(__LINE__, l_connection);
#line 121 "thread_implicit.pgc"
if (sqlca.sqlcode < 0)
sqlprint();
}
if (sqlca.sqlcode < 0) sqlprint();}
#line 121 "thread_implicit.pgc"
#ifdef DEBUG
@ -247,5 +204,4 @@ test_thread(void *arg)
#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */

View File

@ -15,24 +15,22 @@ int main(int argc, char* argv[]) {
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL SET search_path TO 'public';
EXEC SQL SHOW search_path INTO :var;
printf("Var: Search path: %s\n", var);
EXEC SQL SHOW wal_buffers INTO :var;
printf("Var: WAL buffers: %s\n", var);
EXEC SQL SET standard_conforming_strings TO off;
EXEC SQL SHOW standard_conforming_strings INTO :var;
printf("Var: Standard conforming strings: %s\n", var);
EXEC SQL SET TIME ZONE PST8PDT;
EXEC SQL SHOW TIME ZONE INTO :var;
printf("Time Zone: %s\n", var);
EXEC SQL SET TRANSACTION ISOLATION LEVEL read committed;
EXEC SQL SHOW TRANSACTION ISOLATION LEVEL INTO :var;
printf("Transaction isolation level: %s\n", var);
/* Do not ask for the user name, it may differ in a regression test */
/* EXEC SQL SHOW SESSION AUTHORIZATION INTO :var; */
EXEC SQL DISCONNECT ALL;
return 0;