mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
Applied test suite update by Joachim Wieland <joe@mcknight.de>.
This commit is contained in:
@ -2064,5 +2064,9 @@ We Aug 2 13:15:25 CEST 2006
|
||||
- Implemented EXEC SQL UNDEF.
|
||||
- Applied first version of the regression test patch by Joachim
|
||||
Wieland <joe@mcknight.de>.
|
||||
|
||||
Th Aug 3 14:45:06 CEST 2006
|
||||
|
||||
- Applied test suite update by Joachim Wieland <joe@mcknight.de>.
|
||||
- Set ecpg library version to 5.2.
|
||||
- Set ecpg version to 4.2.1.
|
||||
|
@ -48,10 +48,13 @@ int main(void)
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
int c;
|
||||
timestamp d;
|
||||
timestamp e;
|
||||
timestamp maxd;
|
||||
char dbname[30];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
interval *intvl;
|
||||
|
||||
EXEC SQL whenever sqlerror sqlprint;
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
@ -91,17 +94,15 @@ int main(void)
|
||||
sql_check("main", "select", 0);
|
||||
|
||||
printf("Read in customer %d\n", c);
|
||||
|
||||
/* Adding 1 to d adds 1 second. So:
|
||||
60 1 minute
|
||||
3600 1 hour
|
||||
86400 1 day */
|
||||
d=d+86400;
|
||||
|
||||
intvl = PGTYPESinterval_from_asc("1 day 2 hours 24 minutes 65 seconds", NULL);
|
||||
PGTYPEStimestamp_add_interval(&d, intvl, &e);
|
||||
|
||||
c++;
|
||||
|
||||
EXEC SQL insert into history
|
||||
(customerid, timestamp, action_taken, narrative)
|
||||
values(:c, :d, 'test', 'test');
|
||||
values(:c, :e, 'test', 'test');
|
||||
sql_check("main", "update", 0);
|
||||
|
||||
EXEC SQL commit;
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/test/complex/header_test.h,v 1.1 2006/08/02 14:14:02 meskes Exp $ */
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
static void
|
||||
|
@ -91,10 +91,6 @@ main (void)
|
||||
|
||||
EXEC SQL CLOSE B;
|
||||
|
||||
i=a.t[0];
|
||||
a.t[0]=a.t[1];
|
||||
a.t[1]=i;
|
||||
|
||||
printf ("name=%s, accs=%d byte=", empl.name, a.accs);
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
|
@ -73,8 +73,6 @@ int main(void)
|
||||
long long iax /* = 40000000000LL */ ;
|
||||
exec sql end declare section;
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
|
||||
int f=fa();
|
||||
|
||||
#ifdef _cplusplus
|
||||
@ -83,6 +81,8 @@ int main(void)
|
||||
exec sql end declare section;
|
||||
#endif
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
|
||||
exec sql whenever sqlerror do fa();
|
||||
exec sql select now();
|
||||
exec sql whenever sqlerror do fb(20);
|
||||
|
@ -142,6 +142,7 @@ int main(void)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#line 49 "test_informix2.pgc"
|
||||
int c ;
|
||||
@ -150,16 +151,21 @@ int main(void)
|
||||
timestamp d ;
|
||||
|
||||
#line 51 "test_informix2.pgc"
|
||||
timestamp maxd ;
|
||||
timestamp e ;
|
||||
|
||||
#line 52 "test_informix2.pgc"
|
||||
timestamp maxd ;
|
||||
|
||||
#line 53 "test_informix2.pgc"
|
||||
char dbname [ 30 ] ;
|
||||
/* exec sql end declare section */
|
||||
#line 53 "test_informix2.pgc"
|
||||
#line 54 "test_informix2.pgc"
|
||||
|
||||
|
||||
interval *intvl;
|
||||
|
||||
/* exec sql whenever sqlerror sqlprint ; */
|
||||
#line 55 "test_informix2.pgc"
|
||||
#line 58 "test_informix2.pgc"
|
||||
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
@ -170,36 +176,36 @@ int main(void)
|
||||
*/
|
||||
strcpy(dbname, "regress1");
|
||||
{ ECPGconnect(__LINE__, 1, dbname , NULL,NULL , NULL, 0);
|
||||
#line 64 "test_informix2.pgc"
|
||||
#line 67 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 64 "test_informix2.pgc"
|
||||
#line 67 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "connect", 0);
|
||||
|
||||
{ ECPGdo(__LINE__, 1, 0, NULL, "create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 67 "test_informix2.pgc"
|
||||
#line 70 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 67 "test_informix2.pgc"
|
||||
#line 70 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "create", 0);
|
||||
|
||||
{ ECPGdo(__LINE__, 1, 0, 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 72 "test_informix2.pgc"
|
||||
#line 75 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 72 "test_informix2.pgc"
|
||||
#line 75 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "insert", 0);
|
||||
|
||||
{ ECPGdo(__LINE__, 1, 0, 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 77 "test_informix2.pgc"
|
||||
#line 80 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 77 "test_informix2.pgc"
|
||||
#line 80 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "select max", 100);
|
||||
|
||||
@ -216,61 +222,59 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_timestamp,&(d),(long)1,(long)1,sizeof(timestamp),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 90 "test_informix2.pgc"
|
||||
#line 93 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 90 "test_informix2.pgc"
|
||||
#line 93 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "select", 0);
|
||||
|
||||
printf("Read in customer %d\n", c);
|
||||
|
||||
/* Adding 1 to d adds 1 second. So:
|
||||
60 1 minute
|
||||
3600 1 hour
|
||||
86400 1 day */
|
||||
d=d+86400;
|
||||
|
||||
intvl = PGTYPESinterval_from_asc("1 day 2 hours 24 minutes 65 seconds", NULL);
|
||||
PGTYPEStimestamp_add_interval(&d, intvl, &e);
|
||||
|
||||
c++;
|
||||
|
||||
{ ECPGdo(__LINE__, 1, 0, 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,&(d),(long)1,(long)1,sizeof(timestamp),
|
||||
ECPGt_timestamp,&(e),(long)1,(long)1,sizeof(timestamp),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 104 "test_informix2.pgc"
|
||||
#line 105 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 104 "test_informix2.pgc"
|
||||
#line 105 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "update", 0);
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "commit");
|
||||
#line 107 "test_informix2.pgc"
|
||||
#line 108 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 107 "test_informix2.pgc"
|
||||
#line 108 "test_informix2.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 1, 0, NULL, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 109 "test_informix2.pgc"
|
||||
#line 110 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 109 "test_informix2.pgc"
|
||||
#line 110 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "drop", 0);
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "commit");
|
||||
#line 112 "test_informix2.pgc"
|
||||
#line 113 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 112 "test_informix2.pgc"
|
||||
#line 113 "test_informix2.pgc"
|
||||
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");
|
||||
#line 114 "test_informix2.pgc"
|
||||
#line 115 "test_informix2.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 114 "test_informix2.pgc"
|
||||
#line 115 "test_informix2.pgc"
|
||||
|
||||
sql_check("main", "disconnect", 0);
|
||||
|
||||
|
@ -2,39 +2,39 @@
|
||||
[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 67: QUERY: create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 70: QUERY: create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 67 Ok: CREATE TABLE
|
||||
[NO_PID]: ECPGexecute line 70 Ok: CREATE TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 70: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 73: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 70 Ok: INSERT 0 1
|
||||
[NO_PID]: ECPGexecute line 73 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 75: QUERY: select max ( timestamp ) from history on connection regress1
|
||||
[NO_PID]: ECPGexecute line 78: QUERY: select max ( timestamp ) from history on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 75: Correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: ECPGexecute line 78: Correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 75: RESULT: Wed May 07 13:28:34 2003 offset: 8 array: Yes
|
||||
[NO_PID]: ECPGget_data line 78: RESULT: Wed May 07 13:28:34 2003 offset: 8 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 86: QUERY: select customerid , timestamp from history where timestamp = timestamp '2003-05-07 13:28:34' limit 1 on connection regress1
|
||||
[NO_PID]: ECPGexecute line 89: QUERY: select customerid , timestamp from history where timestamp = timestamp '2003-05-07 13:28:34' limit 1 on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 86: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: ECPGexecute line 89: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 86: RESULT: 1 offset: 4 array: Yes
|
||||
[NO_PID]: ECPGget_data line 89: RESULT: 1 offset: 4 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 86: RESULT: Wed May 07 13:28:34 2003 offset: 8 array: Yes
|
||||
[NO_PID]: ECPGget_data line 89: RESULT: Wed May 07 13:28:34 2003 offset: 8 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 102: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values( 2 , timestamp '2003-05-08 13:28:34' , 'test' , 'test' ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 103: QUERY: insert into history ( customerid , timestamp , action_taken , narrative ) values( 2 , timestamp '2003-05-08 15:53:39' , 'test' , 'test' ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 102 Ok: INSERT 0 1
|
||||
[NO_PID]: ECPGexecute line 103 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGtrans line 107 action = commit connection = regress1
|
||||
[NO_PID]: ECPGtrans line 108 action = commit connection = regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 109: QUERY: drop table history on connection regress1
|
||||
[NO_PID]: ECPGexecute line 110: QUERY: drop table history on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 109 Ok: DROP TABLE
|
||||
[NO_PID]: ECPGexecute line 110 Ok: DROP TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGtrans line 112 action = commit connection = regress1
|
||||
[NO_PID]: ECPGtrans line 113 action = commit connection = regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: Connection regress1 closed.
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -12,8 +12,6 @@
|
||||
|
||||
|
||||
#line 1 "./header_test.h"
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/test/expected/complex-test2.c,v 1.1 2006/08/02 14:14:02 meskes Exp $ */
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
static void
|
||||
@ -24,19 +22,19 @@ Finish(char *msg)
|
||||
|
||||
/* finish transaction */
|
||||
{ ECPGtrans(__LINE__, NULL, "rollback");}
|
||||
#line 12 "./header_test.h"
|
||||
#line 10 "./header_test.h"
|
||||
|
||||
|
||||
/* and remove test table */
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);}
|
||||
#line 15 "./header_test.h"
|
||||
#line 13 "./header_test.h"
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "commit");}
|
||||
#line 16 "./header_test.h"
|
||||
#line 14 "./header_test.h"
|
||||
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");}
|
||||
#line 18 "./header_test.h"
|
||||
#line 16 "./header_test.h"
|
||||
|
||||
|
||||
exit(-1);
|
||||
@ -49,10 +47,10 @@ warn(void)
|
||||
}
|
||||
|
||||
/* exec sql whenever sqlerror do Finish ( msg ) ; */
|
||||
#line 31 "./header_test.h"
|
||||
#line 29 "./header_test.h"
|
||||
|
||||
/* exec sql whenever sql_warning do warn ( ) ; */
|
||||
#line 34 "./header_test.h"
|
||||
#line 32 "./header_test.h"
|
||||
|
||||
|
||||
#line 4 "test2.pgc"
|
||||
|
@ -12,8 +12,6 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#line 1 "./header_test.h"
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/test/expected/complex-test3.c,v 1.1 2006/08/02 14:14:02 meskes Exp $ */
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
static void
|
||||
@ -24,19 +22,19 @@ Finish(char *msg)
|
||||
|
||||
/* finish transaction */
|
||||
{ ECPGtrans(__LINE__, NULL, "rollback");}
|
||||
#line 12 "./header_test.h"
|
||||
#line 10 "./header_test.h"
|
||||
|
||||
|
||||
/* and remove test table */
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);}
|
||||
#line 15 "./header_test.h"
|
||||
#line 13 "./header_test.h"
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "commit");}
|
||||
#line 16 "./header_test.h"
|
||||
#line 14 "./header_test.h"
|
||||
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");}
|
||||
#line 18 "./header_test.h"
|
||||
#line 16 "./header_test.h"
|
||||
|
||||
|
||||
exit(-1);
|
||||
@ -49,10 +47,10 @@ warn(void)
|
||||
}
|
||||
|
||||
/* exec sql whenever sqlerror do Finish ( msg ) ; */
|
||||
#line 31 "./header_test.h"
|
||||
#line 29 "./header_test.h"
|
||||
|
||||
/* exec sql whenever sql_warning do warn ( ) ; */
|
||||
#line 34 "./header_test.h"
|
||||
#line 32 "./header_test.h"
|
||||
|
||||
|
||||
#line 4 "test3.pgc"
|
||||
|
@ -199,10 +199,6 @@ main (void)
|
||||
#line 92 "test5.pgc"
|
||||
|
||||
|
||||
i=a.t[0];
|
||||
a.t[0]=a.t[1];
|
||||
a.t[1]=i;
|
||||
|
||||
printf ("name=%s, accs=%d byte=", empl.name, a.accs);
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
@ -212,7 +208,7 @@ main (void)
|
||||
}
|
||||
printf("\n");
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");}
|
||||
#line 106 "test5.pgc"
|
||||
#line 102 "test5.pgc"
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
name=first user , accs=320 byte=\001m\000\212
|
||||
name=first user , accs=320 byte=\001m\000\212
|
||||
name=first user , accs=320 byte=(1)(155)(0)(212)
|
||||
name=first user , accs=16385 byte=(1)(155)(0)(212)
|
||||
|
@ -190,21 +190,21 @@ int main(void)
|
||||
#line 74 "init.pgc"
|
||||
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
|
||||
int f=fa();
|
||||
|
||||
#ifdef _cplusplus
|
||||
/* exec sql begin declare section */
|
||||
/* compile error */
|
||||
|
||||
#line 82 "init.pgc"
|
||||
#line 80 "init.pgc"
|
||||
int k = N : : i ;
|
||||
/* exec sql end declare section */
|
||||
#line 83 "init.pgc"
|
||||
#line 81 "init.pgc"
|
||||
|
||||
#endif
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
|
||||
/* exec sql whenever sqlerror do fa ( ) ; */
|
||||
#line 86 "init.pgc"
|
||||
|
||||
|
@ -7,8 +7,6 @@
|
||||
/* End of automatic include section */
|
||||
|
||||
#line 1 "dt_test.pgc"
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c,v 1.1 2006/08/02 14:14:03 meskes Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -24,7 +22,7 @@
|
||||
|
||||
|
||||
|
||||
#line 10 "dt_test.pgc"
|
||||
#line 8 "dt_test.pgc"
|
||||
|
||||
|
||||
int
|
||||
@ -36,19 +34,19 @@ main(void)
|
||||
|
||||
|
||||
|
||||
#line 16 "dt_test.pgc"
|
||||
#line 14 "dt_test.pgc"
|
||||
date date1 ;
|
||||
|
||||
#line 17 "dt_test.pgc"
|
||||
#line 15 "dt_test.pgc"
|
||||
timestamp ts1 ;
|
||||
|
||||
#line 18 "dt_test.pgc"
|
||||
#line 16 "dt_test.pgc"
|
||||
interval iv1 ;
|
||||
|
||||
#line 19 "dt_test.pgc"
|
||||
#line 17 "dt_test.pgc"
|
||||
char * text ;
|
||||
/* exec sql end declare section */
|
||||
#line 20 "dt_test.pgc"
|
||||
#line 18 "dt_test.pgc"
|
||||
|
||||
date date2;
|
||||
int mdy[3] = { 4, 19, 1998 };
|
||||
@ -59,25 +57,25 @@ main(void)
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
/* exec sql whenever sqlerror do sqlprint ( ) ; */
|
||||
#line 29 "dt_test.pgc"
|
||||
#line 27 "dt_test.pgc"
|
||||
|
||||
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
|
||||
#line 30 "dt_test.pgc"
|
||||
#line 28 "dt_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 30 "dt_test.pgc"
|
||||
#line 28 "dt_test.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "create table date_test ( d date , ts timestamp , iv interval ) ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 31 "dt_test.pgc"
|
||||
#line 29 "dt_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 31 "dt_test.pgc"
|
||||
#line 29 "dt_test.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 32 "dt_test.pgc"
|
||||
#line 30 "dt_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 32 "dt_test.pgc"
|
||||
#line 30 "dt_test.pgc"
|
||||
|
||||
|
||||
date1 = PGTYPESdate_from_asc(d1, NULL);
|
||||
@ -88,10 +86,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
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 37 "dt_test.pgc"
|
||||
#line 35 "dt_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 37 "dt_test.pgc"
|
||||
#line 35 "dt_test.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from date_test where d = ? ",
|
||||
@ -103,10 +101,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_interval,&(iv1),(long)1,(long)1,sizeof(interval),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 39 "dt_test.pgc"
|
||||
#line 37 "dt_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 39 "dt_test.pgc"
|
||||
#line 37 "dt_test.pgc"
|
||||
|
||||
|
||||
text = PGTYPESdate_to_asc(date1);
|
||||
@ -425,16 +423,16 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
free(text);
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "rollback");
|
||||
#line 356 "dt_test.pgc"
|
||||
#line 354 "dt_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 356 "dt_test.pgc"
|
||||
#line 354 "dt_test.pgc"
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");
|
||||
#line 357 "dt_test.pgc"
|
||||
#line 355 "dt_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 357 "dt_test.pgc"
|
||||
#line 355 "dt_test.pgc"
|
||||
|
||||
|
||||
return (0);
|
||||
|
@ -2,29 +2,29 @@
|
||||
[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 31: QUERY: create table date_test ( d date , ts timestamp , iv interval ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 29: QUERY: create table date_test ( d date , ts timestamp , iv interval ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 31 Ok: CREATE TABLE
|
||||
[NO_PID]: ECPGexecute line 29 Ok: CREATE TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 32: QUERY: set datestyle to iso on connection regress1
|
||||
[NO_PID]: ECPGexecute line 30: QUERY: set datestyle to iso on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 32 Ok: SET
|
||||
[NO_PID]: ECPGexecute line 30 Ok: SET
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 37: QUERY: insert into date_test ( d , ts , iv ) values( date '1966-01-17' , timestamp '2000-07-12 17:34:29' , '2003-02-28 12:34' :: timestamp - 'Mon Jan 17 1966' :: timestamp ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 35: QUERY: insert into date_test ( d , ts , iv ) values( date '1966-01-17' , timestamp '2000-07-12 17:34:29' , '2003-02-28 12:34' :: timestamp - 'Mon Jan 17 1966' :: timestamp ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 37 Ok: INSERT 0 1
|
||||
[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 39: QUERY: select * from date_test where d = date '1966-01-17' on connection regress1
|
||||
[NO_PID]: ECPGexecute line 37: QUERY: select * from date_test where d = date '1966-01-17' on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 39: Correctly got 1 tuples with 3 fields
|
||||
[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 3 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 39: RESULT: 1966-01-17 offset: 4 array: Yes
|
||||
[NO_PID]: ECPGget_data line 37: RESULT: 1966-01-17 offset: 4 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 39: RESULT: 2000-07-12 17:34:29 offset: 8 array: Yes
|
||||
[NO_PID]: ECPGget_data line 37: RESULT: 2000-07-12 17:34:29 offset: 8 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 39: RESULT: 13556 days 12:34:00 offset: 12 array: Yes
|
||||
[NO_PID]: ECPGget_data line 37: RESULT: 13556 days 12:34:00 offset: 12 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGtrans line 356 action = rollback connection = regress1
|
||||
[NO_PID]: ECPGtrans line 354 action = rollback connection = regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: Connection regress1 closed.
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -7,8 +7,6 @@
|
||||
/* End of automatic include section */
|
||||
|
||||
#line 1 "num_test.pgc"
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c,v 1.1 2006/08/02 14:14:03 meskes Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pgtypes_numeric.h>
|
||||
@ -22,7 +20,7 @@
|
||||
|
||||
|
||||
|
||||
#line 8 "num_test.pgc"
|
||||
#line 6 "num_test.pgc"
|
||||
|
||||
|
||||
int
|
||||
@ -34,36 +32,36 @@ main(void)
|
||||
|
||||
/* = {0, 0, 0, 0, 0, NULL, NULL} ; */
|
||||
|
||||
#line 16 "num_test.pgc"
|
||||
#line 14 "num_test.pgc"
|
||||
numeric * des ;
|
||||
/* exec sql end declare section */
|
||||
#line 18 "num_test.pgc"
|
||||
#line 16 "num_test.pgc"
|
||||
|
||||
double d;
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
/* exec sql whenever sqlerror do sqlprint ( ) ; */
|
||||
#line 22 "num_test.pgc"
|
||||
#line 20 "num_test.pgc"
|
||||
|
||||
|
||||
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
|
||||
#line 24 "num_test.pgc"
|
||||
#line 22 "num_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 24 "num_test.pgc"
|
||||
#line 22 "num_test.pgc"
|
||||
|
||||
|
||||
{ ECPGsetcommit(__LINE__, "off", NULL);
|
||||
#line 26 "num_test.pgc"
|
||||
#line 24 "num_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 26 "num_test.pgc"
|
||||
#line 24 "num_test.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 27 "num_test.pgc"
|
||||
#line 25 "num_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 27 "num_test.pgc"
|
||||
#line 25 "num_test.pgc"
|
||||
|
||||
|
||||
value1 = PGTYPESnumeric_new();
|
||||
@ -92,10 +90,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
{ 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 52 "num_test.pgc"
|
||||
#line 50 "num_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 52 "num_test.pgc"
|
||||
#line 50 "num_test.pgc"
|
||||
|
||||
|
||||
value2 = PGTYPESnumeric_from_asc("2369.7", NULL);
|
||||
@ -105,10 +103,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
{ 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 58 "num_test.pgc"
|
||||
#line 56 "num_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 58 "num_test.pgc"
|
||||
#line 56 "num_test.pgc"
|
||||
|
||||
|
||||
PGTYPESnumeric_mul(res, des, res);
|
||||
@ -128,16 +126,16 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
PGTYPESnumeric_free(res);
|
||||
|
||||
{ ECPGtrans(__LINE__, NULL, "rollback");
|
||||
#line 76 "num_test.pgc"
|
||||
#line 74 "num_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 76 "num_test.pgc"
|
||||
#line 74 "num_test.pgc"
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");
|
||||
#line 77 "num_test.pgc"
|
||||
#line 75 "num_test.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 77 "num_test.pgc"
|
||||
#line 75 "num_test.pgc"
|
||||
|
||||
|
||||
return (0);
|
||||
|
@ -2,23 +2,23 @@
|
||||
[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]: ECPGsetcommit line 26 action = off connection = regress1
|
||||
[NO_PID]: ECPGsetcommit line 24 action = off connection = regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 27: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 25: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 27 Ok: CREATE TABLE
|
||||
[NO_PID]: ECPGexecute line 25 Ok: CREATE TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 52: QUERY: insert into test ( text , num ) values( 'test' , 2369.7 ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 50: QUERY: insert into test ( text , num ) values( 'test' , 2369.7 ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
|
||||
[NO_PID]: ECPGexecute line 50 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 58: QUERY: select num from test where text = 'test' on connection regress1
|
||||
[NO_PID]: ECPGexecute line 56: QUERY: select num from test where text = 'test' on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 58: Correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: ECPGexecute line 56: Correctly got 1 tuples with 1 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 58: RESULT: 2369.7000000 offset: 28 array: Yes
|
||||
[NO_PID]: ECPGget_data line 56: RESULT: 2369.7000000 offset: 28 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGtrans line 76 action = rollback connection = regress1
|
||||
[NO_PID]: ECPGtrans line 74 action = rollback connection = regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: Connection regress1 closed.
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -33,6 +33,7 @@ main(void)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#line 8 "desc.pgc"
|
||||
char * stmt1 = "INSERT INTO test1 VALUES (?, ?)" ;
|
||||
@ -54,73 +55,76 @@ main(void)
|
||||
|
||||
#line 15 "desc.pgc"
|
||||
int val2null = - 1 ;
|
||||
/* exec sql end declare section */
|
||||
|
||||
#line 16 "desc.pgc"
|
||||
int ind1 , ind2 ;
|
||||
/* exec sql end declare section */
|
||||
#line 17 "desc.pgc"
|
||||
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
|
||||
ECPGallocate_desc(__LINE__, "indesc");
|
||||
#line 20 "desc.pgc"
|
||||
#line 21 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();
|
||||
#line 20 "desc.pgc"
|
||||
#line 21 "desc.pgc"
|
||||
|
||||
ECPGallocate_desc(__LINE__, "outdesc");
|
||||
#line 21 "desc.pgc"
|
||||
#line 22 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();
|
||||
#line 21 "desc.pgc"
|
||||
#line 22 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
|
||||
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||
|
||||
#line 23 "desc.pgc"
|
||||
#line 24 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 23 "desc.pgc"
|
||||
#line 24 "desc.pgc"
|
||||
|
||||
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
||||
ECPGt_char,&(val2),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_indicator,
|
||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||
|
||||
#line 24 "desc.pgc"
|
||||
#line 25 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 24 "desc.pgc"
|
||||
#line 25 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
|
||||
#line 26 "desc.pgc"
|
||||
#line 27 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 26 "desc.pgc"
|
||||
#line 27 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test1 ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 28 "desc.pgc"
|
||||
#line 29 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 28 "desc.pgc"
|
||||
#line 29 "desc.pgc"
|
||||
|
||||
{ ECPGprepare(__LINE__, "foo1" , stmt1);
|
||||
#line 29 "desc.pgc"
|
||||
#line 30 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 29 "desc.pgc"
|
||||
#line 30 "desc.pgc"
|
||||
|
||||
{ ECPGprepare(__LINE__, "foo2" , stmt2);
|
||||
#line 30 "desc.pgc"
|
||||
#line 31 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 30 "desc.pgc"
|
||||
#line 31 "desc.pgc"
|
||||
|
||||
{ ECPGprepare(__LINE__, "foo3" , stmt3);
|
||||
#line 31 "desc.pgc"
|
||||
#line 32 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 31 "desc.pgc"
|
||||
#line 32 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
|
||||
@ -128,28 +132,28 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
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 33 "desc.pgc"
|
||||
#line 34 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 33 "desc.pgc"
|
||||
#line 34 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
|
||||
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
|
||||
|
||||
#line 35 "desc.pgc"
|
||||
#line 36 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 35 "desc.pgc"
|
||||
#line 36 "desc.pgc"
|
||||
|
||||
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
||||
ECPGt_char,&(val2),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_indicator,
|
||||
ECPGt_int,&(val2null),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||
|
||||
#line 36 "desc.pgc"
|
||||
#line 37 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 36 "desc.pgc"
|
||||
#line 37 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
|
||||
@ -157,28 +161,28 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
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 38 "desc.pgc"
|
||||
#line 39 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 38 "desc.pgc"
|
||||
#line 39 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
|
||||
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||
|
||||
#line 40 "desc.pgc"
|
||||
#line 41 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 40 "desc.pgc"
|
||||
#line 41 "desc.pgc"
|
||||
|
||||
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
||||
ECPGt_char,&(val2),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_indicator,
|
||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||
|
||||
#line 41 "desc.pgc"
|
||||
#line 42 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 41 "desc.pgc"
|
||||
#line 42 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "?",
|
||||
@ -188,83 +192,84 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
|
||||
ECPGt_descriptor, "outdesc", 0L, 0L, 0L,
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 43 "desc.pgc"
|
||||
#line 44 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 43 "desc.pgc"
|
||||
#line 44 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGget_desc(__LINE__, "outdesc", 1,ECPGd_data,
|
||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_EODT);
|
||||
|
||||
#line 45 "desc.pgc"
|
||||
#line 46 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 45 "desc.pgc"
|
||||
#line 46 "desc.pgc"
|
||||
|
||||
printf("output = %s\n", val2output);
|
||||
|
||||
/* declare c1 cursor for ? */
|
||||
#line 48 "desc.pgc"
|
||||
#line 49 "desc.pgc"
|
||||
|
||||
{ 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 49 "desc.pgc"
|
||||
#line 50 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 49 "desc.pgc"
|
||||
#line 50 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c1", ECPGt_EOIT,
|
||||
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int),
|
||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char),
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
|
||||
#line 51 "desc.pgc"
|
||||
ECPGt_int,&(ind2),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
||||
#line 52 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 51 "desc.pgc"
|
||||
#line 52 "desc.pgc"
|
||||
|
||||
printf("val1=%d val2=%s\n", val1output, val2output);
|
||||
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);
|
||||
#line 54 "desc.pgc"
|
||||
#line 56 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 54 "desc.pgc"
|
||||
#line 56 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGset_desc_header(__LINE__, "indesc", (int)(1));
|
||||
|
||||
#line 56 "desc.pgc"
|
||||
#line 58 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 56 "desc.pgc"
|
||||
#line 58 "desc.pgc"
|
||||
|
||||
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
|
||||
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
|
||||
|
||||
#line 57 "desc.pgc"
|
||||
#line 59 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 57 "desc.pgc"
|
||||
#line 59 "desc.pgc"
|
||||
|
||||
|
||||
/* declare c2 cursor for ? */
|
||||
#line 59 "desc.pgc"
|
||||
#line 61 "desc.pgc"
|
||||
|
||||
{ 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 60 "desc.pgc"
|
||||
#line 62 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 60 "desc.pgc"
|
||||
#line 62 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c2", ECPGt_EOIT,
|
||||
@ -272,18 +277,18 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char),
|
||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
||||
#line 62 "desc.pgc"
|
||||
#line 64 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 62 "desc.pgc"
|
||||
#line 64 "desc.pgc"
|
||||
|
||||
printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "close c2", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 65 "desc.pgc"
|
||||
#line 67 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 65 "desc.pgc"
|
||||
#line 67 "desc.pgc"
|
||||
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test1 where a = 2 ", ECPGt_EOIT,
|
||||
@ -291,37 +296,37 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char),
|
||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
||||
#line 67 "desc.pgc"
|
||||
#line 69 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 67 "desc.pgc"
|
||||
#line 69 "desc.pgc"
|
||||
|
||||
printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test1 ", ECPGt_EOIT, ECPGt_EORT);
|
||||
#line 70 "desc.pgc"
|
||||
#line 72 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 70 "desc.pgc"
|
||||
#line 72 "desc.pgc"
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");
|
||||
#line 71 "desc.pgc"
|
||||
#line 73 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();}
|
||||
#line 71 "desc.pgc"
|
||||
#line 73 "desc.pgc"
|
||||
|
||||
|
||||
ECPGdeallocate_desc(__LINE__, "indesc");
|
||||
#line 73 "desc.pgc"
|
||||
#line 75 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();
|
||||
#line 73 "desc.pgc"
|
||||
#line 75 "desc.pgc"
|
||||
|
||||
ECPGdeallocate_desc(__LINE__, "outdesc");
|
||||
#line 74 "desc.pgc"
|
||||
#line 76 "desc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint();
|
||||
#line 74 "desc.pgc"
|
||||
#line 76 "desc.pgc"
|
||||
|
||||
|
||||
return 0;
|
||||
|
@ -2,77 +2,77 @@
|
||||
[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 28: QUERY: create table test1 ( a int , b text ) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 29: QUERY: create table test1 ( a int , b text ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 28 Ok: CREATE TABLE
|
||||
[NO_PID]: ECPGexecute line 29 Ok: CREATE TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGprepare line 29: QUERY: INSERT INTO test1 VALUES (?, ?)
|
||||
[NO_PID]: ECPGprepare line 30: QUERY: INSERT INTO test1 VALUES (?, ?)
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGprepare line 30: QUERY: SELECT * from test1 where a = ? and b = ?
|
||||
[NO_PID]: ECPGprepare line 31: QUERY: SELECT * from test1 where a = ? and b = ?
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGprepare line 31: QUERY: SELECT * from test1 where a = ?
|
||||
[NO_PID]: ECPGprepare line 32: QUERY: SELECT * from test1 where a = ?
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 33: QUERY: INSERT INTO test1 VALUES ('1', '''one''') on connection regress1
|
||||
[NO_PID]: ECPGexecute line 34: QUERY: INSERT INTO test1 VALUES ('1', '''one''') on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 33 Ok: INSERT 0 1
|
||||
[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 38: QUERY: INSERT INTO test1 VALUES ('2', null) on connection regress1
|
||||
[NO_PID]: ECPGexecute line 39: QUERY: INSERT INTO test1 VALUES ('2', null) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 38 Ok: INSERT 0 1
|
||||
[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 43: QUERY: SELECT * from test1 where a = '1' and b = '''one''' on connection regress1
|
||||
[NO_PID]: ECPGexecute line 44: QUERY: SELECT * from test1 where a = '1' and b = '''one''' on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 43: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: ECPGexecute line 44: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute putting result (1 tuples) into descriptor 'outdesc'
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 45: RESULT: 1 offset: -1 array: Yes
|
||||
[NO_PID]: ECPGget_data line 46: RESULT: 1 offset: -1 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 49: QUERY: declare c1 cursor for SELECT * from test1 where a = '1' and b = '''one''' on connection regress1
|
||||
[NO_PID]: ECPGexecute line 50: QUERY: declare c1 cursor for SELECT * from test1 where a = '1' and b = '''one''' on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 49 Ok: DECLARE CURSOR
|
||||
[NO_PID]: ECPGexecute line 50 Ok: DECLARE CURSOR
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 51: QUERY: fetch next from c1 on connection regress1
|
||||
[NO_PID]: ECPGexecute line 52: QUERY: fetch next from c1 on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 51: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 51: RESULT: 1 offset: 4 array: Yes
|
||||
[NO_PID]: ECPGget_data line 52: RESULT: 1 offset: 4 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 51: RESULT: 'one' offset: -1 array: Yes
|
||||
[NO_PID]: ECPGget_data line 52: RESULT: 'one' offset: -1 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 54: QUERY: close c1 on connection regress1
|
||||
[NO_PID]: ECPGexecute line 56: QUERY: close c1 on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 54 Ok: CLOSE CURSOR
|
||||
[NO_PID]: ECPGexecute line 56 Ok: CLOSE CURSOR
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 60: QUERY: declare c2 cursor for SELECT * from test1 where a = '2' on connection regress1
|
||||
[NO_PID]: ECPGexecute line 62: QUERY: declare c2 cursor for SELECT * from test1 where a = '2' on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 60 Ok: DECLARE CURSOR
|
||||
[NO_PID]: ECPGexecute line 62 Ok: DECLARE CURSOR
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 62: QUERY: fetch next from c2 on connection regress1
|
||||
[NO_PID]: ECPGexecute line 64: QUERY: fetch next from c2 on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 62: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 62: RESULT: 2 offset: 4 array: Yes
|
||||
[NO_PID]: ECPGget_data line 64: RESULT: 2 offset: 4 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 62: RESULT: offset: -1 array: Yes
|
||||
[NO_PID]: ECPGget_data line 64: RESULT: offset: -1 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 65: QUERY: close c2 on connection regress1
|
||||
[NO_PID]: ECPGexecute line 67: QUERY: close c2 on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 65 Ok: CLOSE CURSOR
|
||||
[NO_PID]: ECPGexecute line 67 Ok: CLOSE CURSOR
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 67: QUERY: select * from test1 where a = 2 on connection regress1
|
||||
[NO_PID]: ECPGexecute line 69: QUERY: select * from test1 where a = 2 on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 67: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: ECPGexecute line 69: Correctly got 1 tuples with 2 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 67: RESULT: 2 offset: 4 array: Yes
|
||||
[NO_PID]: ECPGget_data line 69: RESULT: 2 offset: 4 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 67: RESULT: offset: -1 array: Yes
|
||||
[NO_PID]: ECPGget_data line 69: RESULT: offset: -1 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 70: QUERY: drop table test1 on connection regress1
|
||||
[NO_PID]: ECPGexecute line 72: QUERY: drop table test1 on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 70 Ok: DROP TABLE
|
||||
[NO_PID]: ECPGexecute line 72 Ok: DROP TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: Connection regress1 closed.
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -1,4 +1,4 @@
|
||||
output = 1
|
||||
val1=1 val2='one'
|
||||
val1=1 (ind1: 0) val2='one' (ind2: 0)
|
||||
val1=2 val2=null
|
||||
val1=2 val2=null
|
||||
|
@ -94,75 +94,240 @@ struct sqlca_t *ECPGget_sqlca(void);
|
||||
int main(void)
|
||||
{
|
||||
/* exec sql begin declare section */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* char **d8=0; */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* int *i8=0; */
|
||||
|
||||
|
||||
#line 9 "dynalloc.pgc"
|
||||
char ** cpp = 0 ;
|
||||
int * d1 = 0 ;
|
||||
|
||||
#line 10 "dynalloc.pgc"
|
||||
int * ipointer = 0 ;
|
||||
/* exec sql end declare section */
|
||||
double * d2 = 0 ;
|
||||
|
||||
#line 11 "dynalloc.pgc"
|
||||
char ** d3 = 0 ;
|
||||
|
||||
#line 12 "dynalloc.pgc"
|
||||
char ** d4 = 0 ;
|
||||
|
||||
#line 13 "dynalloc.pgc"
|
||||
char ** d5 = 0 ;
|
||||
|
||||
#line 14 "dynalloc.pgc"
|
||||
char ** d6 = 0 ;
|
||||
|
||||
#line 15 "dynalloc.pgc"
|
||||
char ** d7 = 0 ;
|
||||
|
||||
#line 17 "dynalloc.pgc"
|
||||
char ** d9 = 0 ;
|
||||
|
||||
#line 18 "dynalloc.pgc"
|
||||
int * i1 = 0 ;
|
||||
|
||||
#line 19 "dynalloc.pgc"
|
||||
int * i2 = 0 ;
|
||||
|
||||
#line 20 "dynalloc.pgc"
|
||||
int * i3 = 0 ;
|
||||
|
||||
#line 21 "dynalloc.pgc"
|
||||
int * i4 = 0 ;
|
||||
|
||||
#line 22 "dynalloc.pgc"
|
||||
int * i5 = 0 ;
|
||||
|
||||
#line 23 "dynalloc.pgc"
|
||||
int * i6 = 0 ;
|
||||
|
||||
#line 24 "dynalloc.pgc"
|
||||
int * i7 = 0 ;
|
||||
|
||||
#line 26 "dynalloc.pgc"
|
||||
int * i9 = 0 ;
|
||||
/* exec sql end declare section */
|
||||
#line 27 "dynalloc.pgc"
|
||||
|
||||
int i;
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
|
||||
/* exec sql whenever sqlerror do sqlprint ( ) ; */
|
||||
#line 16 "dynalloc.pgc"
|
||||
#line 32 "dynalloc.pgc"
|
||||
|
||||
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
|
||||
#line 17 "dynalloc.pgc"
|
||||
#line 33 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 17 "dynalloc.pgc"
|
||||
#line 33 "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);
|
||||
#line 35 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 35 "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);
|
||||
#line 36 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 36 "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);
|
||||
#line 37 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 37 "dynalloc.pgc"
|
||||
|
||||
|
||||
ECPGallocate_desc(__LINE__, "mydesc");
|
||||
#line 19 "dynalloc.pgc"
|
||||
#line 39 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );
|
||||
#line 19 "dynalloc.pgc"
|
||||
#line 39 "dynalloc.pgc"
|
||||
|
||||
{ ECPGdo(__LINE__, 0, 1, NULL, "select tablename from pg_tables ", 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 20 "dynalloc.pgc"
|
||||
#line 40 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 20 "dynalloc.pgc"
|
||||
#line 40 "dynalloc.pgc"
|
||||
|
||||
{ ECPGget_desc(__LINE__, "mydesc", 1,ECPGd_indicator,
|
||||
ECPGt_int,&(ipointer),(long)1,(long)0,sizeof(int), ECPGd_data,
|
||||
ECPGt_char,&(cpp),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
|
||||
ECPGt_int,&(i1),(long)1,(long)0,sizeof(int), ECPGd_data,
|
||||
ECPGt_int,&(d1),(long)1,(long)0,sizeof(int), ECPGd_EODT);
|
||||
|
||||
#line 21 "dynalloc.pgc"
|
||||
#line 41 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 21 "dynalloc.pgc"
|
||||
#line 41 "dynalloc.pgc"
|
||||
|
||||
{ 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 42 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 42 "dynalloc.pgc"
|
||||
|
||||
{ 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 43 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 43 "dynalloc.pgc"
|
||||
|
||||
{ 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 44 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 44 "dynalloc.pgc"
|
||||
|
||||
{ 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 45 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 45 "dynalloc.pgc"
|
||||
|
||||
{ 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 46 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 46 "dynalloc.pgc"
|
||||
|
||||
{ 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 47 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 47 "dynalloc.pgc"
|
||||
|
||||
/* skip box for now */
|
||||
/* exec sql get descriptor mydesc value 8 :d8=DATA, :i8=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 50 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 50 "dynalloc.pgc"
|
||||
|
||||
|
||||
printf("Result ");
|
||||
printf("Result:\n");
|
||||
for (i=0;i<sqlca.sqlerrd[2];++i)
|
||||
{
|
||||
if (ipointer[i]) printf("NULL, ");
|
||||
else printf("'%s', ",cpp[i]);
|
||||
if (i1[i]) printf("NULL, ");
|
||||
else printf("%d, ",d1[i]);
|
||||
|
||||
if (i2[i]) printf("NULL, ");
|
||||
else printf("%f, ",d2[i]);
|
||||
|
||||
if (i3[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d3[i]);
|
||||
|
||||
if (i4[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d4[i]);
|
||||
|
||||
if (i5[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d5[i]);
|
||||
|
||||
if (i6[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d6[i]);
|
||||
|
||||
if (i7[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d7[i]);
|
||||
|
||||
if (i9[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d9[i]);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
ECPGfree_auto_mem();
|
||||
printf("\n");
|
||||
|
||||
ECPGdeallocate_desc(__LINE__, "mydesc");
|
||||
#line 32 "dynalloc.pgc"
|
||||
#line 84 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );
|
||||
#line 32 "dynalloc.pgc"
|
||||
#line 84 "dynalloc.pgc"
|
||||
|
||||
{ ECPGdisconnect(__LINE__, "CURRENT");
|
||||
#line 33 "dynalloc.pgc"
|
||||
#line 85 "dynalloc.pgc"
|
||||
|
||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||
#line 33 "dynalloc.pgc"
|
||||
#line 85 "dynalloc.pgc"
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,94 +2,77 @@
|
||||
[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 20: QUERY: select tablename from pg_tables on connection regress1
|
||||
[NO_PID]: ECPGexecute line 35: QUERY: 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 ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 20: Correctly got 40 tuples with 1 fields
|
||||
[NO_PID]: ECPGexecute line 35 Ok: CREATE TABLE
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute putting result (40 tuples) into descriptor 'mydesc'
|
||||
[NO_PID]: ECPGexecute line 36: QUERY: 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' ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 36 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 37: QUERY: 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 ) on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 37 Ok: INSERT 0 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 40: QUERY: select a , b , c , d , e , f , g , h , i from test order by a on connection regress1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute line 40: Correctly got 2 tuples with 9 fields
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGexecute putting result (2 tuples) into descriptor 'mydesc'
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 1
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGstore_result: line 21: allocating 656 bytes for 40 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: sql_parts offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 41: RESULT: 1 offset: 4 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: sql_sizing offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 41: RESULT: 2 offset: 4 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: sql_sizing_profiles offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 2
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_authid offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 42: RESULT: 23.456 offset: 8 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: sql_features offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 42: RESULT: 2.446 offset: 8 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: sql_implementation_info offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 3
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: sql_languages offset: 0 array: Yes
|
||||
[NO_PID]: ECPGstore_result: line 43: allocating 21 bytes for 2 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 43: RESULT: varchar offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: sql_packages offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 43: RESULT: offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_statistic offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 4
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_type offset: 0 array: Yes
|
||||
[NO_PID]: ECPGstore_result: line 44: allocating 16 bytes for 2 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 44: RESULT: v offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_attribute offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 44: RESULT: v offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_proc offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 5
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_class offset: 0 array: Yes
|
||||
[NO_PID]: ECPGstore_result: line 45: allocating 22 bytes for 2 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 45: RESULT: c offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_autovacuum offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 45: RESULT: c offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_attrdef offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 6
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_constraint offset: 0 array: Yes
|
||||
[NO_PID]: ECPGstore_result: line 46: allocating 70 bytes for 2 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 46: RESULT: Mon Mar 03 11:33:07 2003 PST offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_inherits offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 46: RESULT: Mon Mar 03 11:33:07 2003 PST offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_index offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 7
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_operator offset: 0 array: Yes
|
||||
[NO_PID]: ECPGstore_result: line 47: allocating 16 bytes for 2 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 47: RESULT: t offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_opclass offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 47: RESULT: f offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_am offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_desc: reading items for tuple 9
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_amop offset: 0 array: Yes
|
||||
[NO_PID]: ECPGstore_result: line 50: allocating 46 bytes for 2 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 50: RESULT: 2001:4f8:3:ba:2e0:81ff:fe22:d1f1 offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_amproc offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_language offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_largeobject offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_aggregate offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_rewrite offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_trigger offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_listener offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_description offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_cast offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_namespace offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_conversion offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_depend offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_tablespace offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_pltemplate offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_shdepend offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_shdescription offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_database offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ECPGget_data line 21: RESULT: pg_auth_members offset: 0 array: Yes
|
||||
[NO_PID]: ECPGget_data line 50: RESULT: offset: 0 array: Yes
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
[NO_PID]: ecpg_finish: Connection regress1 closed.
|
||||
[NO_PID]: sqlca: code: 0, state: 00000
|
||||
|
@ -1 +1,4 @@
|
||||
Result 'sql_parts', 'sql_sizing', 'sql_sizing_profiles', 'pg_authid', 'sql_features', 'sql_implementation_info', 'sql_languages', 'sql_packages', 'pg_statistic', 'pg_type', 'pg_attribute', 'pg_proc', 'pg_class', 'pg_autovacuum', 'pg_attrdef', 'pg_constraint', 'pg_inherits', 'pg_index', 'pg_operator', 'pg_opclass', 'pg_am', 'pg_amop', 'pg_amproc', 'pg_language', 'pg_largeobject', 'pg_aggregate', 'pg_rewrite', 'pg_trigger', 'pg_listener', 'pg_description', 'pg_cast', 'pg_namespace', 'pg_conversion', 'pg_depend', 'pg_tablespace', 'pg_pltemplate', 'pg_shdepend', 'pg_shdescription', 'pg_database', 'pg_auth_members',
|
||||
Result:
|
||||
1, 23.456000, 'varchar', 'v', 'c ', 'Mon Mar 03 11:33:07 2003 PST', 't', '2001:4f8:3:ba:2e0:81ff:fe22:d1f1',
|
||||
2, 2.446000, NULL, 'v', 'c ', 'Mon Mar 03 11:33:07 2003 PST', 'f', NULL,
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.1 2006/08/02 13:53:45 meskes Exp $
|
||||
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.2 2006/08/03 13:11:03 meskes Exp $
|
||||
|
||||
me=`basename $0`
|
||||
|
||||
@ -98,16 +98,17 @@ for i in \
|
||||
formatted=`echo $i | awk '{printf "%-38.38s", $1;}'`
|
||||
$ECHO_N "testing $formatted ... $ECHO_C"
|
||||
|
||||
runprg=${i/.pgc/}
|
||||
outfile_stderr=$outputdir/${runprg//\//-}.stderr
|
||||
outfile_stdout=$outputdir/${runprg//\//-}.stdout
|
||||
cp $runprg.c "$outputdir/${runprg//\//-}.c"
|
||||
runprg=${i%.pgc}
|
||||
outprg=`echo $runprg | sed -e's/\//-/'`
|
||||
outfile_stderr=$outputdir/$outprg.stderr
|
||||
outfile_stdout=$outputdir/$outprg.stdout
|
||||
cp $runprg.c "$outputdir/$outprg.c"
|
||||
# echo "$runprg > $outfile_stdout 2> $outfile_stderr"
|
||||
$runprg > "$outfile_stdout" 2> "$outfile_stderr"
|
||||
DIFFER=""
|
||||
diff -u expected/${runprg//\//-}.stderr "$outputdir"/${runprg//\//-}.stderr >/dev/null 2>&1 || DIFFER="$DIFFER, log"
|
||||
diff -u expected/${runprg//\//-}.stdout "$outputdir"/${runprg//\//-}.stdout >/dev/null 2>&1 || DIFFER="$DIFFER, output"
|
||||
diff -u expected/${runprg//\//-}.c "$outputdir"/${runprg//\//-}.c >/dev/null 2>&1 || DIFFER="$DIFFER, source"
|
||||
diff -c3 expected/$outprg.stderr "$outputdir"/$outprg.stderr >/dev/null 2>&1 || DIFFER="$DIFFER, log"
|
||||
diff -c3 expected/$outprg.stdout "$outputdir"/$outprg.stdout >/dev/null 2>&1 || DIFFER="$DIFFER, output"
|
||||
diff -c3 expected/$outprg.c "$outputdir"/$outprg.c >/dev/null 2>&1 || DIFFER="$DIFFER, source"
|
||||
DIFFER=${DIFFER#, }
|
||||
if [ "x$DIFFER" = "x" ]; then
|
||||
echo ok
|
||||
@ -116,7 +117,7 @@ for i in \
|
||||
fi
|
||||
done
|
||||
|
||||
diff -ur expected/ $outputdir > regression.diff && rm regression.diff
|
||||
diff -c3 -r expected/ $outputdir > regression.diff && rm regression.diff
|
||||
|
||||
[ $? -ne 0 ] && exit
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/test/pgtypeslib/dt_test.pgc,v 1.1 2006/08/02 14:14:04 meskes Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/test/pgtypeslib/num_test.pgc,v 1.1 2006/08/02 14:14:04 meskes Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pgtypes_numeric.h>
|
||||
|
@ -13,6 +13,7 @@ main(void)
|
||||
char val2[] = "one", val2output[] = "AAA";
|
||||
int val1output = 2, val2i = 0;
|
||||
int val2null = -1;
|
||||
int ind1, ind2;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
||||
ECPGdebug(1, stderr);
|
||||
@ -48,8 +49,9 @@ main(void)
|
||||
EXEC SQL DECLARE c1 CURSOR FOR foo2;
|
||||
EXEC SQL OPEN c1 USING DESCRIPTOR indesc;
|
||||
|
||||
EXEC SQL FETCH next FROM c1 INTO :val1output, :val2output;
|
||||
printf("val1=%d val2=%s\n", val1output, val2output);
|
||||
EXEC SQL FETCH next FROM c1 INTO :val1output:ind1, :val2output:ind2;
|
||||
printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",
|
||||
val1output, ind1, val2output, ind2);
|
||||
|
||||
EXEC SQL CLOSE c1;
|
||||
|
||||
|
@ -6,8 +6,24 @@ exec sql include ../regression;
|
||||
int main(void)
|
||||
{
|
||||
exec sql begin declare section;
|
||||
char **cpp=0;
|
||||
int *ipointer=0;
|
||||
int *d1=0;
|
||||
double *d2=0;
|
||||
char **d3=0;
|
||||
char **d4=0;
|
||||
char **d5=0;
|
||||
char **d6=0;
|
||||
char **d7=0;
|
||||
/* char **d8=0; */
|
||||
char **d9=0;
|
||||
int *i1=0;
|
||||
int *i2=0;
|
||||
int *i3=0;
|
||||
int *i4=0;
|
||||
int *i5=0;
|
||||
int *i6=0;
|
||||
int *i7=0;
|
||||
/* int *i8=0; */
|
||||
int *i9=0;
|
||||
exec sql end declare section;
|
||||
int i;
|
||||
|
||||
@ -16,15 +32,51 @@ int main(void)
|
||||
exec sql whenever sqlerror do sqlprint();
|
||||
exec sql connect to REGRESSDB1;
|
||||
|
||||
exec sql allocate descriptor mydesc;
|
||||
exec sql select tablename into descriptor mydesc from pg_tables;
|
||||
exec sql get descriptor mydesc value 1 :cpp=DATA, :ipointer=INDICATOR;
|
||||
exec sql 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);
|
||||
exec sql 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');
|
||||
exec sql 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);
|
||||
|
||||
printf("Result ");
|
||||
exec sql allocate descriptor mydesc;
|
||||
exec sql select a,b,c,d,e,f,g,h,i into descriptor mydesc from test order by a;
|
||||
exec sql get descriptor mydesc value 1 :d1=DATA, :i1=INDICATOR;
|
||||
exec sql get descriptor mydesc value 2 :d2=DATA, :i2=INDICATOR;
|
||||
exec sql get descriptor mydesc value 3 :d3=DATA, :i3=INDICATOR;
|
||||
exec sql get descriptor mydesc value 4 :d4=DATA, :i4=INDICATOR;
|
||||
exec sql get descriptor mydesc value 5 :d5=DATA, :i5=INDICATOR;
|
||||
exec sql get descriptor mydesc value 6 :d6=DATA, :i6=INDICATOR;
|
||||
exec sql get descriptor mydesc value 7 :d7=DATA, :i7=INDICATOR;
|
||||
/* skip box for now */
|
||||
/* exec sql get descriptor mydesc value 8 :d8=DATA, :i8=INDICATOR; */
|
||||
exec sql get descriptor mydesc value 9 :d9=DATA, :i9=INDICATOR;
|
||||
|
||||
printf("Result:\n");
|
||||
for (i=0;i<sqlca.sqlerrd[2];++i)
|
||||
{
|
||||
if (ipointer[i]) printf("NULL, ");
|
||||
else printf("'%s', ",cpp[i]);
|
||||
if (i1[i]) printf("NULL, ");
|
||||
else printf("%d, ",d1[i]);
|
||||
|
||||
if (i2[i]) printf("NULL, ");
|
||||
else printf("%f, ",d2[i]);
|
||||
|
||||
if (i3[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d3[i]);
|
||||
|
||||
if (i4[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d4[i]);
|
||||
|
||||
if (i5[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d5[i]);
|
||||
|
||||
if (i6[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d6[i]);
|
||||
|
||||
if (i7[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d7[i]);
|
||||
|
||||
if (i9[i]) printf("NULL, ");
|
||||
else printf("'%s', ",d9[i]);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
ECPGfree_auto_mem();
|
||||
printf("\n");
|
||||
|
Reference in New Issue
Block a user