Commit 1f0a6cd6 authored by Michael Meskes's avatar Michael Meskes

Hopefully that's it. The remaining files for ecpg regression tests.

parent 6392518c
subdir = src/interfaces/ecpg/test/compat_informix
top_builddir = ../../../../..
include $(top_builddir)/src/Makefile.global
include ../Makefile.regress
# special informix compatiblity switches
ECPG += -C INFORMIX
ECPG_NOIND = $(ECPG) -r no_indicator
override LDFLAGS += -L../../compatlib
override LIBS += $(LIBS) -lecpg_compat
TESTS = test_informix test_informix.c \
test_informix2 test_informix2.c
all: $(TESTS)
test_informix.c: test_informix.pgc ../regression.h
$(ECPG) -o $@ -I$(srcdir) $<
test_informix2.c: test_informix2.pgc ../regression.h
$(ECPG_NOIND) -o $@ -I$(srcdir) $<
#include "sqltypes.h"
$include ../regression;
$define NUMBER 12;
static void openit(void);
static void dosqlprint(void) {
printf("doSQLprint: Error: %s\n", sqlca.sqlerrm.sqlerrmc);
}
int main(void)
{
$int i = 14;
$decimal j, m, n;
ECPGdebug(1, stderr);
$whenever sqlerror do dosqlprint();
$connect to REGRESSDB1;
if (sqlca.sqlcode != 0) exit(1);
$create table test(i int primary key, j int);
/* this INSERT works */
rsetnull(CDECIMALTYPE, (char *)&j);
$insert into test (i, j) values (7, :j);
$commit;
/* this INSERT should fail because i is a unique column */
$insert into test (i, j) values (7, NUMBER);
printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) $rollback;
$insert into test (i, j) values (:i, 1);
$commit;
/* this will fail (more than one row in subquery) */
$select i from test where j=(select j from test);
/* this however should be ok */
$select i from test where j=(select j from test limit 1);
printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) $rollback;
$declare c cursor for select * from test where i <= :i;
openit();
deccvint(0, &j);
while (1)
{
$fetch forward c into :i, :j;
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);
else
{
int a;
dectoint(&j, &a);
printf("%d %d\n", i, a);
}
}
deccvint(7, &j);
deccvint(14, &m);
decadd(&j, &m, &n);
$delete from test where i=:n;
printf("DELETE: %ld\n", sqlca.sqlcode);
$select 1 from test where i=14;
printf("Exists: %ld\n", sqlca.sqlcode);
$select 1 from test where i=147;
printf("Does not exist: %ld\n", sqlca.sqlcode);
$commit;
$drop table test;
$commit;
$close database;
return 0;
}
static void openit(void)
{
$open c;
}
#include <stdio.h>
#include <stdlib.h>
#include "sqltypes.h"
EXEC SQL include sqlca.h;
EXEC SQL include ../regression;
EXEC SQL DEFINE MAXDBLEN 30;
/* Check SQLCODE, and produce a "standard error" if it's wrong! */
static void sql_check(char *fn, char *caller, int ignore)
{
char errorstring[255];
if (SQLCODE == ignore)
return;
else
{
if (SQLCODE != 0)
{
sprintf(errorstring, "**SQL error %ld doing '%s' in function '%s'. [%s]",
SQLCODE, caller, fn, sqlca.sqlerrm.sqlerrmc);
fprintf(stderr, "%s", errorstring);
printf("%s\n", errorstring);
/* attempt a ROLLBACK */
EXEC SQL rollback;
if (SQLCODE == 0)
{
sprintf(errorstring, "Rollback successful.\n");
} else {
sprintf(errorstring, "Rollback failed with code %ld.\n", SQLCODE);
}
fprintf(stderr, "%s", errorstring);
printf("%s\n", errorstring);
exit(1);
}
}
}
int main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
int c;
timestamp d;
timestamp maxd;
char dbname[30];
EXEC SQL END DECLARE SECTION;
EXEC SQL whenever sqlerror sqlprint;
ECPGdebug(1, stderr);
/* if (strlen(REGRESSDB1) > MAXDBLEN) {
exit(1);
}
*/
strcpy(dbname, "regress1");
EXEC SQL connect to :dbname;
sql_check("main", "connect", 0);
EXEC SQL create table history (customerid integer, timestamp timestamp without time zone, action_taken char(5), narrative varchar(100));
sql_check("main", "create", 0);
EXEC SQL insert into history
(customerid, timestamp, action_taken, narrative)
values(1, '2003-05-07 13:28:34 CEST', 'test', 'test');
sql_check("main", "insert", 0);
EXEC SQL select max(timestamp)
into :maxd
from history;
sql_check("main", "select max", 100);
if (risnull(CDTIMETYPE, (char *) &maxd))
{
printf("Nothing on the history table\n\n");
exit(0);
}
EXEC SQL select customerid, timestamp
into :c, :d
from history
where timestamp = :maxd
limit 1;
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;
c++;
EXEC SQL insert into history
(customerid, timestamp, action_taken, narrative)
values(:c, :d, 'test', 'test');
sql_check("main", "update", 0);
EXEC SQL commit;
EXEC SQL drop table history;
sql_check("main", "drop", 0);
EXEC SQL commit;
EXEC SQL disconnect;
sql_check("main", "disconnect", 0);
printf("All OK!\n");
exit(0);
/*
Table "public.history"
Column | Type | Modifiers
--------------+-----------------------------+-----------
customerid | integer | not null
timestamp | timestamp without time zone | not null
action_taken | character(5) | not null
narrative | character varying(100) |
*/
}
subdir = src/interfaces/ecpg/test/complex
top_builddir = ../../../../..
include $(top_builddir)/src/Makefile.global
include ../Makefile.regress
TESTS = test1 test1.c \
test2 test2.c \
test3 test3.c \
test4 test4.c \
test5 test5.c
all: $(TESTS)
# test4 needs the -c option for the "EXEC SQL TYPE" construct
test4.c: test4.pgc ../regression.h
$(ECPG) -c -o $@ -I$(srcdir) $<
/* $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
Finish(char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
/* finish transaction */
exec sql rollback;
/* and remove test table */
exec sql drop table meskes;
exec sql commit;
exec sql disconnect;
exit(-1);
}
static void
warn(void)
{
fprintf(stderr, "Warning: At least one column was truncated\n");
}
exec sql whenever sqlerror
do
Finish(msg);
exec sql whenever sqlwarning
do
warn();
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
exec sql include ../regression;
/* just a test comment */ exec sql whenever sqlerror do PrintAndStop(msg);
exec sql whenever sqlwarning do warn();
static void PrintAndStop(char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
exit(-1);
}
static void warn(void)
{
fprintf(stderr, "Warning: At least one column was truncated\n");
}
/* comment */
exec sql define AMOUNT 6;
exec sql define NAMELEN 8;
exec sql type intarray is int[AMOUNT];
typedef int intarray[AMOUNT];
int
main(void)
{
exec sql begin declare section;
exec sql ifdef NAMELEN;
typedef char string[NAMELEN];
intarray amount;
int increment=100;
char name[AMOUNT][NAMELEN];
char letter[AMOUNT][1];
struct name_letter_struct
{
char name[NAMELEN];
int amount;
char letter;
} name_letter[AMOUNT];
#if 0
int not_used;
#endif
exec sql endif;
struct ind_struct
{
short a;
short b;
short c;
} ind[AMOUNT];
char command[128];
char *connection="pm";
int how_many;
char *user="regressuser1";
exec sql end declare section;
exec sql var name is string[AMOUNT];
char msg[128];
int i,j;
ECPGdebug(1, stderr);
strcpy(msg, "connect");
exec sql connect to REGRESSDB1 as main;
strcpy(msg, "connect");
exec sql connect to REGRESSDB2 as pm user :user;
strcpy(msg, "create");
exec sql at main create table "Test" (name char(NAMELEN), amount int, letter char(1));
exec sql create table "Test" (name char(NAMELEN), amount int, letter char(1));
strcpy(msg, "commit");
exec sql at main commit;
exec sql commit;
strcpy(msg, "set connection");
exec sql set connection to main;
strcpy(msg, "execute insert 1");
sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 1, 'f')");
exec sql execute immediate :command;
printf("New tuple got OID = %ld\n", sqlca.sqlerrd[1]);
sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 2, 't')");
exec sql execute immediate :command;
strcpy(msg, "execute insert 2");
sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''pm''', 1, 'f')");
exec sql at pm execute immediate :command;
strcpy(msg, "execute insert 3");
sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+10, letter from \"Test\"");
exec sql execute immediate :command;
printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
strcpy(msg, "execute insert 4");
sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+?, letter from \"Test\"");
exec sql prepare I from :command;
exec sql at pm execute I using :increment;
printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
strcpy(msg, "commit");
exec sql commit;
/* Start automatic transactioning for connection pm. */
exec sql at pm set autocommit to on;
exec sql at pm begin transaction;
strcpy(msg, "select");
exec sql select * into :name, :amount, :letter from "Test";
printf("Database: main\n");
for (i=0, how_many=j=sqlca.sqlerrd[2]; i<j; i++)
{
exec sql begin declare section;
char n[8], l = letter[i][0];
int a = amount[i];
exec sql end declare section;
strncpy(n, name[i], NAMELEN);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
amount[i]+=1000;
strcpy(msg, "insert");
exec sql at pm insert into "Test" (name, amount, letter) values (:n, :amount[i], :l);
}
strcpy(msg, "commit");
exec sql at pm commit;
sprintf (command, "select * from \"Test\"");
exec sql prepare F from :command;
exec sql declare CUR cursor for F;
strcpy(msg, "open");
exec sql open CUR;
strcpy(msg, "fetch");
exec sql fetch :how_many in CUR into :name, :amount, :letter;
printf("Database: main\n");
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
{
exec sql begin declare section;
char n[8], l = letter[i][0];
int a = amount[i];
exec sql end declare section;
strncpy(n, name[i], 8);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
exec sql close CUR;
strcpy(msg, "select");
exec sql at :connection select name, amount, letter into :name, :amount, :letter from "Test";
printf("Database: %s\n", connection);
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
strcpy(msg, "commit");
exec sql commit;
strcpy(msg, "select");
exec sql at pm select name, amount, letter into :name_letter:ind from "Test";
printf("Database: pm\n");
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name_letter[i].name, i, name_letter[i].amount,i, name_letter[i].letter);
name_letter[4].amount=1407;
strcpy(msg, "insert");
exec sql insert into "Test" (name, amount, letter) values (:name_letter[4]);
strcpy(msg, "select");
exec sql select name, amount, letter into :name_letter[2] from "Test" where amount = 1407;
printf("Database: main\n");
printf("name[2]=%8.8s\tamount[2]=%d\tletter[2]=%c\n", name_letter[2].name, name_letter[2].amount, name_letter[2].letter);
/* Start automatic transactioning for connection main. */
exec sql set autocommit to on;
strcpy(msg, "drop");
exec sql drop table "Test";
exec sql at pm drop table "Test";
strcpy(msg, "disconnect");
exec sql disconnect main;
exec sql disconnect pm;
return (0);
}
#include <stdlib.h>
#include <string.h>
exec sql include header_test;
exec sql include ../regression;
exec sql type c is char reference;
typedef char* c;
exec sql type ind is union { int integer; short smallint; };
typedef union { int integer; short smallint; } ind;
#define BUFFERSIZ 8
exec sql type str is varchar[BUFFERSIZ];
exec sql declare cur cursor for
select name, born, age, married, children from meskes;
int
main (void)
{
exec sql struct birthinfo { long born; short age; };
exec sql begin declare section;
struct personal_struct { str name;
struct birthinfo birth;
} personal, *p;
struct personal_indicator { int ind_name;
struct birthinfo ind_birth;
} ind_personal, *i;
ind ind_children;
char *query="select name, born, age, married, children from meskes where name = :var1";
exec sql end declare section;
exec sql char *married = NULL;
exec sql float ind_married;
exec sql ind children;
exec sql var ind_married is long;
char msg[128];
ECPGdebug(1, stderr);
strcpy(msg, "connect");
exec sql connect to REGRESSDB1;
strcpy(msg, "create");
exec sql create table meskes(name char(8), born integer, age smallint, married date, children integer);
strcpy(msg, "insert");
exec sql insert into meskes(name, married, children) values ('Petra', '19900404', 3);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 35, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,10);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 8);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 4);
strcpy(msg, "commit");
exec sql commit;
strcpy(msg, "open");
exec sql open cur;
exec sql whenever not found do break;
p=&personal;
i=&ind_personal;
memset(i, 0, sizeof(ind_personal));
while (1) {
strcpy(msg, "fetch");
exec sql fetch cur into :p:i, :married:ind_married, :children.integer:ind_children.smallint;
printf("%8.8s", personal.name.arr);
if (i->ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (i->ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if ((long)ind_married >= 0)
printf(", married %s", married);
if (ind_children.smallint >= 0)
printf(", children = %d", children.integer);
putchar('\n');
free(married);
married = NULL;
}
strcpy(msg, "close");
exec sql close cur;
/* and now a same query with prepare */
exec sql prepare MM from :query;
exec sql declare prep cursor for MM;
strcpy(msg, "open");
exec sql open prep using 'Petra';
exec sql whenever not found do break;
while (1) {
strcpy(msg, "fetch");
exec sql fetch in prep into :personal:ind_personal, :married:ind_married, :children.integer:ind_children.smallint;
printf("%8.8s", personal.name.arr);
if (ind_personal.ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (ind_personal.ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if ((long)ind_married >= 0)
printf(", married %s", married);
if (ind_children.smallint >= 0)
printf(", children = %d", children.integer);
putchar('\n');
}
free(married);
strcpy(msg, "close");
exec sql close prep;
strcpy(msg, "drop");
exec sql drop table meskes;
strcpy(msg, "commit");
exec sql commit;
strcpy(msg, "disconnect");
exec sql disconnect;
return (0);
}
/****************************************************************************/
/* Test comment */
/*--------------------------------------------------------------------------*/
exec sql include header_test;
exec sql include ../regression;
exec sql type str is varchar[10];
#include <stdlib.h>
#include <string.h>
int
main (void)
{
exec sql begin declare section;
typedef struct { long born; short age; } birthinfo;
struct personal_struct { str name;
birthinfo birth;
} personal;
struct personal_indicator { int ind_name;
birthinfo ind_birth;
} ind_personal;
int *ind_married = NULL;
int children, movevalue = 2;
int ind_children;
str *married = NULL;
char *wifesname="Petra";
char *query="select * from meskes where name = ?";
exec sql end declare section;
exec sql declare cur cursor for
select name, born, age, married, children from meskes;
char msg[128];
ECPGdebug(1, stderr);
strcpy(msg, "connect");
exec sql connect to REGRESSDB1;
strcpy(msg, "create");
exec sql create table meskes(name char(8), born integer, age smallint, married date, children integer);
strcpy(msg, "insert");
exec sql insert into meskes(name, married, children) values (:wifesname, '19900404', 3);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 35, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 10);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 8);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 4);
strcpy(msg, "commit");
exec sql commit;
strcpy(msg, "open");
exec sql open cur;
strcpy(msg, "move");
exec sql move :movevalue in cur;
exec sql whenever not found do break;
while (1) {
strcpy(msg, "fetch");
exec sql fetch from cur into :personal:ind_personal, :married:ind_married, :children:ind_children;
printf("%8.8s", personal.name.arr);
if (ind_personal.ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (ind_personal.ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if (*ind_married >= 0)
printf(", married %10.10s", married->arr);
if (ind_children >= 0)
printf(", children = %d", children);
putchar('\n');
free(married);
married = NULL;
}
strcpy(msg, "close");
exec sql close cur;
/* and now a query with prepare */
exec sql prepare MM from :query;
exec sql declare prep cursor for MM;
strcpy(msg, "open");
exec sql open prep using :wifesname;
exec sql whenever not found do break;
while (1) {
strcpy(msg, "fetch");
exec sql fetch in prep into :personal:ind_personal, :married:ind_married, :children:ind_children;
printf("%8.8s", personal.name.arr);
if (ind_personal.ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (ind_personal.ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if (*ind_married >= 0)
printf(", married %10.10s", married->arr);
if (ind_children >= 0)
printf(", children = %d", children);
putchar('\n');
}
free(married);
strcpy(msg, "close");
exec sql close prep;
strcpy(msg, "drop");
exec sql drop table meskes;
strcpy(msg, "commit");
exec sql commit;
strcpy(msg, "disconnect");
exec sql disconnect;
return (0);
}
#include <locale.h>
#include <string.h>
#include <stdlib.h>
exec sql whenever sqlerror sqlprint;
exec sql include sqlca;
exec sql include ../regression;
EXEC SQL type errtype is enum
{
OK = 0,
ERR = 1,
WARN = 2
};
int
main (void)
{
EXEC SQL BEGIN DECLARE SECTION;
struct
{
errtype e :2;
int code :14;
} error = {1, 147};
int i = 1;
int *did = &i;
int a[10] = {9,8,7,6,5,4,3,2,1,0};
char text[25] = "klmnopqrst";
char *t = (char *)malloc(10);
double f;
bool b = true;
EXEC SQL END DECLARE SECTION;
strcpy(t, "0123456789");
setlocale(LC_ALL, "de_DE");
ECPGdebug(1, stderr);
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL SET AUTOCOMMIT = ON;
EXEC SQL BEGIN WORK;
EXEC SQL CREATE TABLE test (f float, i int, a int[10], text char(10), b bool, t int, err int);
EXEC SQL INSERT INTO test(f,i,a,text,b,t,err) VALUES(404.90,3,'{0,1,2,3,4,5,6,7,8,9}','abcdefghij','f',0,0);
EXEC SQL INSERT INTO test(f,i,a,text,b,t,err) VALUES(140787.0,2,:a,:text,'t',2,14);
EXEC SQL IFDEF BIT_FIELD_IS_NOT_ACCESSIBLE;
EXEC SQL INSERT INTO test(f,i,a,text,b,t,err) VALUES(14.07,:did,:a,:t,:b,:error);
EXEC SQL ELSE;
EXEC SQL INSERT INTO test(f,i,a,text,b,t,err) VALUES(14.07,:did,:a,:t,:b,1,147);
error.code=0;
EXEC SQL ENDIF;
EXEC SQL COMMIT;
EXEC SQL BEGIN WORK;
EXEC SQL SELECT f,text,b
INTO :f,:text,:b
FROM test
WHERE i = 1;
printf("Found f=%f text=%10.10s b=%d\n", f, text, b);
f=140787;
EXEC SQL SELECT a,text
INTO :a,:t
FROM test
WHERE f = :f;
for (i = 0; i < 10; i++)
printf("Found a[%d] = %d\n", i, a[i]);
printf("Found text=%10.10s\n", t);
EXEC SQL SELECT a
INTO :text
FROM test
WHERE f = :f;
printf("Found text=%s\n", text);
EXEC SQL DROP TABLE test;
EXEC SQL COMMIT;
EXEC SQL DISCONNECT;
return (0);
}
#include <stdio.h>
#include <stdlib.h>
EXEC SQL include ../regression;
EXEC SQL typedef long mmInteger;
EXEC SQL typedef char mmChar;
EXEC SQL typedef short mmSmallInt;
EXEC SQL BEGIN DECLARE SECTION;
struct TBempl
{
mmInteger idnum;
mmChar name[21];
mmSmallInt accs;
mmChar byte[20];
};
EXEC SQL END DECLARE SECTION;
int
main (void)
{
EXEC SQL BEGIN DECLARE SECTION;
struct TBempl empl;
char *data = "\\001\\155\\000\\212";
union
{
mmSmallInt accs;
char t[2];
} a;
EXEC SQL END DECLARE SECTION;
int i;
ECPGdebug (1, stderr);
empl.idnum = 1;
EXEC SQL connect to REGRESSDB1;
if (sqlca.sqlcode)
{
printf ("connect error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL create table empl
(idnum integer, name char (20), accs smallint, byte bytea);
if (sqlca.sqlcode)
{
printf ("create error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL insert into empl values (1, 'first user', 320,:data);
if (sqlca.sqlcode)
{
printf ("insert error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
EXEC SQL select name, accs, byte
into :empl.name, :empl.accs, :empl.byte
from empl
where idnum =:empl.idnum;
if (sqlca.sqlcode)
{
printf ("select error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
EXEC SQL DECLARE C CURSOR FOR select name, accs, byte from empl where idnum =:empl.idnum;
EXEC SQL OPEN C;
EXEC SQL FETCH C INTO:empl.name,:empl.accs,:empl.byte;
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
memset(empl.name, 0, 21L);
memset(empl.byte, '#', 20L);
EXEC SQL DECLARE B BINARY CURSOR FOR select name, accs, byte from empl where idnum =:empl.idnum;
EXEC SQL OPEN B;
EXEC SQL FETCH B INTO :empl.name,:a.accs,:empl.byte;
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
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++)
{
if (empl.byte[i] == '#')
break;
printf("(%o)", (unsigned char)empl.byte[i]);
}
printf("\n");
EXEC SQL disconnect;
exit (0);
}
subdir = src/interfaces/ecpg/test/connect
top_builddir = ../../../../..
include $(top_builddir)/src/Makefile.global
include ../Makefile.regress
TESTS = test1 test1.c \
test2 test2.c \
test3 test3.c \
test4 test4.c
all: $(TESTS)
Programs in this directory test all sorts of connections.
All other programs just use one standard connection method.
If any details of the regression database get changed (port, unix socket file,
user names, passwords, ...), these programs here have to be changed as well
because they contain hardcoded values.
/*
* this file tests all sorts of connecting to one single database.
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* do not include regression.h */
int
main(void)
{
exec sql begin declare section;
char db[200];
char id[200];
char pw[200];
exec sql end declare section;
ECPGdebug(1, stderr);
exec sql connect to connectdb as main;
exec sql alter user connectuser ENCRYPTED PASSWORD 'connectpw';
exec sql disconnect; /* <-- "main" not specified */
strcpy(db, "connectdb");
strcpy(id, "main");
exec sql connect to :db as :id;
exec sql disconnect :id;
exec sql connect to connectdb@localhost as main;
exec sql disconnect main;
exec sql connect to connectdb@localhost as main;
exec sql disconnect main;
exec sql connect to connectdb@localhost as main user connectuser/connectdb;
exec sql disconnect main;
exec sql connect to tcp:postgresql://localhost:55432/connectdb user connectuser identified by connectpw;
exec sql disconnect nonexistant;
exec sql disconnect;
strcpy(pw, "connectpw");
strcpy(db, "tcp:postgresql://localhost:55432/connectdb");
exec sql connect to :db user connectuser using :pw;
exec sql disconnect;
exec sql connect to unix:postgresql://localhost:55432/connectdb user connectuser using "connectpw";
exec sql disconnect;
/* wrong db */
exec sql connect to tcp:postgresql://localhost:55432/nonexistant user connectuser identified by connectpw;
exec sql disconnect;
/* wrong port */
exec sql connect to tcp:postgresql://localhost:0/connectdb user connectuser identified by connectpw;
/* no disconnect necessary */
/* wrong password */
exec sql connect to unix:postgresql://localhost:55432/connectdb user connectuser identified by "wrongpw";
/* no disconnect necessary */
/* connect twice */
exec sql connect to connectdb as main;
exec sql connect to connectdb as main;
exec sql disconnect main;
return (0);
}
/*
* this file tests multiple connections to databases and switches
* between them.
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* do not include regression.h */
int
main(void)
{
exec sql begin declare section;
char id[200];
char res[200];
exec sql end declare section;
ECPGdebug(1, stderr);
strcpy(id, "first");
exec sql connect to connectdb as :id;
exec sql connect to regress1@localhost as second;
/* this selects from "second" which was opened last */
exec sql select current_database() into :res;
exec sql at first select current_database() into :res;
exec sql at second select current_database() into :res;
exec sql set connection first;
exec sql select current_database() into :res;
/* this will disconnect from "first" */
exec sql disconnect;
exec sql select current_database() into :res;
/* error here since "first" is already disconnected */
exec sql disconnect :id;
/* disconnect from "second" */
exec sql disconnect;
return (0);
}
/*
* this file just tests the several possibilities you have for a disconnect
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* do not include regression.h */
int
main(void)
{
exec sql begin declare section;
char id[200];
char res[200];
exec sql end declare section;
ECPGdebug(1, stderr);
strcpy(id, "first");
exec sql connect to connectdb as :id;
exec sql connect to regress1@localhost as second;
/* this selects from "second" which was opened last */
exec sql select current_database() into :res;
/* will close "second" */
exec sql disconnect CURRENT;
exec sql select current_database() into :res;
exec sql connect to regress1@localhost as second;
/* will close "second" */
exec sql disconnect DEFAULT;
exec sql connect to regress1@localhost as second;
exec sql disconnect ALL;
exec sql disconnect CURRENT;
exec sql disconnect DEFAULT;
exec sql disconnect ALL;
/*
* exec sql disconnect;
* exec sql disconnect name;
*
* are used in other tests
*/
return (0);
}
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
exec sql include ../regression;
int
main(void)
{
ECPGdebug(1, stderr);
exec sql connect to REGRESSDB1 as main;
exec sql set connection to main;
exec sql disconnect DEFAULT;
return (0);
}
subdir = src/interfaces/ecpg/test/errors
top_builddir = ../../../../..
include $(top_builddir)/src/Makefile.global
include ../Makefile.regress
TESTS = init init.c
all: $(TESTS)
exec sql include sqlca;
enum e { ENUM0, ENUM1 };
struct sa { int member; };
int
fa(void)
{
printf("in fa\n");
return 2;
}
int
fb(int x)
{
printf("in fb (%d)\n", x);
return x;
}
int
fc(const char *x)
{
printf("in fc (%s)\n", x);
return *x;
}
int fd(const char *x,int i)
{
printf("in fd (%s, %d)\n", x, i);
return (*x)*i;
}
int fe(enum e x)
{
printf("in fe (%d)\n", (int) x);
return (int)x;
}
void sqlnotice(char *notice, short trans)
{
if (!notice)
notice = "-empty-";
printf("in sqlnotice (%s, %d)\n", notice, trans);
}
exec sql define NONO 0;
#define YES 1
#ifdef _cplusplus
namespace N
{
static const int i=2;
};
#endif
int main(void)
{
struct sa x,*y;
exec sql begin declare section;
int a=(int)2;
int b=2+2;
int b2=(14*7);
int d=x.member;
int g=fb(2);
int i=3^1;
int j=1?1:2;
int e=y->member;
int c=10>>2;
bool h=2||1;
long iay /* = 1L */ ;
long long iax /* = 40000000000LL */ ;
exec sql end declare section;
ECPGdebug(1, stderr);
int f=fa();
#ifdef _cplusplus
exec sql begin declare section;
int k=N::i; /* compile error */
exec sql end declare section;
#endif
exec sql whenever sqlerror do fa();
exec sql select now();
exec sql whenever sqlerror do fb(20);
exec sql select now();
exec sql whenever sqlerror do fc("50");
exec sql select now();
exec sql whenever sqlerror do fd("50",1);
exec sql select now();
exec sql whenever sqlerror do fe(ENUM0);
exec sql select now();
exec sql whenever sqlerror do sqlnotice(NULL, NONO);
exec sql select now();
return 0;
}
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* Needed for informix compatibility */
#include <ecpg_informix.h>
/* End of automatic include section */
#line 1 "test_informix.pgc"
#include "sqltypes.h"
#line 1 "./../regression.h"
#line 3 "test_informix.pgc"
static void openit(void);
static void dosqlprint(void) {
printf("doSQLprint: Error: %s\n", sqlca.sqlerrm.sqlerrmc);
}
int main(void)
{
#line 13 "test_informix.pgc"
int i = 14 ;
#line 13 "test_informix.pgc"
#line 14 "test_informix.pgc"
decimal j , m , n ;
#line 14 "test_informix.pgc"
ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do dosqlprint ( ) ; */
#line 17 "test_informix.pgc"
{ ECPGconnect(__LINE__, 1, "regress1" , NULL,NULL , NULL, 0);
#line 19 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 19 "test_informix.pgc"
if (sqlca.sqlcode != 0) exit(1);
{ ECPGdo(__LINE__, 1, 1, NULL, "create table test ( i int primary key , j int ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 22 "test_informix.pgc"
/* this INSERT works */
rsetnull(CDECIMALTYPE, (char *)&j);
{ 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 26 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 26 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
#line 27 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 27 "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);
#line 30 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 30 "test_informix.pgc"
printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
#line 32 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 32 "test_informix.pgc"
{ 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 34 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 34 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
#line 35 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 35 "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);
#line 38 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 38 "test_informix.pgc"
/* this however should be ok */
{ ECPGdo(__LINE__, 1, 1, NULL, "select i from test where j = ( select j from test limit 1 ) ", ECPGt_EOIT, ECPGt_EORT);
#line 41 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 41 "test_informix.pgc"
printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
#line 43 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 43 "test_informix.pgc"
ECPG_informix_set_var( 0, &( i ), __LINE__);\
/* declare c cursor for select * from test where i <= ? */
#line 45 "test_informix.pgc"
openit();
deccvint(0, &j);
while (1)
{
{ 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 52 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 52 "test_informix.pgc"
if (sqlca.sqlcode == 100) break;
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
if (risnull(CDECIMALTYPE, (char *)&j))
printf("%d NULL\n", i);
else
{
int a;
dectoint(&j, &a);
printf("%d %d\n", i, a);
}
}
deccvint(7, &j);
deccvint(14, &m);
decadd(&j, &m, &n);
{ 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 70 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 70 "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);
#line 73 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 73 "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);
#line 76 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 76 "test_informix.pgc"
printf("Does not exist: %ld\n", sqlca.sqlcode);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 79 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 79 "test_informix.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 80 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 80 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
#line 81 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 81 "test_informix.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 83 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 83 "test_informix.pgc"
return 0;
}
static void openit(void)
{
{ 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 90 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 90 "test_informix.pgc"
}
[NO_PID]: ECPGdebug: set to 1
[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 22: QUERY: create table test ( i int primary key , j int ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( i , j ) values( 7 , 0 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 27 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: QUERY: insert into test ( i , j ) values( 7 , 12 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: Error: ERROR: duplicate key violates unique constraint "test_pkey"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 23505 (sqlcode: -239) in line 30, ''duplicate key violates unique constraint "test_pkey"' in line 30.'.
[NO_PID]: sqlca: code: -239, state: 23505
[NO_PID]: ECPGtrans line 32 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34: QUERY: insert into test ( i , j ) values( 14 , 1 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 35 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38: QUERY: select i from test where j = ( select j from test ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38: Error: ERROR: more than one row returned by a subquery used as an expression
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 21000 (sqlcode: -284) in line 38, ''more than one row returned by a subquery used as an expression' in line 38.'.
[NO_PID]: sqlca: code: -284, state: 21000
[NO_PID]: ECPGexecute line 41: QUERY: select i from test where j = ( select j from test limit 1 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 41: Error: ERROR: current transaction is aborted, commands ignored until end of transaction block
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 25P02 (sqlcode: -400) in line 41, ''current transaction is aborted, commands ignored until end of transaction block' in line 41.'.
[NO_PID]: sqlca: code: -400, state: 25P02
[NO_PID]: ECPGtrans line 43 action = rollback connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 90: QUERY: declare c cursor for select * from test where i <= 14 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 90 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: fetch forward from c on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 7 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 0 offset: 52 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: fetch forward from c on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 14 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 52: RESULT: 1 offset: 52 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: fetch forward from c on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: Correctly got 0 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 52, 'No data found in line 52.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 70: QUERY: delete from test where i = 21.0 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70 Ok: DELETE 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 70, 'No data found in line 70.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 73: QUERY: select 1 from test where i = 14 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 73: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76: QUERY: select 1 from test where i = 147 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76: Correctly got 0 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 76, 'No data found in line 76.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGtrans line 79 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 80: QUERY: drop table test on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 80 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 81 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
doSQLprint: Error: 'duplicate key violates unique constraint "test_pkey"' in line 30.
INSERT: -239='duplicate key violates unique constraint "test_pkey"' in line 30.
doSQLprint: Error: 'more than one row returned by a subquery used as an expression' in line 38.
doSQLprint: Error: 'current transaction is aborted, commands ignored until end of transaction block' in line 41.
SELECT: -400='current transaction is aborted, commands ignored until end of transaction block' in line 41.
7 0
14 1
DELETE: 100
Exists: 0
Does not exist: 100
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* Needed for informix compatibility */
#include <ecpg_informix.h>
/* End of automatic include section */
#line 1 "test_informix2.pgc"
#include <stdio.h>
#include <stdlib.h>
#include "sqltypes.h"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 5 "test_informix2.pgc"
#line 1 "./../regression.h"
#line 6 "test_informix2.pgc"
/* Check SQLCODE, and produce a "standard error" if it's wrong! */
static void sql_check(char *fn, char *caller, int ignore)
{
char errorstring[255];
if (SQLCODE == ignore)
return;
else
{
if (SQLCODE != 0)
{
sprintf(errorstring, "**SQL error %ld doing '%s' in function '%s'. [%s]",
SQLCODE, caller, fn, sqlca.sqlerrm.sqlerrmc);
fprintf(stderr, "%s", errorstring);
printf("%s\n", errorstring);
/* attempt a ROLLBACK */
{ ECPGtrans(__LINE__, NULL, "rollback");}
#line 27 "test_informix2.pgc"
if (SQLCODE == 0)
{
sprintf(errorstring, "Rollback successful.\n");
} else {
sprintf(errorstring, "Rollback failed with code %ld.\n", SQLCODE);
}
fprintf(stderr, "%s", errorstring);
printf("%s\n", errorstring);
exit(1);
}
}
}
int main(void)
{
/* exec sql begin declare section */
#line 49 "test_informix2.pgc"
int c ;
#line 50 "test_informix2.pgc"
timestamp d ;
#line 51 "test_informix2.pgc"
timestamp maxd ;
#line 52 "test_informix2.pgc"
char dbname [ 30 ] ;
/* exec sql end declare section */
#line 53 "test_informix2.pgc"
/* exec sql whenever sqlerror sqlprint ; */
#line 55 "test_informix2.pgc"
ECPGdebug(1, stderr);
/* if (strlen(REGRESSDB1) > MAXDBLEN) {
exit(1);
}
*/
strcpy(dbname, "regress1");
{ ECPGconnect(__LINE__, 1, dbname , NULL,NULL , NULL, 0);
#line 64 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 64 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 67 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 72 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 77 "test_informix2.pgc"
sql_check("main", "select max", 100);
if (risnull(CDTIMETYPE, (char *) &maxd))
{
printf("Nothing on the history table\n\n");
exit(0);
}
{ ECPGdo(__LINE__, 1, 0, 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),
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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 90 "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;
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_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 104 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 104 "test_informix2.pgc"
sql_check("main", "update", 0);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 107 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 107 "test_informix2.pgc"
{ ECPGdo(__LINE__, 1, 0, NULL, "drop table history ", ECPGt_EOIT, ECPGt_EORT);
#line 109 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 109 "test_informix2.pgc"
sql_check("main", "drop", 0);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 112 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 112 "test_informix2.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 114 "test_informix2.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 114 "test_informix2.pgc"
sql_check("main", "disconnect", 0);
printf("All OK!\n");
exit(0);
/*
Table "public.history"
Column | Type | Modifiers
--------------+-----------------------------+-----------
customerid | integer | not null
timestamp | timestamp without time zone | not null
action_taken | character(5) | not null
narrative | character varying(100) |
*/
}
[NO_PID]: ECPGdebug: set to 1
[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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 67 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 75: 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]: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 86: 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]: 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]: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 102 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 107 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 109 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 112 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
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test1.pgc"
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#line 1 "./../regression.h"
#line 6 "test1.pgc"
/* just a test comment */ /* exec sql whenever sqlerror do PrintAndStop ( msg ) ; */
#line 8 "test1.pgc"
/* exec sql whenever sql_warning do warn ( ) ; */
#line 9 "test1.pgc"
static void PrintAndStop(char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
exit(-1);
}
static void warn(void)
{
fprintf(stderr, "Warning: At least one column was truncated\n");
}
/* comment */
/* exec sql type intarray is int [ 6 ] */
#line 27 "test1.pgc"
typedef int intarray[ 6];
int
main(void)
{
/* exec sql begin declare section */
typedef char string [ 8 ] ;
#line 36 "test1.pgc"
#line 37 "test1.pgc"
intarray amount ;
#line 38 "test1.pgc"
int increment = 100 ;
#line 39 "test1.pgc"
char name [ 6 ] [ 8 ] ;
#line 40 "test1.pgc"
char letter [ 6 ] [ 1 ] ;
#line 46 "test1.pgc"
struct name_letter_struct {
#line 43 "test1.pgc"
char name [ 8 ] ;
#line 44 "test1.pgc"
int amount ;
#line 45 "test1.pgc"
char letter ;
} name_letter [ 6 ] ;
#if 0
#line 48 "test1.pgc"
int not_used ;
#endif
#line 56 "test1.pgc"
struct ind_struct {
#line 53 "test1.pgc"
short a ;
#line 54 "test1.pgc"
short b ;
#line 55 "test1.pgc"
short c ;
} ind [ 6 ] ;
#line 57 "test1.pgc"
char command [ 128 ] ;
#line 58 "test1.pgc"
char * connection = "pm" ;
#line 59 "test1.pgc"
int how_many ;
#line 60 "test1.pgc"
char * user = "regressuser1" ;
/* exec sql end declare section */
#line 61 "test1.pgc"
/* exec sql var name is string [ 6 ] */
#line 62 "test1.pgc"
char msg[128];
int i,j;
ECPGdebug(1, stderr);
strcpy(msg, "connect");
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "main", 0);
#line 69 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 69 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 69 "test1.pgc"
strcpy(msg, "connect");
{ ECPGconnect(__LINE__, 0, "connectdb" , user , NULL , "pm", 0);
#line 72 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 72 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 72 "test1.pgc"
strcpy(msg, "create");
{ ECPGdo(__LINE__, 0, 1, "main", "create table \"Test\" ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 75 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 75 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 75 "test1.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "create table \"Test\" ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
#line 76 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 76 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 76 "test1.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, "main", "commit");
#line 79 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 79 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 79 "test1.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
#line 80 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 80 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 80 "test1.pgc"
strcpy(msg, "set connection");
{ ECPGsetconn(__LINE__, "main");
#line 83 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 83 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 83 "test1.pgc"
strcpy(msg, "execute insert 1");
sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 1, 'f')");
{ 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 87 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 87 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 87 "test1.pgc"
printf("New tuple got OID = %ld\n", sqlca.sqlerrd[1]);
sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 2, 't')");
{ 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 91 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 91 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 91 "test1.pgc"
strcpy(msg, "execute insert 2");
sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''pm''', 1, 'f')");
{ ECPGdo(__LINE__, 0, 1, "pm", "?",
ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 95 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 95 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 95 "test1.pgc"
strcpy(msg, "execute insert 3");
sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+10, letter from \"Test\"");
{ 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 99 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 99 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 99 "test1.pgc"
printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
strcpy(msg, "execute insert 4");
sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+?, letter from \"Test\"");
{ ECPGprepare(__LINE__, "I" , command);
#line 105 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 105 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 105 "test1.pgc"
{ ECPGdo(__LINE__, 0, 1, "pm", "?",
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 106 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 106 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 106 "test1.pgc"
printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 111 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 111 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 111 "test1.pgc"
/* Start automatic transactioning for connection pm. */
{ ECPGsetcommit(__LINE__, "on", "pm");
#line 114 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 114 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 114 "test1.pgc"
{ ECPGtrans(__LINE__, "pm", "begin transaction ");
#line 115 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 115 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 115 "test1.pgc"
strcpy(msg, "select");
{ 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),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(letter),(long)1,(long)6,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 118 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 118 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 118 "test1.pgc"
printf("Database: main\n");
for (i=0, how_many=j=sqlca.sqlerrd[2]; i<j; i++)
{
/* exec sql begin declare section */
#line 124 "test1.pgc"
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
#line 125 "test1.pgc"
int a = amount [ i ] ;
/* exec sql end declare section */
#line 126 "test1.pgc"
strncpy(n, name[i], 8);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
amount[i]+=1000;
strcpy(msg, "insert");
{ ECPGdo(__LINE__, 0, 1, "pm", "insert into \"Test\" ( name , amount , letter ) values( ? , ? , ? )",
ECPGt_char,(n),(long)8,(long)1,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(amount[i]),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(l),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 133 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 133 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 133 "test1.pgc"
}
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, "pm", "commit");
#line 137 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 137 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 137 "test1.pgc"
sprintf (command, "select * from \"Test\"");
{ ECPGprepare(__LINE__, "F" , command);
#line 141 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 141 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 141 "test1.pgc"
/* declare CUR cursor for ? */
#line 142 "test1.pgc"
strcpy(msg, "open");
{ 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 145 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 145 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 145 "test1.pgc"
strcpy(msg, "fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch ? in CUR",
ECPGt_int,&(how_many),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 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),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(letter),(long)1,(long)6,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 148 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 148 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 148 "test1.pgc"
printf("Database: main\n");
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
{
/* exec sql begin declare section */
#line 154 "test1.pgc"
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
#line 155 "test1.pgc"
int a = amount [ i ] ;
/* exec sql end declare section */
#line 156 "test1.pgc"
strncpy(n, name[i], 8);
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);
#line 162 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 162 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 162 "test1.pgc"
strcpy(msg, "select");
{ ECPGdo(__LINE__, 0, 1, connection, "select name , amount , letter 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),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(letter),(long)1,(long)6,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 165 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 165 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 165 "test1.pgc"
printf("Database: %s\n", connection);
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 172 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 172 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 172 "test1.pgc"
strcpy(msg, "select");
{ ECPGdo(__LINE__, 0, 1, "pm", "select name , amount , letter from \"Test\" ", ECPGt_EOIT,
ECPGt_char,&(name_letter->name),(long)8,(long)6,sizeof( struct name_letter_struct ),
ECPGt_short,&(ind->a),(long)1,(long)6,sizeof( struct ind_struct ),
ECPGt_int,&(name_letter->amount),(long)1,(long)6,sizeof( struct name_letter_struct ),
ECPGt_short,&(ind->b),(long)1,(long)6,sizeof( struct ind_struct ),
ECPGt_char,&(name_letter->letter),(long)1,(long)6,sizeof( struct name_letter_struct ),
ECPGt_short,&(ind->c),(long)1,(long)6,sizeof( struct ind_struct ), ECPGt_EORT);
#line 175 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 175 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 175 "test1.pgc"
printf("Database: pm\n");
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name_letter[i].name, i, name_letter[i].amount,i, name_letter[i].letter);
name_letter[4].amount=1407;
strcpy(msg, "insert");
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into \"Test\" ( name , amount , letter ) values( ? , ? , ? )",
ECPGt_char,&(name_letter[4].name),(long)8,(long)1,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(name_letter[4].amount),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(name_letter[4].letter),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 183 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 183 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 183 "test1.pgc"
strcpy(msg, "select");
{ ECPGdo(__LINE__, 0, 1, NULL, "select name , amount , letter from \"Test\" where amount = 1407 ", ECPGt_EOIT,
ECPGt_char,&(name_letter[2].name),(long)8,(long)1,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(name_letter[2].amount),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(name_letter[2].letter),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 186 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 186 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 186 "test1.pgc"
printf("Database: main\n");
printf("name[2]=%8.8s\tamount[2]=%d\tletter[2]=%c\n", name_letter[2].name, name_letter[2].amount, name_letter[2].letter);
/* Start automatic transactioning for connection main. */
{ ECPGsetcommit(__LINE__, "on", NULL);
#line 192 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 192 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 192 "test1.pgc"
strcpy(msg, "drop");
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table \"Test\" ", ECPGt_EOIT, ECPGt_EORT);
#line 195 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 195 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 195 "test1.pgc"
{ ECPGdo(__LINE__, 0, 1, "pm", "drop table \"Test\" ", ECPGt_EOIT, ECPGt_EORT);
#line 196 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 196 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 196 "test1.pgc"
strcpy(msg, "disconnect");
{ ECPGdisconnect(__LINE__, "main");
#line 199 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 199 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 199 "test1.pgc"
{ ECPGdisconnect(__LINE__, "pm");
#line 200 "test1.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 200 "test1.pgc"
if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
#line 200 "test1.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[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]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> for user regressuser1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 75: QUERY: create table "Test" ( name char ( 8 ) , amount int , letter char ( 1 ) ) on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 75 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76: QUERY: create table "Test" ( name char ( 8 ) , amount int , letter char ( 1 ) ) on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 76 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 79 action = commit connection = main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 80 action = commit connection = pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 87: QUERY: insert into "Test" (name, amount, letter) values ('db: ''r1''', 1, 'f') on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 87 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 91: QUERY: insert into "Test" (name, amount, letter) values ('db: ''r1''', 2, 't') on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 91 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 95: QUERY: insert into "Test" (name, amount, letter) values ('db: ''pm''', 1, 'f') on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 95 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 99: QUERY: insert into "Test" (name, amount, letter) select name, amount+10, letter from "Test" on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 99 Ok: INSERT 0 2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGprepare line 105: QUERY: insert into "Test" (name, amount, letter) select name, amount+?, letter from "Test"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 106: QUERY: insert into "Test" (name, amount, letter) select name, amount+100, letter from "Test" on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 106 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 111 action = commit connection = main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGsetcommit line 114 action = on connection = pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 115 action = begin transaction connection = pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 118: QUERY: select * from "Test" on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 118: Correctly got 4 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: 1 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: 2 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: 11 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: 12 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: t offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 118: RESULT: t offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1001 , 'f' ) on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1002 , 't' ) on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1011 , 'f' ) on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1012 , 't' ) on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 137 action = commit connection = pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGprepare line 141: QUERY: select * from "Test"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 145: QUERY: declare CUR cursor for select * from "Test" on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 145 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 148: QUERY: fetch 4 in CUR on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 148: Correctly got 4 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: 1 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: 2 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: 11 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: 12 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: t offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 148: RESULT: t offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 162: QUERY: close CUR on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 162 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 165: QUERY: select name , amount , letter from "Test" on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 165: Correctly got 6 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: db: 'pm' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: db: 'pm' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: 1 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: 101 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: 1001 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: 1002 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: 1011 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: 1012 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: t offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 165: RESULT: t offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 172 action = commit connection = main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 175: QUERY: select name , amount , letter from "Test" on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 175: Correctly got 6 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: db: 'pm' offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: db: 'pm' offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: 1 offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: 101 offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: 1001 offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: 1002 offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: 1011 offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: 1012 offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: f offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: f offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: f offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: t offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: f offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 175: RESULT: t offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 183: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1407 , 'f' ) on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 183 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 186: QUERY: select name , amount , letter from "Test" where amount = 1407 on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 186: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 186: RESULT: db: 'r1' offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 186: RESULT: 1407 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 186: RESULT: f offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGsetcommit line 192 action = on connection = main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 195: QUERY: drop table "Test" on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 195 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 196: QUERY: drop table "Test" on connection pm
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 196 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection pm closed.
[NO_PID]: sqlca: code: 0, state: 00000
New tuple got OID = 0
Inserted 2 tuples via execute immediate
Inserted 1 tuples via prepared execute
Database: main
name[0]=db: 'r1' amount[0]=1 letter[0]=f
name[1]=db: 'r1' amount[1]=2 letter[1]=t
name[2]=db: 'r1' amount[2]=11 letter[2]=f
name[3]=db: 'r1' amount[3]=12 letter[3]=t
Database: main
name[0]=db: 'r1' amount[0]=1 letter[0]=f
name[1]=db: 'r1' amount[1]=2 letter[1]=t
name[2]=db: 'r1' amount[2]=11 letter[2]=f
name[3]=db: 'r1' amount[3]=12 letter[3]=t
Database: pm
name[0]=db: 'pm' amount[0]=1 letter[0]=f
name[1]=db: 'pm' amount[1]=101 letter[1]=f
name[2]=db: 'r1' amount[2]=1001 letter[2]=f
name[3]=db: 'r1' amount[3]=1002 letter[3]=t
name[4]=db: 'r1' amount[4]=1011 letter[4]=f
name[5]=db: 'r1' amount[5]=1012 letter[5]=t
Database: pm
name[0]=db: 'pm' amount[0]=1 letter[0]=f
name[1]=db: 'pm' amount[1]=101 letter[1]=f
name[2]=db: 'r1' amount[2]=1001 letter[2]=f
name[3]=db: 'r1' amount[3]=1002 letter[3]=t
name[4]=db: 'r1' amount[4]=1011 letter[4]=f
name[5]=db: 'r1' amount[5]=1012 letter[5]=t
Database: main
name[2]=db: 'r1' amount[2]=1407 letter[2]=f
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test2.pgc"
#include <stdlib.h>
#include <string.h>
#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
Finish(char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
/* finish transaction */
{ ECPGtrans(__LINE__, NULL, "rollback");}
#line 12 "./header_test.h"
/* and remove test table */
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);}
#line 15 "./header_test.h"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 16 "./header_test.h"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 18 "./header_test.h"
exit(-1);
}
static void
warn(void)
{
fprintf(stderr, "Warning: At least one column was truncated\n");
}
/* exec sql whenever sqlerror do Finish ( msg ) ; */
#line 31 "./header_test.h"
/* exec sql whenever sql_warning do warn ( ) ; */
#line 34 "./header_test.h"
#line 4 "test2.pgc"
#line 1 "./../regression.h"
#line 5 "test2.pgc"
/* exec sql type c is char reference */
#line 7 "test2.pgc"
typedef char* c;
/* exec sql type ind is union {
#line 10 "test2.pgc"
int integer ;
#line 10 "test2.pgc"
short smallint ;
} */
#line 10 "test2.pgc"
typedef union { int integer; short smallint; } ind;
#define BUFFERSIZ 8
/* exec sql type str is [ BUFFERSIZ ] */
#line 14 "test2.pgc"
/* declare cur cursor for select name , born , age , married , children from meskes */
#line 17 "test2.pgc"
int
main (void)
{
struct birthinfo {
#line 22 "test2.pgc"
long born ;
#line 22 "test2.pgc"
short age ;
} ;
#line 22 "test2.pgc"
/* exec sql begin declare section */
#line 26 "test2.pgc"
struct personal_struct {
#line 24 "test2.pgc"
struct varchar_name { int len; char arr[ BUFFERSIZ ]; } name ;
#line 25 "test2.pgc"
struct birthinfo birth ;
} personal , * p ;
#line 29 "test2.pgc"
struct personal_indicator {
#line 27 "test2.pgc"
int ind_name ;
#line 28 "test2.pgc"
struct birthinfo ind_birth ;
} ind_personal , * i ;
#line 30 "test2.pgc"
ind ind_children ;
#line 31 "test2.pgc"
char * query = "select name, born, age, married, children from meskes where name = :var1" ;
/* exec sql end declare section */
#line 32 "test2.pgc"
#line 34 "test2.pgc"
char * married = NULL ;
#line 34 "test2.pgc"
#line 35 "test2.pgc"
float ind_married ;
#line 35 "test2.pgc"
#line 36 "test2.pgc"
ind children ;
#line 36 "test2.pgc"
/* exec sql var ind_married is long */
#line 38 "test2.pgc"
char msg[128];
ECPGdebug(1, stderr);
strcpy(msg, "connect");
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 45 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 45 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 45 "test2.pgc"
strcpy(msg, "create");
{ ECPGdo(__LINE__, 0, 1, NULL, "create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
#line 48 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 48 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 48 "test2.pgc"
strcpy(msg, "insert");
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , married , children ) values( 'Petra' , '19900404' , 3 )", ECPGt_EOIT, ECPGt_EORT);
#line 51 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 51 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 51 "test2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age , married , children ) values( 'Michael' , 19660117 , 35 , '19900404' , 3 )", ECPGt_EOIT, ECPGt_EORT);
#line 52 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 52 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 52 "test2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Carsten' , 19910103 , 10 )", ECPGt_EOIT, ECPGt_EORT);
#line 53 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 53 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 53 "test2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Marc' , 19930907 , 8 )", ECPGt_EOIT, ECPGt_EORT);
#line 54 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 54 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 54 "test2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Chris' , 19970923 , 4 )", ECPGt_EOIT, ECPGt_EORT);
#line 55 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 55 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 55 "test2.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 58 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 58 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 58 "test2.pgc"
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from meskes ", ECPGt_EOIT, ECPGt_EORT);
#line 61 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 61 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 61 "test2.pgc"
/* exec sql whenever not found break ; */
#line 63 "test2.pgc"
p=&personal;
i=&ind_personal;
memset(i, 0, sizeof(ind_personal));
while (1) {
strcpy(msg, "fetch");
{ 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),
ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof(long),
ECPGt_short,&(p->birth.age),(long)1,(long)1,sizeof(short),
ECPGt_short,&(i->ind_birth.age),(long)1,(long)1,sizeof(short),
ECPGt_char,&(married),(long)0,(long)1,(1)*sizeof(char),
ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),
ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT);
#line 70 "test2.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 70 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 70 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 70 "test2.pgc"
printf("%8.8s", personal.name.arr);
if (i->ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (i->ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if ((long)ind_married >= 0)
printf(", married %s", married);
if (ind_children.smallint >= 0)
printf(", children = %d", children.integer);
putchar('\n');
free(married);
married = NULL;
}
strcpy(msg, "close");
{ ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
#line 87 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 87 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 87 "test2.pgc"
/* and now a same query with prepare */
{ ECPGprepare(__LINE__, "MM" , query);
#line 90 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 90 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 90 "test2.pgc"
/* declare prep cursor for ? */
#line 91 "test2.pgc"
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, NULL, "declare prep cursor for ?",
ECPGt_char_variable,(ECPGprepared_statement("MM")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_const,"'Petra'",(long)7,(long)1,strlen("'Petra'"),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 94 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 94 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 94 "test2.pgc"
/* exec sql whenever not found break ; */
#line 96 "test2.pgc"
while (1) {
strcpy(msg, "fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch in prep", ECPGt_EOIT,
ECPGt_varchar,&(personal.name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name),
ECPGt_int,&(ind_personal.ind_name),(long)1,(long)1,sizeof(int),
ECPGt_long,&(personal.birth.born),(long)1,(long)1,sizeof(long),
ECPGt_long,&(ind_personal.ind_birth.born),(long)1,(long)1,sizeof(long),
ECPGt_short,&(personal.birth.age),(long)1,(long)1,sizeof(short),
ECPGt_short,&(ind_personal.ind_birth.age),(long)1,(long)1,sizeof(short),
ECPGt_char,&(married),(long)0,(long)1,(1)*sizeof(char),
ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),
ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT);
#line 100 "test2.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 100 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 100 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 100 "test2.pgc"
printf("%8.8s", personal.name.arr);
if (ind_personal.ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (ind_personal.ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if ((long)ind_married >= 0)
printf(", married %s", married);
if (ind_children.smallint >= 0)
printf(", children = %d", children.integer);
putchar('\n');
}
free(married);
strcpy(msg, "close");
{ ECPGdo(__LINE__, 0, 1, NULL, "close prep", ECPGt_EOIT, ECPGt_EORT);
#line 116 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 116 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 116 "test2.pgc"
strcpy(msg, "drop");
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);
#line 119 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 119 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 119 "test2.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 122 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 122 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 122 "test2.pgc"
strcpy(msg, "disconnect");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 125 "test2.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 125 "test2.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 125 "test2.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[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 48: QUERY: create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 48 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 51: QUERY: insert into meskes ( name , married , children ) values( 'Petra' , '19900404' , 3 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 51 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: insert into meskes ( name , born , age , married , children ) values( 'Michael' , 19660117 , 35 , '19900404' , 3 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53: QUERY: insert into meskes ( name , born , age ) values( 'Carsten' , 19910103 , 10 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54: QUERY: insert into meskes ( name , born , age ) values( 'Marc' , 19930907 , 8 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55: QUERY: insert into meskes ( name , born , age ) values( 'Chris' , 19970923 , 4 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 58 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 61: QUERY: declare cur cursor for select name , born , age , married , children from meskes on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 61 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: QUERY: fetch cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: Petra offset: 12 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 04-04-1990 offset: 11 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 3 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: QUERY: fetch cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: Michael offset: 12 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 19660117 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 35 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 04-04-1990 offset: 11 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 3 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: QUERY: fetch cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: Carsten offset: 12 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 19910103 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 10 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: QUERY: fetch cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: Marc offset: 12 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 19930907 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 8 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: QUERY: fetch cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: Chris offset: 12 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 19970923 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: 4 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 70: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: QUERY: fetch cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70: Correctly got 0 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 70, 'No data found in line 70.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 87: QUERY: close cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 87 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGprepare line 90: QUERY: select name, born, age, married, children from meskes where name = ?
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 94: QUERY: declare prep cursor for select name, born, age, married, children from meskes where name = 'Petra' on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 94 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 100: QUERY: fetch in prep on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 100: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 100: RESULT: Petra offset: 12 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 100: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 100: RESULT: offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 100: RESULT: 04-04-1990 offset: 11 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 100: RESULT: 3 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 100: QUERY: fetch in prep on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 100: Correctly got 0 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 100, 'No data found in line 100.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 116: QUERY: close prep on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 116 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 119: QUERY: drop table meskes on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 119 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 122 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
Petra , married 04-04-1990, children = 3
Michael , born 19660117, age = 35, married 04-04-1990, children = 3
Carsten , born 19910103, age = 10
Marc , born 19930907, age = 8
Chris , born 19970923, age = 4
Petra , married 04-04-1990, children = 3
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test3.pgc"
/****************************************************************************/
/* Test comment */
/*--------------------------------------------------------------------------*/
#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
Finish(char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
/* finish transaction */
{ ECPGtrans(__LINE__, NULL, "rollback");}
#line 12 "./header_test.h"
/* and remove test table */
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);}
#line 15 "./header_test.h"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 16 "./header_test.h"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 18 "./header_test.h"
exit(-1);
}
static void
warn(void)
{
fprintf(stderr, "Warning: At least one column was truncated\n");
}
/* exec sql whenever sqlerror do Finish ( msg ) ; */
#line 31 "./header_test.h"
/* exec sql whenever sql_warning do warn ( ) ; */
#line 34 "./header_test.h"
#line 4 "test3.pgc"
#line 1 "./../regression.h"
#line 5 "test3.pgc"
/* exec sql type str is [ 10 ] */
#line 7 "test3.pgc"
#include <stdlib.h>
#include <string.h>
int
main (void)
{
/* exec sql begin declare section */
typedef struct {
#line 16 "test3.pgc"
long born ;
#line 16 "test3.pgc"
short age ;
} birthinfo ;
#line 16 "test3.pgc"
#line 19 "test3.pgc"
struct personal_struct {
#line 17 "test3.pgc"
struct varchar_name { int len; char arr[ 10 ]; } name ;
#line 18 "test3.pgc"
birthinfo birth ;
} personal ;
#line 22 "test3.pgc"
struct personal_indicator {
#line 20 "test3.pgc"
int ind_name ;
#line 21 "test3.pgc"
birthinfo ind_birth ;
} ind_personal ;
#line 23 "test3.pgc"
int * ind_married = NULL ;
#line 24 "test3.pgc"
int children , movevalue = 2 ;
#line 25 "test3.pgc"
int ind_children ;
#line 26 "test3.pgc"
struct varchar_married { int len; char arr[ 10 ]; } * married = NULL ;
#line 27 "test3.pgc"
char * wifesname = "Petra" ;
#line 28 "test3.pgc"
char * query = "select * from meskes where name = ?" ;
/* exec sql end declare section */
#line 29 "test3.pgc"
/* declare cur cursor for select name , born , age , married , children from meskes */
#line 32 "test3.pgc"
char msg[128];
ECPGdebug(1, stderr);
strcpy(msg, "connect");
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 39 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 39 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 39 "test3.pgc"
strcpy(msg, "create");
{ ECPGdo(__LINE__, 0, 1, NULL, "create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
#line 42 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 42 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 42 "test3.pgc"
strcpy(msg, "insert");
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , married , children ) values( ? , '19900404' , 3 )",
ECPGt_char,&(wifesname),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 45 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 45 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 45 "test3.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age , married , children ) values( 'Michael' , 19660117 , 35 , '19900404' , 3 )", ECPGt_EOIT, ECPGt_EORT);
#line 46 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 46 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 46 "test3.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Carsten' , 19910103 , 10 )", ECPGt_EOIT, ECPGt_EORT);
#line 47 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 47 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 47 "test3.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Marc' , 19930907 , 8 )", ECPGt_EOIT, ECPGt_EORT);
#line 48 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 48 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 48 "test3.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Chris' , 19970923 , 4 )", ECPGt_EOIT, ECPGt_EORT);
#line 49 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 49 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 49 "test3.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 52 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 52 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 52 "test3.pgc"
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from meskes ", ECPGt_EOIT, ECPGt_EORT);
#line 55 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 55 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 55 "test3.pgc"
strcpy(msg, "move");
{ ECPGdo(__LINE__, 0, 1, NULL, "move ? in cur",
ECPGt_int,&(movevalue),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 58 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 58 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 58 "test3.pgc"
/* exec sql whenever not found break ; */
#line 60 "test3.pgc"
while (1) {
strcpy(msg, "fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch from cur", ECPGt_EOIT,
ECPGt_varchar,&(personal.name),(long)10,(long)1,sizeof(struct varchar_name),
ECPGt_int,&(ind_personal.ind_name),(long)1,(long)1,sizeof(int),
ECPGt_long,&(personal.birth.born),(long)1,(long)1,sizeof(long),
ECPGt_long,&(ind_personal.ind_birth.born),(long)1,(long)1,sizeof(long),
ECPGt_short,&(personal.birth.age),(long)1,(long)1,sizeof(short),
ECPGt_short,&(ind_personal.ind_birth.age),(long)1,(long)1,sizeof(short),
ECPGt_varchar,&(married),(long)10,(long)0,sizeof(struct varchar_married),
ECPGt_int,&(ind_married),(long)1,(long)0,sizeof(int),
ECPGt_int,&(children),(long)1,(long)1,sizeof(int),
ECPGt_int,&(ind_children),(long)1,(long)1,sizeof(int), ECPGt_EORT);
#line 64 "test3.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 64 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 64 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 64 "test3.pgc"
printf("%8.8s", personal.name.arr);
if (ind_personal.ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (ind_personal.ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if (*ind_married >= 0)
printf(", married %10.10s", married->arr);
if (ind_children >= 0)
printf(", children = %d", children);
putchar('\n');
free(married);
married = NULL;
}
strcpy(msg, "close");
{ ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
#line 81 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 81 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 81 "test3.pgc"
/* and now a query with prepare */
{ ECPGprepare(__LINE__, "MM" , query);
#line 84 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 84 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 84 "test3.pgc"
/* declare prep cursor for ? */
#line 85 "test3.pgc"
strcpy(msg, "open");
{ ECPGdo(__LINE__, 0, 1, NULL, "declare prep cursor for ?",
ECPGt_char_variable,(ECPGprepared_statement("MM")),(long)1,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(wifesname),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 88 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 88 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 88 "test3.pgc"
/* exec sql whenever not found break ; */
#line 90 "test3.pgc"
while (1) {
strcpy(msg, "fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch in prep", ECPGt_EOIT,
ECPGt_varchar,&(personal.name),(long)10,(long)1,sizeof(struct varchar_name),
ECPGt_int,&(ind_personal.ind_name),(long)1,(long)1,sizeof(int),
ECPGt_long,&(personal.birth.born),(long)1,(long)1,sizeof(long),
ECPGt_long,&(ind_personal.ind_birth.born),(long)1,(long)1,sizeof(long),
ECPGt_short,&(personal.birth.age),(long)1,(long)1,sizeof(short),
ECPGt_short,&(ind_personal.ind_birth.age),(long)1,(long)1,sizeof(short),
ECPGt_varchar,&(married),(long)10,(long)0,sizeof(struct varchar_married),
ECPGt_int,&(ind_married),(long)1,(long)0,sizeof(int),
ECPGt_int,&(children),(long)1,(long)1,sizeof(int),
ECPGt_int,&(ind_children),(long)1,(long)1,sizeof(int), ECPGt_EORT);
#line 94 "test3.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
#line 94 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 94 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 94 "test3.pgc"
printf("%8.8s", personal.name.arr);
if (ind_personal.ind_birth.born >= 0)
printf(", born %ld", personal.birth.born);
if (ind_personal.ind_birth.age >= 0)
printf(", age = %d", personal.birth.age);
if (*ind_married >= 0)
printf(", married %10.10s", married->arr);
if (ind_children >= 0)
printf(", children = %d", children);
putchar('\n');
}
free(married);
strcpy(msg, "close");
{ ECPGdo(__LINE__, 0, 1, NULL, "close prep", ECPGt_EOIT, ECPGt_EORT);
#line 110 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 110 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 110 "test3.pgc"
strcpy(msg, "drop");
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);
#line 113 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 113 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 113 "test3.pgc"
strcpy(msg, "commit");
{ ECPGtrans(__LINE__, NULL, "commit");
#line 116 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 116 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 116 "test3.pgc"
strcpy(msg, "disconnect");
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 119 "test3.pgc"
if (sqlca.sqlwarn[0] == 'W') warn ( );
#line 119 "test3.pgc"
if (sqlca.sqlcode < 0) Finish ( msg );}
#line 119 "test3.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[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 42: QUERY: create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 45: QUERY: insert into meskes ( name , married , children ) values( 'Petra' , '19900404' , 3 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 45 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46: QUERY: insert into meskes ( name , born , age , married , children ) values( 'Michael' , 19660117 , 35 , '19900404' , 3 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 47: QUERY: insert into meskes ( name , born , age ) values( 'Carsten' , 19910103 , 10 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 47 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 48: QUERY: insert into meskes ( name , born , age ) values( 'Marc' , 19930907 , 8 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 48 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 49: QUERY: insert into meskes ( name , born , age ) values( 'Chris' , 19970923 , 4 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 49 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 52 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55: QUERY: declare cur cursor for select name , born , age , married , children from meskes on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 58: QUERY: move 2 in cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 58 Ok: MOVE 2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: Carsten offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: 19910103 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: 10 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: Marc offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: 19930907 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: 8 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: Chris offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: 19970923 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: 4 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 64: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 64: Correctly got 0 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 64, 'No data found in line 64.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 81: QUERY: close cur on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 81 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGprepare line 84: QUERY: select * from meskes where name = ?
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 88: QUERY: declare prep cursor for select * from meskes where name = 'Petra' on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 88 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 94: QUERY: fetch in prep on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 94: Correctly got 1 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 94: RESULT: Petra offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 94: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 94: RESULT: offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 94: RESULT: 04-04-1990 offset: 16 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 94: RESULT: 3 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 94: QUERY: fetch in prep on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 94: Correctly got 0 tuples with 5 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 94, 'No data found in line 94.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 110: QUERY: close prep on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 110 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 113: QUERY: drop table meskes on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 113 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 116 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
Carsten , born 19910103, age = 10
Marc , born 19930907, age = 8
Chris , born 19970923, age = 4
Petra , married 04-04-1990, children = 3
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test4.pgc"
#include <locale.h>
#include <string.h>
#include <stdlib.h>
/* exec sql whenever sqlerror sqlprint ; */
#line 5 "test4.pgc"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 7 "test4.pgc"
#line 1 "./../regression.h"
#line 8 "test4.pgc"
typedef enum { OK = 0 , ERR = 1 , WARN = 2 } errtype ;
#line 15 "test4.pgc"
int
main (void)
{
/* exec sql begin declare section */
#line 25 "test4.pgc"
struct {
#line 23 "test4.pgc"
errtype e : 2 ;
#line 24 "test4.pgc"
int code : 14 ;
} error = { 1 , 147 } ;
#line 26 "test4.pgc"
int i = 1 ;
#line 27 "test4.pgc"
int * did = & i ;
#line 28 "test4.pgc"
int a [ 10 ] = { 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 } ;
#line 29 "test4.pgc"
char text [ 25 ] = "klmnopqrst" ;
#line 30 "test4.pgc"
char * t = ( char * ) malloc ( 10 ) ;
#line 31 "test4.pgc"
double f ;
#line 32 "test4.pgc"
bool b = true ;
/* exec sql end declare section */
#line 33 "test4.pgc"
strcpy(t, "0123456789");
setlocale(LC_ALL, "de_DE");
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 40 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "test4.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
#line 42 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 42 "test4.pgc"
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 44 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 44 "test4.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) , b bool , t int , err int ) ", ECPGt_EOIT, ECPGt_EORT);
#line 46 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 46 "test4.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text , b , t , err ) values( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' , 'f' , 0 , 0 )", ECPGt_EOIT, ECPGt_EORT);
#line 48 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 48 "test4.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text , b , t , err ) values( 140787.0 , 2 , ? , ? , 't' , 2 , 14 )",
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 50 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 50 "test4.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text , b , t , err ) values( 14.07 , ? , ? , ? , ? , 1 , 147 )",
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),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(t),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 55 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 55 "test4.pgc"
error.code=0;
{ ECPGtrans(__LINE__, NULL, "commit");
#line 59 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 59 "test4.pgc"
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 61 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 61 "test4.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select f , text , b 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_bool,&(b),(long)1,(long)1,sizeof(bool),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 66 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 66 "test4.pgc"
printf("Found f=%f text=%10.10s b=%d\n", f, text, b);
f=140787;
{ 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),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(t),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 74 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 74 "test4.pgc"
for (i = 0; i < 10; i++)
printf("Found a[%d] = %d\n", i, a[i]);
printf("Found text=%10.10s\n", t);
{ 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 84 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 84 "test4.pgc"
printf("Found text=%s\n", text);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 88 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 88 "test4.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
#line 90 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 90 "test4.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 92 "test4.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 92 "test4.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[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 42 action = on connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 44 action = begin transaction connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46: QUERY: create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) , b bool , t int , err int ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 48: QUERY: insert into test ( f , i , a , text , b , t , err ) values( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' , 'f' , 0 , 0 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 48 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 50: QUERY: insert into test ( f , i , a , text , b , t , err ) values( 140787.0 , 2 , array [9,8,7,6,5,4,3,2,1,0] , 'klmnopqrst' , 't' , 2 , 14 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 50 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55: QUERY: insert into test ( f , i , a , text , b , t , err ) values( 14.07 , 1 , array [9,8,7,6,5,4,3,2,1,0] , '0123456789' , 't' , 1 , 147 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 55 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 59 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 61 action = begin transaction connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 63: QUERY: select f , text , b from test where i = 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 63: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 63: RESULT: 14.07 offset: 8 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 63: RESULT: 0123456789 offset: 25 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 63: RESULT: t offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: QUERY: select a , text from test where f = 140787 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGis_type_an_array line 71: TYPE database: 1007 C: 5 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 71: RESULT: {9,8,7,6,5,4,3,2,1,0} offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 71: RESULT: klmnopqrst offset: 1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 81: QUERY: select a from test where f = 140787 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 81: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 81: RESULT: {9,8,7,6,5,4,3,2,1,0} offset: 25 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 88: QUERY: drop table test on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 88 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 90 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
Found f=14,070000 text=0123456789 b=1
Found a[0] = 9
Found a[1] = 8
Found a[2] = 7
Found a[3] = 6
Found a[4] = 5
Found a[5] = 4
Found a[6] = 3
Found a[7] = 2
Found a[8] = 1
Found a[9] = 0
Found text=klmnopqrst
Found text={9,8,7,6,5,4,3,2,1,0}
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test5.pgc"
#include <stdio.h>
#include <stdlib.h>
#line 1 "./../regression.h"
#line 4 "test5.pgc"
typedef long mmInteger ;
#line 6 "test5.pgc"
#line 6 "test5.pgc"
typedef char mmChar ;
#line 7 "test5.pgc"
#line 7 "test5.pgc"
typedef short mmSmallInt ;
#line 8 "test5.pgc"
#line 8 "test5.pgc"
/* exec sql begin declare section */
struct TBempl {
#line 13 "test5.pgc"
mmInteger idnum ;
#line 14 "test5.pgc"
mmChar name [ 21 ] ;
#line 15 "test5.pgc"
mmSmallInt accs ;
#line 16 "test5.pgc"
mmChar byte [ 20 ] ;
} ;/* exec sql end declare section */
#line 18 "test5.pgc"
int
main (void)
{
/* exec sql begin declare section */
#line 24 "test5.pgc"
struct TBempl empl ;
#line 25 "test5.pgc"
char * data = "\\001\\155\\000\\212" ;
#line 30 "test5.pgc"
union {
#line 28 "test5.pgc"
mmSmallInt accs ;
#line 29 "test5.pgc"
char t [ 2 ] ;
} a ;
/* exec sql end declare section */
#line 31 "test5.pgc"
int i;
ECPGdebug (1, stderr);
empl.idnum = 1;
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 37 "test5.pgc"
if (sqlca.sqlcode)
{
printf ("connect error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 45 "test5.pgc"
if (sqlca.sqlcode)
{
printf ("create error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
{ 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);}
#line 52 "test5.pgc"
if (sqlca.sqlcode)
{
printf ("insert error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "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_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);}
#line 62 "test5.pgc"
if (sqlca.sqlcode)
{
printf ("select error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
/* declare C cursor for select name , accs , byte from empl where idnum = ? */
#line 70 "test5.pgc"
{ 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);}
#line 71 "test5.pgc"
{ 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);}
#line 72 "test5.pgc"
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
memset(empl.name, 0, 21L);
memset(empl.byte, '#', 20L);
/* declare B binary cursor for select name , accs , byte from empl where idnum = ? */
#line 83 "test5.pgc"
{ 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);}
#line 84 "test5.pgc"
{ 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,&(a.accs),(long)1,(long)1,sizeof(short),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(empl.byte),(long)20,(long)1,(20)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "test5.pgc"
if (sqlca.sqlcode)
{
printf ("fetch error = %ld\n", sqlca.sqlcode);
exit (sqlca.sqlcode);
}
{ ECPGdo(__LINE__, 0, 1, NULL, "close B", ECPGt_EOIT, ECPGt_EORT);}
#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++)
{
if (empl.byte[i] == '#')
break;
printf("(%o)", (unsigned char)empl.byte[i]);
}
printf("\n");
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 106 "test5.pgc"
exit (0);
}
[NO_PID]: ECPGdebug: set to 1
[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 44: QUERY: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 44 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52: QUERY: insert into empl values( 1 , 'first user' , 320 , E'\\001\\155\\000\\212' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 59: QUERY: select name , accs , byte from empl where idnum = 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 59: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 59: RESULT: first user offset: 21 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 59: RESULT: 320 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 59: RESULT: \001m\000\212 offset: 20 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71: QUERY: declare C cursor for select name , accs , byte from empl where idnum = 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 71 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 72: QUERY: fetch C on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 72: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 72: RESULT: first user offset: 21 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 72: RESULT: 320 offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 72: RESULT: \001m\000\212 offset: 20 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 84: QUERY: declare B binary cursor for select name , accs , byte from empl where idnum = 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 84 Ok: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 85: QUERY: fetch B on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 85: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 85: RESULT: BINARY offset: 21 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 85: RESULT: BINARY offset: 2 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 85: RESULT: BINARY offset: 20 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 92: QUERY: close B on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 92 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
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)
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test1.pgc"
/*
* this file tests all sorts of connecting to one single database.
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* do not include regression.h */
int
main(void)
{
/* exec sql begin declare section */
#line 16 "test1.pgc"
char db [ 200 ] ;
#line 17 "test1.pgc"
char id [ 200 ] ;
#line 18 "test1.pgc"
char pw [ 200 ] ;
/* exec sql end declare section */
#line 19 "test1.pgc"
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 23 "test1.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
#line 24 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 25 "test1.pgc"
/* <-- "main" not specified */
strcpy(db, "connectdb");
strcpy(id, "main");
{ ECPGconnect(__LINE__, 0, db , NULL,NULL , id, 0); }
#line 29 "test1.pgc"
{ ECPGdisconnect(__LINE__, id);}
#line 30 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "connectdb@localhost" , NULL,NULL , "main", 0); }
#line 32 "test1.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 33 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "connectdb@localhost" , NULL,NULL , "main", 0); }
#line 35 "test1.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 36 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "connectdb@localhost" , "connectuser" , "connectdb" , "main", 0); }
#line 38 "test1.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 39 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
#line 41 "test1.pgc"
{ ECPGdisconnect(__LINE__, "nonexistant");}
#line 42 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 43 "test1.pgc"
strcpy(pw, "connectpw");
strcpy(db, "tcp:postgresql://localhost:55432/connectdb");
{ ECPGconnect(__LINE__, 0, db , "connectuser" , pw , NULL, 0); }
#line 47 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 48 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
#line 50 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 51 "test1.pgc"
/* wrong db */
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/nonexistant" , "connectuser" , "connectpw" , NULL, 0); }
#line 54 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 55 "test1.pgc"
/* wrong port */
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:0/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
#line 58 "test1.pgc"
/* no disconnect necessary */
/* wrong password */
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "wrongpw" , NULL, 0); }
#line 62 "test1.pgc"
/* no disconnect necessary */
/* connect twice */
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 66 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
#line 67 "test1.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 68 "test1.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24: QUERY: alter user connectuser encrypted password 'connectpw' on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24 Ok: ALTER ROLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on localhost port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on localhost port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on localhost port <DEFAULT> for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on localhost port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -220 in line 42, 'No such connection nonexistant in line 42.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ecpg_finish: Connection connectdb closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on localhost port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection connectdb closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection connectdb closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database nonexistant on localhost port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: connect: could not open database nonexistant on localhost port 55432 for user connectuser in line 54
FATAL: database "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection nonexistant closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -402 in line 54, 'Could not connect to database nonexistant in line 54.'.
[NO_PID]: sqlca: code: -402, state: 08001
[NO_PID]: raising sqlcode -220 in line 55, 'No such connection CURRENT in line 55.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database connectdb on localhost port 0 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: connect: could not open database connectdb on localhost port 0 for user connectuser in line 58
could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 0?
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection connectdb closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -402 in line 58, 'Could not connect to database connectdb in line 58.'.
[NO_PID]: sqlca: code: -402, state: 08001
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: connect: connection identifier main is already in use
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test2.pgc"
/*
* this file tests multiple connections to databases and switches
* between them.
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* do not include regression.h */
int
main(void)
{
/* exec sql begin declare section */
#line 17 "test2.pgc"
char id [ 200 ] ;
#line 18 "test2.pgc"
char res [ 200 ] ;
/* exec sql end declare section */
#line 19 "test2.pgc"
ECPGdebug(1, stderr);
strcpy(id, "first");
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , id, 0); }
#line 24 "test2.pgc"
{ ECPGconnect(__LINE__, 0, "regress1@localhost" , 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,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 28 "test2.pgc"
{ 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);}
#line 29 "test2.pgc"
{ 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);}
#line 30 "test2.pgc"
{ ECPGsetconn(__LINE__, "first");}
#line 32 "test2.pgc"
{ 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);}
#line 33 "test2.pgc"
/* this will disconnect from "first" */
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 36 "test2.pgc"
{ 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);}
#line 37 "test2.pgc"
/* error here since "first" is already disconnected */
{ ECPGdisconnect(__LINE__, id);}
#line 40 "test2.pgc"
/* disconnect from "second" */
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 43 "test2.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on localhost port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28: QUERY: select current_database () on connection second
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 28: RESULT: regress1 offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29: QUERY: select current_database () on connection first
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 29: RESULT: connectdb offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: QUERY: select current_database () on connection second
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 30: RESULT: regress1 offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 33: QUERY: select current_database () on connection first
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 33: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 33: RESULT: connectdb offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection first closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: QUERY: select current_database () on connection second
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 37: RESULT: regress1 offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -220 in line 40, 'No such connection first in line 40.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ecpg_finish: Connection second closed.
[NO_PID]: sqlca: code: 0, state: 00000
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test3.pgc"
/*
* this file just tests the several possibilities you have for a disconnect
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* do not include regression.h */
int
main(void)
{
/* exec sql begin declare section */
#line 16 "test3.pgc"
char id [ 200 ] ;
#line 17 "test3.pgc"
char res [ 200 ] ;
/* exec sql end declare section */
#line 18 "test3.pgc"
ECPGdebug(1, stderr);
strcpy(id, "first");
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , id, 0); }
#line 23 "test3.pgc"
{ ECPGconnect(__LINE__, 0, "regress1@localhost" , 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,
ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 27 "test3.pgc"
/* will close "second" */
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 30 "test3.pgc"
{ 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);}
#line 31 "test3.pgc"
{ ECPGconnect(__LINE__, 0, "regress1@localhost" , NULL,NULL , "second", 0); }
#line 33 "test3.pgc"
/* will close "second" */
{ ECPGdisconnect(__LINE__, "DEFAULT");}
#line 35 "test3.pgc"
{ ECPGconnect(__LINE__, 0, "regress1@localhost" , NULL,NULL , "second", 0); }
#line 37 "test3.pgc"
{ ECPGdisconnect(__LINE__, "ALL");}
#line 38 "test3.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 40 "test3.pgc"
{ ECPGdisconnect(__LINE__, "DEFAULT");}
#line 41 "test3.pgc"
{ ECPGdisconnect(__LINE__, "ALL");}
#line 42 "test3.pgc"
/*
* exec sql disconnect;
* exec sql disconnect name;
*
* are used in other tests
*/
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on localhost port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27: QUERY: select current_database () on connection second
[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: regress1 offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection second closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31: QUERY: select current_database () on connection first
[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: connectdb offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on localhost port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -220 in line 35, 'No such connection DEFAULT in line 35.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: connect: connection identifier second is already in use
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection second closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection first closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -220 in line 40, 'No such connection CURRENT in line 40.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 41, 'No such connection DEFAULT in line 41.'.
[NO_PID]: sqlca: code: -220, state: 08003
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test4.pgc"
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#line 1 "./../regression.h"
#line 6 "test4.pgc"
int
main(void)
{
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "main", 0); }
#line 13 "test4.pgc"
{ ECPGsetconn(__LINE__, "main");}
#line 15 "test4.pgc"
{ ECPGdisconnect(__LINE__, "DEFAULT");}
#line 17 "test4.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[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]: raising sqlcode -220 in line 17, 'No such connection DEFAULT in line 17.'.
[NO_PID]: sqlca: code: -220, state: 08003
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "init.pgc"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 1 "init.pgc"
enum e { ENUM0, ENUM1 };
struct sa { int member; };
int
fa(void)
{
printf("in fa\n");
return 2;
}
int
fb(int x)
{
printf("in fb (%d)\n", x);
return x;
}
int
fc(const char *x)
{
printf("in fc (%s)\n", x);
return *x;
}
int fd(const char *x,int i)
{
printf("in fd (%s, %d)\n", x, i);
return (*x)*i;
}
int fe(enum e x)
{
printf("in fe (%d)\n", (int) x);
return (int)x;
}
void sqlnotice(char *notice, short trans)
{
if (!notice)
notice = "-empty-";
printf("in sqlnotice (%s, %d)\n", notice, trans);
}
#define YES 1
#ifdef _cplusplus
namespace N
{
static const int i=2;
};
#endif
int main(void)
{
struct sa x,*y;
/* exec sql begin declare section */
/* = 1L */
/* = 40000000000LL */
#line 61 "init.pgc"
int a = ( int ) 2 ;
#line 62 "init.pgc"
int b = 2 + 2 ;
#line 63 "init.pgc"
int b2 = ( 14 * 7 ) ;
#line 64 "init.pgc"
int d = x . member ;
#line 65 "init.pgc"
int g = fb ( 2 ) ;
#line 66 "init.pgc"
int i = 3 ^ 1 ;
#line 67 "init.pgc"
int j = 1 ? 1 : 2 ;
#line 69 "init.pgc"
int e = y -> member ;
#line 70 "init.pgc"
int c = 10 >> 2 ;
#line 71 "init.pgc"
bool h = 2 || 1 ;
#line 72 "init.pgc"
long iay ;
#line 73 "init.pgc"
long long iax ;
/* exec sql end declare section */
#line 74 "init.pgc"
ECPGdebug(1, stderr);
int f=fa();
#ifdef _cplusplus
/* exec sql begin declare section */
/* compile error */
#line 82 "init.pgc"
int k = N : : i ;
/* exec sql end declare section */
#line 83 "init.pgc"
#endif
/* exec sql whenever sqlerror do fa ( ) ; */
#line 86 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 87 "init.pgc"
if (sqlca.sqlcode < 0) fa ( );}
#line 87 "init.pgc"
/* exec sql whenever sqlerror do fb ( 20 ) ; */
#line 88 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 89 "init.pgc"
if (sqlca.sqlcode < 0) fb ( 20 );}
#line 89 "init.pgc"
/* exec sql whenever sqlerror do fc ( \"50\" ) ; */
#line 90 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 91 "init.pgc"
if (sqlca.sqlcode < 0) fc ( "50" );}
#line 91 "init.pgc"
/* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */
#line 92 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 93 "init.pgc"
if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
#line 93 "init.pgc"
/* exec sql whenever sqlerror do fe ( ENUM0 ) ; */
#line 94 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 95 "init.pgc"
if (sqlca.sqlcode < 0) fe ( ENUM0 );}
#line 95 "init.pgc"
/* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */
#line 96 "init.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select now () ", ECPGt_EOIT, ECPGt_EORT);
#line 97 "init.pgc"
if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
#line 97 "init.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -220 in line 87, 'No such connection NULL in line 87.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 89, 'No such connection NULL in line 89.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 91, 'No such connection NULL in line 91.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 93, 'No such connection NULL in line 93.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 95, 'No such connection NULL in line 95.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: raising sqlcode -220 in line 97, 'No such connection NULL in line 97.'.
[NO_PID]: sqlca: code: -220, state: 08003
in fb (2)
in fa
in fa
in fb (20)
in fc (50)
in fd (50, 1)
in fe (0)
in sqlnotice (-empty-, 0)
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "test_notice.pgc"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 1 "test_notice.pgc"
#line 1 "./../regression.h"
#line 2 "test_notice.pgc"
#include <stdio.h>
static void printwarning(void)
{
if (sqlca.sqlwarn[0]) printf("sqlca.sqlwarn: %c",sqlca.sqlwarn[0]);
else return;
if (sqlca.sqlwarn[1]) putchar('1');
if (sqlca.sqlwarn[2]) putchar('2');
putchar('\n');
}
int main(int argc, char **argv)
{
/* exec sql begin declare section */
#line 20 "test_notice.pgc"
int payload ;
/* exec sql end declare section */
#line 21 "test_notice.pgc"
/* actually this will print 'sql error' if a warning occurs */
/* exec sql whenever sql_warning do printwarning ( ) ; */
#line 24 "test_notice.pgc"
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 28 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 28 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,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);
#line 33 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 33 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 36 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 36 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
/* double BEGIN */
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 41 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 41 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
/* BEGIN with already open transaction */
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 45 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 45 "test_notice.pgc"
if (sqlca.sqlcode!=ECPG_WARNING_IN_TRANSACTION) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
/* double COMMIT */
{ ECPGtrans(__LINE__, NULL, "commit");
#line 49 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 49 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
/* COMMIT without open transaction */
{ ECPGtrans(__LINE__, NULL, "commit");
#line 53 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 53 "test_notice.pgc"
if (sqlca.sqlcode!=ECPG_WARNING_NO_TRANSACTION) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
/* ROLLBACK without open transaction */
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 57 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 57 "test_notice.pgc"
if (sqlca.sqlcode!=ECPG_WARNING_NO_TRANSACTION) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
sqlca.sqlcode=0;
/* declare x cursor for select * from test */
#line 61 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGdo(__LINE__, 0, 1, NULL, "declare x cursor for select * from test ", ECPGt_EOIT, ECPGt_EORT);
#line 64 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 64 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGdo(__LINE__, 0, 1, NULL, "declare x cursor for select * from test ", ECPGt_EOIT, ECPGt_EORT);
#line 67 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 67 "test_notice.pgc"
if (sqlca.sqlcode!=ECPG_WARNING_PORTAL_EXISTS) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGdo(__LINE__, 0, 1, NULL, "close x", ECPGt_EOIT, ECPGt_EORT);
#line 70 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 70 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 73 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 73 "test_notice.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "close x", ECPGt_EOIT, ECPGt_EORT);
#line 75 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 75 "test_notice.pgc"
if (sqlca.sqlcode!=ECPG_WARNING_UNKNOWN_PORTAL) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 78 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 78 "test_notice.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "update test set nonexistent = 2 ", ECPGt_EOIT, ECPGt_EORT);
#line 80 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 80 "test_notice.pgc"
if (sqlca.sqlcode!=ECPG_PGSQL) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGdo(__LINE__, 0, 1, NULL, "select payload from test where index = 1 ", ECPGt_EOIT,
ECPGt_int,&(payload),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 83 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 83 "test_notice.pgc"
if (sqlca.sqlcode!=ECPG_WARNING_QUERY_IGNORED) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 86 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 86 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
/* this will raise a warning */
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
#line 90 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 90 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGtrans(__LINE__, NULL, "commit");
#line 92 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 92 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 95 "test_notice.pgc"
if (sqlca.sqlwarn[0] == 'W') printwarning ( );}
#line 95 "test_notice.pgc"
if (sqlca.sqlcode) printf("%d %ld:%s\n",__LINE__,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: ECPGexecute line 31: QUERY: create table test ( "index" numeric ( 3 ) primary key , "payload" int4 not null ) on connection regress1
[NO_PID]: ECPGexecute line 31 Ok: CREATE TABLE
[NO_PID]: ECPGtrans line 36 action = commit connection = regress1
[NO_PID]: ECPGtrans line 39 action = begin transaction connection = regress1
[NO_PID]: ECPGtrans line 42 action = begin transaction connection = regress1
[NO_PID]: eine Transaktion ist bereits begonnen[NO_PID]: raising sqlcode -603
[NO_PID]: ECPGtrans line 45 action = commit connection = regress1
[NO_PID]: ECPGtrans line 48 action = commit connection = regress1
[NO_PID]: ECPGtrans line 51 action = rollback connection = regress1
[NO_PID]: ECPGexecute line 58: QUERY: declare x cursor for select * from test on connection regress1
[NO_PID]: ECPGexecute line 58 Ok: DECLARE CURSOR
[NO_PID]: ECPGexecute line 61: QUERY: declare x cursor for select * from test on connection regress1
[NO_PID]: ECPGexecute line 61: Error: FEHLER: Cursor >>x<< existiert bereits
[NO_PID]: raising sqlstate 42P03 in line 61, ''Cursor >>x<< existiert bereits' in line 61.'.
[NO_PID]: ECPGexecute line 64: QUERY: close x on connection regress1
[NO_PID]: ECPGexecute line 64: Error: FEHLER: aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende der Transaktion ignoriert
[NO_PID]: raising sqlstate 25P02 in line 64, ''aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende '.
[NO_PID]: ECPGexecute line 67: QUERY: close x on connection regress1
[NO_PID]: ECPGexecute line 67: Error: FEHLER: aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende der Transaktion ignoriert
[NO_PID]: raising sqlstate 25P02 in line 67, ''aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende '.
[NO_PID]: ECPGexecute line 70: QUERY: update test set nonexistent = 2 on connection regress1
[NO_PID]: ECPGexecute line 70: Error: FEHLER: aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende der Transaktion ignoriert
[NO_PID]: raising sqlstate 25P02 in line 70, ''aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende '.
[NO_PID]: ECPGexecute line 73: QUERY: select payload from test where index = 1 on connection regress1
[NO_PID]: ECPGexecute line 73: Error: FEHLER: aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende der Transaktion ignoriert
[NO_PID]: raising sqlstate 25P02 in line 73, ''aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende '.
[NO_PID]: ECPGtrans line 76 action = rollback connection = regress1
[NO_PID]: ECPGexecute line 80: QUERY: drop table test on connection regress1
[NO_PID]: ECPGexecute line 80 Ok: DROP TABLE
[NO_PID]: ECPGtrans line 82 action = commit connection = regress1
[NO_PID]: ecpg_finish: Connection regress1 closed.
sqlca.sqlwarn: W2
49 0:
52 0:
62 -400:'Cursor >>x<< existiert bereits' in line 61.
65 -400:'aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende
68 -400:'aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende
74 -400:'aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* 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>
#include <pgtypes_date.h>
#include <pgtypes_timestamp.h>
#include <pgtypes_interval.h>
#line 1 "./../regression.h"
#line 10 "dt_test.pgc"
int
main(void)
{
/* exec sql begin declare section */
#line 16 "dt_test.pgc"
date date1 ;
#line 17 "dt_test.pgc"
timestamp ts1 ;
#line 18 "dt_test.pgc"
interval iv1 ;
#line 19 "dt_test.pgc"
char * text ;
/* exec sql end declare section */
#line 20 "dt_test.pgc"
date date2;
int mdy[3] = { 4, 19, 1998 };
char *fmt, *out, *in;
char *d1 = "Mon Jan 17 1966";
char *t1 = "2000-7-12 17:34:29";
int i;
ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 29 "dt_test.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 30 "dt_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 30 "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"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 31 "dt_test.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
#line 32 "dt_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 32 "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 , iv ) values( ? , ? , '2003-02-28 12:34' :: timestamp - 'Mon Jan 17 1966' :: timestamp )",
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 37 "dt_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 37 "dt_test.pgc"
{ 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),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_timestamp,&(ts1),(long)1,(long)1,sizeof(timestamp),
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"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 39 "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);
text = PGTYPESinterval_to_asc(&iv1);
printf ("interval: %s\n", text);
free(text);
PGTYPESdate_mdyjul(mdy, &date2);
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
/* reset */
mdy[0] = mdy[1] = mdy[2] = 0;
printf("date seems to get encoded to julian %ld\n", date2);
PGTYPESdate_julmdy(date2, mdy);
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(ts1));
PGTYPESdate_today(&date1);
/* can't output this in regression mode */
printf("using date %s\n", text);
free(text);
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
out = (char*) malloc(strlen(fmt) + 1);
date1 = PGTYPESdate_from_timestamp(ts1);
PGTYPESdate_fmt_asc(date1, fmt, out);
printf("Above date in format \"%s\" is \"%s\"\n", fmt, out);
free(out);
/* rdate_defmt_asc() */
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
*/
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc1: %s\n", text);
free(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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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);
/* abc-03:10:35-def-02/11/94-gh */
/* 12345678901234567890123456789 */
out = (char*) malloc(32);
i = PGTYPEStimestamp_fmt_asc(&ts1, out, 31, "abc-%X-def-%x-ghi%%");
printf("timestamp_fmt_asc: %d: %s\n", i, out);
free(out);
fmt = "This is a %m/%d/%y %H-%Ml%Stest";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%b %d %H:%M:%S %z %Y";
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);
fmt = "%b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%";
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);
fmt = "a %";
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);
fmt = "%b, %d %H_%M`%S %z %Y";
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);
fmt = "%a %b %%%d %H:%M:%S %Z %Y";
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);
fmt = "%a %b %%%d %H:%M:%S %Z %Y";
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);
fmt = "abc%n %C %B %%%d %H:%M:%S %Z %Y";
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);
fmt = "abc%n %C %B %%%d %H:%M:%S %Z %y";
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);
fmt = "";
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);
fmt = NULL;
in = "1980-04-12 3:49:44 ";
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);
fmt = "%B %d, %Y. Time: %I:%M%p";
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);
in = "September 6 at 01:30 pm in the year 1983";
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);
in = " 1976, July 14. Time: 9:15am";
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);
in = " 1976, July 14. Time: 9:15 am";
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);
in = " 1976, P.M. July 14. Time: 9:15";
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");
#line 356 "dt_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 356 "dt_test.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 357 "dt_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 357 "dt_test.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32 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]: 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 39: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 39: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 39: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
Date: 1966-01-17
timestamp: 2000-07-12 17:34:29
interval: @ 13556 days 12 hours 34 mins
m: 4, d: 19, y: 1998
date seems to get encoded to julian -622
m: 4, d: 19, y: 1998
date_day of 2003-12-04 17:34:29 is 4
using date 2003-12-04 17:34:29
Above date in format "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end" is "(Thu), Dec. 04, 2003, repeat: (Thu), Dec. 04, 2003. end"
date_defmt_asc1: 1995-12-25
date_defmt_asc2: 0095-12-25
date_defmt_asc3: 0095-12-25
date_defmt_asc4: 1995-12-25
date_defmt_asc5: 1995-12-25
date_defmt_asc6: 1995-12-25
date_defmt_asc7: 1995-12-25
date_defmt_asc8: 1995-12-25
date_defmt_asc9: 1995-12-25
date_defmt_asc10: 1995-12-25
date_defmt_asc12: 0095-12-25
timestamp_to_asc1: 1996-02-29 00:00:00
timestamp_to_asc2: 1994-02-11 03:10:35
timestamp_to_asc3: 2000-01-01 00:00:00
timestamp_fmt_asc: 0: abc-00:00:00-def-01/01/00-ghi%
timestamp_defmt_asc(This is a 4/12/80 3-39l12test, This is a %m/%d/%y %H-%Ml%Stest) = 1980-04-12 03:39:12, error: 0
timestamp_defmt_asc(Tue Jul 22 17:28:44 +0200 2003, %a %b %d %H:%M:%S %z %Y) = 2003-07-22 15:28:44, error: 0
timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 2000, %a %b %d %H:%M:%S %z %Y) = 2000-02-29 15:28:44, error: 0
timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 1900, %a %b %d %H:%M:%S %z %Y) = 1900-02-28 15:28:44, error (should be error!): 1
timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 1996, %a %b %d %H:%M:%S %z %Y) = 1996-02-29 15:28:44, error: 0
timestamp_defmt_asc( Jul 31 17:28:44 +0200 1996, %b %d %H:%M:%S %z %Y) = 1996-07-31 15:28:44, error: 0
timestamp_defmt_asc( Jul 32 17:28:44 +0200 1996, %b %d %H:%M:%S %z %Y) = 1996-07-31 15:28:44, error (should be error!): 1
timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 1997, %a %b %d %H:%M:%S %z %Y) = 1997-02-28 15:28:44, error (should be error!): 1
timestamp_defmt_asc(Tue Jul 22 17:28:44 +0200 2003, %) = 1997-02-28 15:28:44, error (should be error!): 1
timestamp_defmt_asc(Tue Jul 22 17:28:44 +0200 2003, a %) = 1997-02-28 15:28:44, error (should be error!): 1
timestamp_defmt_asc( Jul, 22 17_28 `44 +0200 2003 , %b, %d %H_%M`%S %z %Y) = 2003-07-22 15:28:44, error: 0
timestamp_defmt_asc(Tue Jul %22 17:28:44 CEST 2003, %a %b %%%d %H:%M:%S %Z %Y) = 2003-07-22 15:28:44, error: 0
timestamp_defmt_asc(Tue Jul %22 17:28:44 CEST 2003, %a %b %%%d %H:%M:%S %Z %Y) = 2003-07-22 15:28:44, error: 0
timestamp_defmt_asc(abc
19 October %22 17:28:44 CEST 2003, abc%n %C %B %%%d %H:%M:%S %Z %Y) = 2003-10-22 15:28:44, error: 0
timestamp_defmt_asc(abc
18 October %34 17:28:44 CEST 80, abc%n %C %B %%%d %H:%M:%S %Z %y) = 1880-10-31 15:28:44, error (should be error!): 1
timestamp_defmt_asc(abc
18 October %34 17:28:44 CEST 80, ) = 1880-10-31 15:28:44, error (should be error!): 1
timestamp_defmt_asc(1980-04-12 3:49:44 , (null)) = 1980-04-12 03:49:44, error: 0
timestamp_defmt_asc(July 14, 1988. Time: 9:15am, %B %d, %Y. Time: %I:%M%p) = 1988-07-14 09:15:00, error: 0
timestamp_defmt_asc(September 6 at 01:30 pm in the year 1983, %B %d at %I:%M %p in the year %Y) = 1983-09-06 13:30:00, error: 0
timestamp_defmt_asc( 1976, July 14. Time: 9:15am, %Y, %B %d. Time: %I:%M %p) = 1976-07-14 09:15:00, error: 0
timestamp_defmt_asc( 1976, July 14. Time: 9:15 am, %Y, %B %d. Time: %I:%M%p) = 1976-07-14 09:15:00, error: 0
timestamp_defmt_asc( 1976, P.M. July 14. Time: 9:15, %Y, %P %B %d. Time: %I:%M) = 1976-07-14 21:15:00, error: 0
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "dt_test2.pgc"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pgtypes_date.h>
#include <pgtypes_timestamp.h>
#line 1 "./../regression.h"
#line 7 "dt_test2.pgc"
int
main(void)
{
/* exec sql begin declare section */
#line 13 "dt_test2.pgc"
date date1 ;
#line 14 "dt_test2.pgc"
timestamp ts1 ;
#line 15 "dt_test2.pgc"
char * text ;
/* exec sql end declare section */
#line 16 "dt_test2.pgc"
ECPGdebug(1, stderr);
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp: %s\n", text);
free(text);
date1 = PGTYPESdate_from_timestamp(ts1);
text = PGTYPESdate_to_asc(date1);
printf("Date of timestamp: %s\n", text);
free(text);
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[NO_PID]: sqlca: code: 0, state: 00000
timestamp: 2003-12-04 17:34:29
Date of timestamp: 2003-12-04
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* 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>
#include <decimal.h>
#line 1 "./../regression.h"
#line 8 "num_test.pgc"
int
main(void)
{
char *text="error\n";
numeric *value1, *value2, *res;
/* exec sql begin declare section */
/* = {0, 0, 0, 0, 0, NULL, NULL} ; */
#line 16 "num_test.pgc"
numeric * des ;
/* exec sql end declare section */
#line 18 "num_test.pgc"
double d;
ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 22 "num_test.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 24 "num_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 24 "num_test.pgc"
{ ECPGsetcommit(__LINE__, "off", NULL);
#line 26 "num_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 26 "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"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 27 "num_test.pgc"
value1 = PGTYPESnumeric_new();
PGTYPESnumeric_from_int(1407, value1);
text = PGTYPESnumeric_to_asc(value1, -1);
printf("long = %s\n", text);
free(text);
PGTYPESnumeric_free(value1);
value1 = PGTYPESnumeric_from_asc("2369.7", NULL);
value2 = PGTYPESnumeric_from_asc("10.0", NULL);
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' , ? )",
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"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 52 "num_test.pgc"
value2 = PGTYPESnumeric_from_asc("2369.7", NULL);
PGTYPESnumeric_mul(value1, value2, res);
PGTYPESnumeric_free(value2);
{ 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"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 58 "num_test.pgc"
PGTYPESnumeric_mul(res, des, res);
text = PGTYPESnumeric_to_asc(res, -1);
printf("mul = %s\n", text);
free(text);
PGTYPESnumeric_free(des);
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);
free(text);
PGTYPESnumeric_free(value1);
PGTYPESnumeric_free(value2);
PGTYPESnumeric_free(res);
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 76 "num_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 76 "num_test.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 77 "num_test.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 77 "num_test.pgc"
return (0);
}
[NO_PID]: ECPGdebug: set to 1
[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]: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 52 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 58: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 76 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
long = 1407.0
add = 2379.7
sub = 2369.7
mul = 13306998429.873000000
div = 1330699.84298730000 1.330700e+06
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "code100.pgc"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 1 "code100.pgc"
#include <stdio.h>
#line 1 "./../regression.h"
#line 4 "code100.pgc"
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"
ECPGdebug(1,stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 15 "code100.pgc"
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);}
#line 20 "code100.pgc"
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);
for (index=0;index<10;++index)
{ { 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);}
#line 28 "code100.pgc"
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);
{ 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);
{ 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);
{ 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);
{ 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");}
#line 46 "code100.pgc"
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 49 "code100.pgc"
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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: create table test ( "index" numeric ( 3 ) primary key , "payload" int4 not null ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 22 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 0 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 1 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 2 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 3 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 4 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 5 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 6 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 7 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 8 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test ( payload , index ) values( 0 , 9 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 31 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34: QUERY: update test set payload = payload + 1 where index = - 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34 Ok: UPDATE 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 34, 'No data found in line 34.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 38: QUERY: delete from test where index = - 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38 Ok: DELETE 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 38, 'No data found in line 38.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 41: QUERY: insert into test ( select * from test where index = - 1 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 41 Ok: INSERT 0 0
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 in line 41, 'No data found in line 41.'.
[NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGexecute line 44: QUERY: drop table test on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 44 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 46 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
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "copystdout.pgc"
#include <stdio.h>
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 3 "copystdout.pgc"
#line 1 "./../regression.h"
#line 4 "copystdout.pgc"
/* exec sql whenever sqlerror sqlprint ; */
#line 6 "copystdout.pgc"
int
main ()
{
/*
EXEC SQL BEGIN DECLARE SECTION;
char *fname = "/tmp/foo";
EXEC SQL END DECLARE SECTION;
*/
ECPGdebug (1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 19 "copystdout.pgc"
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);
#line 20 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 20 "copystdout.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values( 5 , 'abc' )", ECPGt_EOIT, ECPGt_EORT);
#line 21 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "copystdout.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values( 6 , 'def' )", ECPGt_EOIT, ECPGt_EORT);
#line 22 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "copystdout.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into foo values( 7 , 'ghi' )", ECPGt_EOIT, ECPGt_EORT);
#line 23 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "copystdout.pgc"
/* produces expected file "/tmp/foo" */
/* 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);
#line 29 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "copystdout.pgc"
printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 32 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "copystdout.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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: create table foo ( a int , b varchar ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21: QUERY: insert into foo values( 5 , 'abc' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22: QUERY: insert into foo values( 6 , 'def' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23: QUERY: insert into foo values( 7 , 'ghi' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29: QUERY: copy foo to stdout with delimiter ',' on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29: Got PGRES_COPY_OUT
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29: Got PGRES_COMMAND_OK after PGRES_COPY_OUT
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
5,abc
6,def
7,ghi
copy to STDOUT : sqlca.sqlcode = 0
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "define.pgc"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 1 "define.pgc"
#line 1 "./../regression.h"
#line 2 "define.pgc"
int main(void)
{
/* exec sql begin declare section */
#line 10 "define.pgc"
int i ;
#line 11 "define.pgc"
char s [ 200 ] ;
/* exec sql end declare section */
#line 12 "define.pgc"
ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 16 "define.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 17 "define.pgc"
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);
#line 19 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 19 "define.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 29 , 'abcdef' )", ECPGt_EOIT, ECPGt_EORT);
#line 20 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 20 "define.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( null , 'defined' )", ECPGt_EOIT, ECPGt_EORT);
#line 23 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 23 "define.pgc"
{ 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 ( );}
#line 31 "define.pgc"
{ 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 ( );}
#line 36 "define.pgc"
printf("i: %d, s: %s\n", i, s);
{ 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 ( );}
#line 42 "define.pgc"
/* no value */
{ ECPGdo(__LINE__, 0, 1, NULL, "set TIMEZONE to 'UTC'", ECPGt_EOIT, ECPGt_EORT);
#line 53 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 53 "define.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 56 "define.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 56 "define.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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 19: QUERY: create table test ( a int , b text ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20: QUERY: insert into test values( 29 , 'abcdef' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23: QUERY: insert into test values( null , 'defined' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31: QUERY: insert into test values( null , 'someothervar not defined' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: QUERY: select 1 , 29 :: text || '-' || 'abcdef' on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: Correctly got 1 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 36: RESULT: 1 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 36: RESULT: 29-abcdef offset: 200 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42: QUERY: insert into test values( 29 , 'no string' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53: QUERY: set TIMEZONE to 'UTC' on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 53 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "desc.pgc"
#line 1 "./../regression.h"
#line 1 "desc.pgc"
/* exec sql whenever sqlerror sqlprint ; */
#line 2 "desc.pgc"
int
main(void)
{
/* exec sql begin declare section */
#line 8 "desc.pgc"
char * stmt1 = "INSERT INTO test1 VALUES (?, ?)" ;
#line 9 "desc.pgc"
char * stmt2 = "SELECT * from test1 where a = ? and b = ?" ;
#line 10 "desc.pgc"
char * stmt3 = "SELECT * from test1 where a = ?" ;
#line 12 "desc.pgc"
int val1 = 1 ;
#line 13 "desc.pgc"
char val2 [] = "one" , val2output [] = "AAA" ;
#line 14 "desc.pgc"
int val1output = 2 , val2i = 0 ;
#line 15 "desc.pgc"
int val2null = - 1 ;
/* exec sql end declare section */
#line 16 "desc.pgc"
ECPGdebug(1, stderr);
ECPGallocate_desc(__LINE__, "indesc");
#line 20 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 20 "desc.pgc"
ECPGallocate_desc(__LINE__, "outdesc");
#line 21 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 21 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 23 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 24 "desc.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 26 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 26 "desc.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test1 ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 28 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 28 "desc.pgc"
{ ECPGprepare(__LINE__, "foo1" , stmt1);
#line 29 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "desc.pgc"
{ ECPGprepare(__LINE__, "foo2" , stmt2);
#line 30 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 30 "desc.pgc"
{ ECPGprepare(__LINE__, "foo3" , stmt3);
#line 31 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 31 "desc.pgc"
{ 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 33 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 33 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
#line 35 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 35 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "desc.pgc"
{ 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 38 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 38 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 40 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "desc.pgc"
{ 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,
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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 43 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 45 "desc.pgc"
printf("output = %s\n", val2output);
/* declare c1 cursor for ? */
#line 48 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 49 "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_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 51 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 51 "desc.pgc"
printf("val1=%d val2=%s\n", val1output, val2output);
{ ECPGdo(__LINE__, 0, 1, NULL, "close c1", ECPGt_EOIT, ECPGt_EORT);
#line 54 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 54 "desc.pgc"
{ ECPGset_desc_header(__LINE__, "indesc", (int)(1));
#line 56 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 56 "desc.pgc"
{ ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
#line 57 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 57 "desc.pgc"
/* declare c2 cursor for ? */
#line 59 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 60 "desc.pgc"
{ 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)-1,(long)1,(-1)*sizeof(char),
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
#line 62 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 62 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 65 "desc.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test1 where a = 2 ", ECPGt_EOIT,
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 67 "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"
if (sqlca.sqlcode < 0) sqlprint();}
#line 70 "desc.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 71 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 71 "desc.pgc"
ECPGdeallocate_desc(__LINE__, "indesc");
#line 73 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 73 "desc.pgc"
ECPGdeallocate_desc(__LINE__, "outdesc");
#line 74 "desc.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 74 "desc.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGprepare line 29: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGprepare line 31: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 33 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 43: 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]: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 49 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 51: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 51: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 54 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 60 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 62: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 62: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 65 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 67: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 67: 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 70 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
output = 1
val1=1 val2='one'
val1=2 val2=null
val1=2 val2=null
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "dynalloc.pgc"
#include <stdio.h>
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 2 "dynalloc.pgc"
#include <stdlib.h>
#line 1 "./../regression.h"
#line 4 "dynalloc.pgc"
int main(void)
{
/* exec sql begin declare section */
#line 9 "dynalloc.pgc"
char ** cpp = 0 ;
#line 10 "dynalloc.pgc"
int * ipointer = 0 ;
/* exec sql end declare section */
#line 11 "dynalloc.pgc"
int i;
ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 16 "dynalloc.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 17 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 17 "dynalloc.pgc"
ECPGallocate_desc(__LINE__, "mydesc");
#line 19 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );
#line 19 "dynalloc.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select tablename from pg_tables ", ECPGt_EOIT,
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 20 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 20 "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);
#line 21 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 21 "dynalloc.pgc"
printf("Result ");
for (i=0;i<sqlca.sqlerrd[2];++i)
{
if (ipointer[i]) printf("NULL, ");
else printf("'%s', ",cpp[i]);
}
ECPGfree_auto_mem();
printf("\n");
ECPGdeallocate_desc(__LINE__, "mydesc");
#line 32 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );
#line 32 "dynalloc.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 33 "dynalloc.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 33 "dynalloc.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 20: Correctly got 40 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute putting result (40 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: sql_sizing offset: 0 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_authid offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: sql_features offset: 0 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: sql_languages 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_statistic offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_type 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_proc offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_class 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_attrdef offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_constraint 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_index offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_operator 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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_am offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: pg_amop 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]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
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',
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "dynalloc2.pgc"
#include <stdio.h>
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 2 "dynalloc2.pgc"
#include <stdlib.h>
#line 1 "./../regression.h"
#line 4 "dynalloc2.pgc"
int main(void)
{
/* exec sql begin declare section */
#line 9 "dynalloc2.pgc"
int * ip1 = 0 ;
#line 10 "dynalloc2.pgc"
char ** cp2 = 0 ;
#line 11 "dynalloc2.pgc"
int * ipointer1 = 0 ;
#line 12 "dynalloc2.pgc"
int * ipointer2 = 0 ;
#line 13 "dynalloc2.pgc"
int colnum ;
/* exec sql end declare section */
#line 14 "dynalloc2.pgc"
int i;
ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do sqlprint ( ) ; */
#line 19 "dynalloc2.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 20 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 20 "dynalloc2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "create table test ( a int , b text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 22 "dynalloc2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 1 , 'one' )", ECPGt_EOIT, ECPGt_EORT);
#line 23 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 23 "dynalloc2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 2 , 'two' )", ECPGt_EOIT, ECPGt_EORT);
#line 24 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 24 "dynalloc2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( null , 'three' )", ECPGt_EOIT, ECPGt_EORT);
#line 25 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 25 "dynalloc2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 4 , 'four' )", ECPGt_EOIT, ECPGt_EORT);
#line 26 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 26 "dynalloc2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( 5 , null )", ECPGt_EOIT, ECPGt_EORT);
#line 27 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 27 "dynalloc2.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into test values( null , null )", ECPGt_EOIT, ECPGt_EORT);
#line 28 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 28 "dynalloc2.pgc"
ECPGallocate_desc(__LINE__, "mydesc");
#line 30 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );
#line 30 "dynalloc2.pgc"
{ 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 31 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 31 "dynalloc2.pgc"
{ ECPGget_desc_header(__LINE__, "mydesc", &(colnum));
#line 32 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 32 "dynalloc2.pgc"
{ 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 33 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 33 "dynalloc2.pgc"
{ 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 34 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 34 "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 (ipointer2[i]) printf("NULL, ");
else printf("'%s', ",cp2[i]);
printf("\n");
}
ECPGfree_auto_mem();
printf("\n");
ECPGdeallocate_desc(__LINE__, "mydesc");
#line 49 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );
#line 49 "dynalloc2.pgc"
{ ECPGtrans(__LINE__, NULL, "rollback");
#line 50 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 50 "dynalloc2.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 51 "dynalloc2.pgc"
if (sqlca.sqlcode < 0) sqlprint ( );}
#line 51 "dynalloc2.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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 22: QUERY: create table test ( a int , b text ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 22 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23: QUERY: insert into test values( 1 , 'one' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24: QUERY: insert into test values( 2 , 'two' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25: QUERY: insert into test values( null , 'three' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: insert into test values( 4 , 'four' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27: QUERY: insert into test values( 5 , null ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 27 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28: QUERY: insert into test values( null , null ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31: QUERY: select * from test on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 31: Correctly got 6 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute putting result (6 tuples) into descriptor 'mydesc'
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_desc_header: found 2 attributes.
[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 33: RESULT: 1 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 33: RESULT: 2 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 33: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 33: RESULT: 4 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 33: RESULT: 5 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 33: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_desc: reading items for tuple 2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGstore_result: line 34: allocating 49 bytes for 6 tuples (char**=0)[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: one offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: two offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: three offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: four offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: offset: 0 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 50 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
Result (2 columns):
1, 'one',
2, 'two',
NULL, 'three',
4, 'four',
5, NULL,
NULL, NULL,
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "dyntest.pgc"
/* dynamic SQL test program
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#line 1 "./../../include/sql3types.h"
#ifndef _ECPG_SQL3TYPES_H
#define _ECPG_SQL3TYPES_H
/* SQL3 dynamic type codes */
/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */
enum
{
SQL3_CHARACTER = 1,
SQL3_NUMERIC,
SQL3_DECIMAL,
SQL3_INTEGER,
SQL3_SMALLINT,
SQL3_FLOAT,
SQL3_REAL,
SQL3_DOUBLE_PRECISION,
SQL3_DATE_TIME_TIMESTAMP,
SQL3_INTERVAL, /* 10 */
SQL3_CHARACTER_VARYING = 12,
SQL3_ENUMERATED,
SQL3_BIT,
SQL3_BIT_VARYING,
SQL3_BOOLEAN,
SQL3_abstract
/* the rest is xLOB stuff */
};
/* chapter 13.1 table 3: Codes associated with datetime data types in Dynamic SQL */
enum
{
SQL3_DDT_DATE = 1,
SQL3_DDT_TIME,
SQL3_DDT_TIMESTAMP,
SQL3_DDT_TIME_WITH_TIME_ZONE,
SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE,
SQL3_DDT_ILLEGAL /* not a datetime data type (not part of
* standard) */
};
#endif /* !_ECPG_SQL3TYPES_H */
#line 8 "dyntest.pgc"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 9 "dyntest.pgc"
#line 1 "./../regression.h"
#line 10 "dyntest.pgc"
static void error(void)
{ printf("#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exit(1);
}
int main(int argc,char **argv)
{ /* exec sql begin declare section */
#line 19 "dyntest.pgc"
int COUNT ;
#line 20 "dyntest.pgc"
int INTVAR ;
#line 21 "dyntest.pgc"
int INDEX ;
#line 22 "dyntest.pgc"
int INDICATOR ;
#line 23 "dyntest.pgc"
bool BOOLVAR ;
#line 24 "dyntest.pgc"
int TYPE , LENGTH , OCTET_LENGTH , PRECISION , SCALE , NULLABLE , RETURNED_OCTET_LENGTH ;
#line 25 "dyntest.pgc"
int DATETIME_INTERVAL_CODE ;
#line 26 "dyntest.pgc"
char NAME [ 120 ] ;
#line 27 "dyntest.pgc"
char STRINGVAR [ 1024 ] ;
#line 28 "dyntest.pgc"
float FLOATVAR ;
#line 29 "dyntest.pgc"
double DOUBLEVAR ;
#line 30 "dyntest.pgc"
char * QUERY ;
/* exec sql end declare section */
#line 31 "dyntest.pgc"
int done=0;
ECPGdebug(1, stderr);
QUERY="select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite";
/* exec sql whenever sqlerror do error ( ) ; */
#line 38 "dyntest.pgc"
ECPGallocate_desc(__LINE__, "MYDESC");
#line 40 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );
#line 40 "dyntest.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 42 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 42 "dyntest.pgc"
{ ECPGprepare(__LINE__, "MYQUERY" , QUERY);
#line 44 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 44 "dyntest.pgc"
/* declare MYCURS cursor for ? */
#line 45 "dyntest.pgc"
{ 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 47 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 47 "dyntest.pgc"
while (1)
{
{ 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 51 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 51 "dyntest.pgc"
if (sqlca.sqlcode) break;
{ ECPGget_desc_header(__LINE__, "MYDESC", &(COUNT));
#line 55 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 55 "dyntest.pgc"
if (!done)
{
printf("%d Columns\n",COUNT);
for (INDEX=1;INDEX<=COUNT;++INDEX)
{
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_ret_octet,
ECPGt_int,&(RETURNED_OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_name,
ECPGt_char,(NAME),(long)120,(long)1,(120)*sizeof(char), ECPGd_nullable,
ECPGt_int,&(NULLABLE),(long)1,(long)1,sizeof(int), ECPGd_scale,
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_precision,
ECPGt_int,&(PRECISION),(long)1,(long)1,sizeof(int), ECPGd_octet,
ECPGt_int,&(OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_length,
ECPGt_int,&(LENGTH),(long)1,(long)1,sizeof(int), ECPGd_type,
ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 66 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 66 "dyntest.pgc"
printf("%s ",NAME);
switch (TYPE)
{ case SQL3_BOOLEAN:
printf("bool ");
break;
case SQL3_NUMERIC:
printf("numeric(%d,%d) ",PRECISION,SCALE);
break;
case SQL3_DECIMAL:
printf("decimal(%d,%d) ",PRECISION,SCALE);
break;
case SQL3_INTEGER:
printf("integer ");
break;
case SQL3_SMALLINT:
printf("smallint ");
break;
case SQL3_FLOAT:
printf("float(%d,%d) ",PRECISION,SCALE);
break;
case SQL3_REAL:
printf("real ");
break;
case SQL3_DOUBLE_PRECISION:
printf("double precision ");
break;
case SQL3_DATE_TIME_TIMESTAMP:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_di_code,
ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 95 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 95 "dyntest.pgc"
switch(DATETIME_INTERVAL_CODE)
{ case SQL3_DDT_DATE:
printf("date "); break;
case SQL3_DDT_TIME:
printf("time "); break;
case SQL3_DDT_TIMESTAMP:
printf("timestamp "); break;
case SQL3_DDT_TIME_WITH_TIME_ZONE:
printf("time with time zone "); break;
case SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE:
printf("timestamp with time zone "); break;
}
break;
case SQL3_INTERVAL:
printf("interval ");
break;
case SQL3_CHARACTER:
if (LENGTH>0) printf("char(%d) ",LENGTH);
else printf("char(?) ");
break;
case SQL3_CHARACTER_VARYING:
if (LENGTH>0) printf("varchar(%d) ",LENGTH);
else printf("varchar() ");
break;
default:
if (TYPE<0) printf("<OID %d> ",-TYPE);
else printf("<SQL3 %d> ",TYPE);
break;
}
/* nullable is not yet implemented in ecpg */
if (!NULLABLE) printf("not null ");
if (OCTET_LENGTH>0) printf("[%d bytes]",OCTET_LENGTH);
putchar('\n');
}
putchar('\n');
done=1;
}
for (INDEX=1;INDEX<=COUNT;++INDEX)
{
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_indicator,
ECPGt_int,&(INDICATOR),(long)1,(long)1,sizeof(int), ECPGd_precision,
ECPGt_int,&(PRECISION),(long)1,(long)1,sizeof(int), ECPGd_scale,
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_type,
ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 138 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 138 "dyntest.pgc"
if (INDICATOR==-1) printf("NULL");
else switch (TYPE)
{ case SQL3_BOOLEAN:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);
#line 142 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 142 "dyntest.pgc"
printf(BOOLVAR?"true":"false");
break;
case SQL3_NUMERIC:
case SQL3_DECIMAL:
if (SCALE==0) /* we might even print leading zeros "%0*d" */
{ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 148 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 148 "dyntest.pgc"
printf("%*d",PRECISION,INTVAR);
}
else
{ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
#line 152 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 152 "dyntest.pgc"
printf("%*.*f",PRECISION+1,SCALE,FLOATVAR);
}
break;
case SQL3_INTEGER:
case SQL3_SMALLINT:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 158 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 158 "dyntest.pgc"
printf("%d",INTVAR);
break;
case SQL3_FLOAT:
case SQL3_REAL:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
#line 163 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 163 "dyntest.pgc"
printf("%f",FLOATVAR);
break;
case SQL3_DOUBLE_PRECISION:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);
#line 167 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 167 "dyntest.pgc"
printf("%f",DOUBLEVAR);
break;
case SQL3_DATE_TIME_TIMESTAMP:
case SQL3_INTERVAL:
case SQL3_CHARACTER:
case SQL3_CHARACTER_VARYING:
default:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
#line 175 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 175 "dyntest.pgc"
printf("'%s'",STRINGVAR);
break;
}
putchar('|');
}
putchar('\n');
}
{ ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
#line 184 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 184 "dyntest.pgc"
ECPGdeallocate_desc(__LINE__, "MYDESC");
#line 185 "dyntest.pgc"
if (sqlca.sqlcode < 0) error ( );
#line 185 "dyntest.pgc"
/* no exec sql disconnect; */
return 0;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
6 Columns
rulename <OID 19> [64 bytes]
ev_class <OID 26> [4 bytes]
ev_attr smallint [2 bytes]
ev_type <OID 18> [1 bytes]
is_instead bool [1 bytes]
ev_qual char(?)
'_RETURN'|'10297'|-1|'1'|true|'<>'|
'_RETURN'|'10300'|-1|'1'|true|'<>'|
'_RETURN'|'10303'|-1|'1'|true|'<>'|
'_RETURN'|'10306'|-1|'1'|true|'<>'|
'_RETURN'|'10309'|-1|'1'|true|'<>'|
'_RETURN'|'10313'|-1|'1'|true|'<>'|
'_RETURN'|'10316'|-1|'1'|true|'<>'|
'_RETURN'|'10320'|-1|'1'|true|'<>'|
'_RETURN'|'10324'|-1|'1'|true|'<>'|
'_RETURN'|'10328'|-1|'1'|true|'<>'|
'_RETURN'|'10331'|-1|'1'|true|'<>'|
'_RETURN'|'10334'|-1|'1'|true|'<>'|
'_RETURN'|'10337'|-1|'1'|true|'<>'|
'_RETURN'|'10340'|-1|'1'|true|'<>'|
'pg_settings_u'|'10340'|-1|'2'|false|'{OPEXPR :opno 98 :opfuncid 0 :opresulttype 16 :opretset false :args ({VAR :varno 2 :varattno 1 :vartype 25 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 1} {VAR :varno 1 :varattno 1 :vartype 25 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1})}'|
'pg_settings_n'|'10340'|-1|'2'|true|'<>'|
'_RETURN'|'10345'|-1|'1'|true|'<>'|
'_RETURN'|'10348'|-1|'1'|true|'<>'|
'_RETURN'|'10352'|-1|'1'|true|'<>'|
'_RETURN'|'10355'|-1|'1'|true|'<>'|
'_RETURN'|'10358'|-1|'1'|true|'<>'|
'_RETURN'|'10362'|-1|'1'|true|'<>'|
'_RETURN'|'10365'|-1|'1'|true|'<>'|
'_RETURN'|'10368'|-1|'1'|true|'<>'|
'_RETURN'|'10372'|-1|'1'|true|'<>'|
'_RETURN'|'10375'|-1|'1'|true|'<>'|
'_RETURN'|'10378'|-1|'1'|true|'<>'|
'_RETURN'|'10382'|-1|'1'|true|'<>'|
'_RETURN'|'10385'|-1|'1'|true|'<>'|
'_RETURN'|'10388'|-1|'1'|true|'<>'|
'_RETURN'|'10391'|-1|'1'|true|'<>'|
'_RETURN'|'10394'|-1|'1'|true|'<>'|
'_RETURN'|'10397'|-1|'1'|true|'<>'|
'_RETURN'|'10400'|-1|'1'|true|'<>'|
'_RETURN'|'10634'|-1|'1'|true|'<>'|
'_RETURN'|'10638'|-1|'1'|true|'<>'|
'_RETURN'|'10641'|-1|'1'|true|'<>'|
'_RETURN'|'10644'|-1|'1'|true|'<>'|
'_RETURN'|'10648'|-1|'1'|true|'<>'|
'_RETURN'|'10651'|-1|'1'|true|'<>'|
'_RETURN'|'10655'|-1|'1'|true|'<>'|
'_RETURN'|'10659'|-1|'1'|true|'<>'|
'_RETURN'|'10663'|-1|'1'|true|'<>'|
'_RETURN'|'10667'|-1|'1'|true|'<>'|
'_RETURN'|'10671'|-1|'1'|true|'<>'|
'_RETURN'|'10675'|-1|'1'|true|'<>'|
'_RETURN'|'10678'|-1|'1'|true|'<>'|
'_RETURN'|'10681'|-1|'1'|true|'<>'|
'_RETURN'|'10684'|-1|'1'|true|'<>'|
'_RETURN'|'10688'|-1|'1'|true|'<>'|
'_RETURN'|'10691'|-1|'1'|true|'<>'|
'_RETURN'|'10695'|-1|'1'|true|'<>'|
'_RETURN'|'10699'|-1|'1'|true|'<>'|
'_RETURN'|'10703'|-1|'1'|true|'<>'|
'_RETURN'|'10707'|-1|'1'|true|'<>'|
'_RETURN'|'10711'|-1|'1'|true|'<>'|
'_RETURN'|'10715'|-1|'1'|true|'<>'|
'_RETURN'|'10718'|-1|'1'|true|'<>'|
'_RETURN'|'10722'|-1|'1'|true|'<>'|
'_RETURN'|'10726'|-1|'1'|true|'<>'|
'_RETURN'|'10729'|-1|'1'|true|'<>'|
'_RETURN'|'10767'|-1|'1'|true|'<>'|
'_RETURN'|'10771'|-1|'1'|true|'<>'|
'_RETURN'|'10775'|-1|'1'|true|'<>'|
'_RETURN'|'10779'|-1|'1'|true|'<>'|
'_RETURN'|'10782'|-1|'1'|true|'<>'|
'_RETURN'|'10786'|-1|'1'|true|'<>'|
'_RETURN'|'10789'|-1|'1'|true|'<>'|
'_RETURN'|'10793'|-1|'1'|true|'<>'|
'_RETURN'|'10797'|-1|'1'|true|'<>'|
'_RETURN'|'10801'|-1|'1'|true|'<>'|
'_RETURN'|'10805'|-1|'1'|true|'<>'|
'_RETURN'|'10809'|-1|'1'|true|'<>'|
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "dyntest2.pgc"
/* dynamic SQL test program
*/
#include <stdio.h>
#include <stdlib.h>
#line 1 "./../../include/sql3types.h"
#ifndef _ECPG_SQL3TYPES_H
#define _ECPG_SQL3TYPES_H
/* SQL3 dynamic type codes */
/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */
enum
{
SQL3_CHARACTER = 1,
SQL3_NUMERIC,
SQL3_DECIMAL,
SQL3_INTEGER,
SQL3_SMALLINT,
SQL3_FLOAT,
SQL3_REAL,
SQL3_DOUBLE_PRECISION,
SQL3_DATE_TIME_TIMESTAMP,
SQL3_INTERVAL, /* 10 */
SQL3_CHARACTER_VARYING = 12,
SQL3_ENUMERATED,
SQL3_BIT,
SQL3_BIT_VARYING,
SQL3_BOOLEAN,
SQL3_abstract
/* the rest is xLOB stuff */
};
/* chapter 13.1 table 3: Codes associated with datetime data types in Dynamic SQL */
enum
{
SQL3_DDT_DATE = 1,
SQL3_DDT_TIME,
SQL3_DDT_TIMESTAMP,
SQL3_DDT_TIME_WITH_TIME_ZONE,
SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE,
SQL3_DDT_ILLEGAL /* not a datetime data type (not part of
* standard) */
};
#endif /* !_ECPG_SQL3TYPES_H */
#line 7 "dyntest2.pgc"
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 8 "dyntest2.pgc"
#line 1 "./../regression.h"
#line 9 "dyntest2.pgc"
static void error(void)
{
printf("\n#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exit(1);
}
int main(int argc,char **argv)
{
/* exec sql begin declare section */
#line 20 "dyntest2.pgc"
int COUNT ;
#line 21 "dyntest2.pgc"
int INTVAR , BOOLVAR ;
#line 22 "dyntest2.pgc"
int INDEX ;
#line 23 "dyntest2.pgc"
int INDICATOR ;
#line 24 "dyntest2.pgc"
int TYPE , LENGTH , OCTET_LENGTH , PRECISION , SCALE , NULLABLE , RETURNED_OCTET_LENGTH ;
#line 25 "dyntest2.pgc"
int DATETIME_INTERVAL_CODE ;
#line 26 "dyntest2.pgc"
char NAME [ 120 ] ;
#line 27 "dyntest2.pgc"
char STRINGVAR [ 1024 ] ;
#line 28 "dyntest2.pgc"
float FLOATVAR ;
#line 29 "dyntest2.pgc"
double DOUBLEVAR ;
#line 30 "dyntest2.pgc"
char * QUERY ;
/* exec sql end declare section */
#line 31 "dyntest2.pgc"
int done=0;
/* exec sql var BOOLVAR is bool */
#line 34 "dyntest2.pgc"
ECPGdebug(1, stderr);
QUERY="select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite";
/* exec sql whenever sqlerror do error ( ) ; */
#line 40 "dyntest2.pgc"
ECPGallocate_desc(__LINE__, "MYDESC");
#line 42 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );
#line 42 "dyntest2.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
#line 44 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 44 "dyntest2.pgc"
{ ECPGprepare(__LINE__, "MYQUERY" , QUERY);
#line 46 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 46 "dyntest2.pgc"
/* declare MYCURS cursor for ? */
#line 47 "dyntest2.pgc"
{ 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 49 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 49 "dyntest2.pgc"
while (1)
{
{ 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 53 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 53 "dyntest2.pgc"
if (sqlca.sqlcode) break;
{ ECPGget_desc_header(__LINE__, "MYDESC", &(COUNT));
#line 57 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 57 "dyntest2.pgc"
if (!done)
{
printf("Count %d\n",COUNT);
done=1;
}
for (INDEX=1;INDEX<=COUNT;++INDEX)
{
{ 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_nullable,
ECPGt_int,&(NULLABLE),(long)1,(long)1,sizeof(int), ECPGd_scale,
ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_precision,
ECPGt_int,&(PRECISION),(long)1,(long)1,sizeof(int), ECPGd_ret_octet,
ECPGt_int,&(RETURNED_OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_octet,
ECPGt_int,&(OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_length,
ECPGt_int,&(LENGTH),(long)1,(long)1,sizeof(int), ECPGd_type,
ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 72 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 72 "dyntest2.pgc"
printf("%2d\t%s (type: %d length: %d precision: %d scale: %d\n"
"\toctet_length: %d returned_octet_length: %d nullable: %d)\n\t= "
,INDEX,NAME,TYPE,LENGTH,PRECISION,SCALE
,OCTET_LENGTH,RETURNED_OCTET_LENGTH,NULLABLE);
if (INDICATOR==-1) printf("NULL\n");
else switch (TYPE)
{
case SQL3_BOOLEAN:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);
#line 81 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 81 "dyntest2.pgc"
printf("%s\n",BOOLVAR ? "true":"false");
break;
case SQL3_NUMERIC:
case SQL3_DECIMAL:
if (SCALE==0)
{
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 88 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 88 "dyntest2.pgc"
printf("%d\n",INTVAR);
}
else
{
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
#line 93 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 93 "dyntest2.pgc"
printf("%.*f\n",SCALE,FLOATVAR);
}
break;
case SQL3_INTEGER:
case SQL3_SMALLINT:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
#line 99 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 99 "dyntest2.pgc"
printf("%d\n",INTVAR);
break;
case SQL3_FLOAT:
case SQL3_REAL:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
#line 104 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 104 "dyntest2.pgc"
printf("%.*f\n",PRECISION,FLOATVAR);
break;
case SQL3_DOUBLE_PRECISION:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);
#line 108 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 108 "dyntest2.pgc"
printf("%.*f\n",PRECISION,DOUBLEVAR);
break;
case SQL3_DATE_TIME_TIMESTAMP:
{ 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 114 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 114 "dyntest2.pgc"
printf("%d \"%s\"\n",DATETIME_INTERVAL_CODE,STRINGVAR);
break;
case SQL3_INTERVAL:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
#line 118 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 118 "dyntest2.pgc"
printf("\"%s\"\n",STRINGVAR);
break;
case SQL3_CHARACTER:
case SQL3_CHARACTER_VARYING:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
#line 123 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 123 "dyntest2.pgc"
printf("\"%s\"\n",STRINGVAR);
break;
default:
{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
#line 127 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 127 "dyntest2.pgc"
printf("<\"%s\">\n",STRINGVAR);
break;
}
}
}
{ ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
#line 134 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );}
#line 134 "dyntest2.pgc"
ECPGdeallocate_desc(__LINE__, "MYDESC");
#line 136 "dyntest2.pgc"
if (sqlca.sqlcode < 0) error ( );
#line 136 "dyntest2.pgc"
return 0;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
Count 6
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10297">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10300">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10303">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10306">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10309">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10313">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10316">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10320">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10324">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10328">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10331">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10334">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10337">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10340">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 13 nullable: 1)
= <"pg_settings_u">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10340">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"2">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 256 nullable: 1)
= "{OPEXPR :opno 98 :opfuncid 0 :opresulttype 16 :opretset false :args ({VAR :varno 2 :varattno 1 :vartype 25 :vartypmod -1 :varlevelsup 0 :varnoold 2 :varoattno 1} {VAR :varno 1 :varattno 1 :vartype 25 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1})}"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 13 nullable: 1)
= <"pg_settings_n">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10340">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"2">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10345">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10348">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10352">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10355">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10358">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10362">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10365">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10368">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10372">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10375">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10378">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10382">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10385">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10388">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10391">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10394">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10397">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10400">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10634">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10638">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10641">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10644">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10648">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10651">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10655">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10659">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10663">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10667">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10671">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10675">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10678">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10681">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10684">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10688">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10691">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10695">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10699">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10703">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10707">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10711">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10715">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10718">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10722">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10726">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10729">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10767">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10771">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10775">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10779">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10782">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10786">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10789">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10793">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10797">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10801">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10805">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
1 rulename (type: -19 length: -5 precision: -1 scale: 65531
octet_length: 64 returned_octet_length: 7 nullable: 1)
= <"_RETURN">
2 ev_class (type: -26 length: -5 precision: -1 scale: 65531
octet_length: 4 returned_octet_length: 5 nullable: 1)
= <"10809">
3 ev_attr (type: 5 length: -5 precision: -1 scale: 65531
octet_length: 2 returned_octet_length: 2 nullable: 1)
= -1
4 ev_type (type: -18 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= <"1">
5 is_instead (type: 16 length: -5 precision: -1 scale: 65531
octet_length: 1 returned_octet_length: 1 nullable: 1)
= true
6 ev_qual (type: 1 length: -5 precision: -1 scale: 65531
octet_length: -1 returned_octet_length: 2 nullable: 1)
= "<>"
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "func.pgc"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#line 1 "./../regression.h"
#line 5 "func.pgc"
int main(int argc, char* argv[]) {
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 10 "func.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);}
#line 12 "func.pgc"
/* exec sql whenever sql_warning sqlprint ; */
#line 13 "func.pgc"
/* exec sql whenever sqlerror sqlprint ; */
#line 14 "func.pgc"
{ 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();
#line 16 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 16 "func.pgc"
{ 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();
#line 24 "func.pgc"
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);
#line 30 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 30 "func.pgc"
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);
#line 32 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "func.pgc"
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);
#line 33 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 33 "func.pgc"
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);
#line 35 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 35 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 35 "func.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "drop function My_Table_Check () ", ECPGt_EOIT, ECPGt_EORT);
#line 36 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 36 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "func.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 37 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 37 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 37 "func.pgc"
{ ECPGdisconnect(__LINE__, "ALL");
#line 39 "func.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 39 "func.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 39 "func.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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 12 action = on connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 16: QUERY: create table My_Table ( Item1 int , Item2 text ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 16 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18: QUERY: 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 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18 Ok: CREATE FUNCTION
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26: QUERY: create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 26 Ok: CREATE TRIGGER
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32: QUERY: insert into My_Table values( 1234 , 'Some random text' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 0
[NO_PID]: sqlca: code: 0, state: 01000
[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 01000
sql error Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE
[NO_PID]: ECPGexecute line 33: QUERY: insert into My_Table values( 5678 , 'The Quick Brown' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 0
[NO_PID]: sqlca: code: 0, state: 01000
[NO_PID]: ECPGexecute line 33 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 01000
sql error Notice: TG_NAME=my_table_check_trigger, TG WHEN=BEFORE
[NO_PID]: ECPGexecute line 35: QUERY: drop trigger My_Table_Check_Trigger on My_Table on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35 Ok: DROP TRIGGER
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: QUERY: drop function My_Table_Check () on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36 Ok: DROP FUNCTION
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: QUERY: drop table My_Table on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "indicators.pgc"
#include <stdio.h>
#line 1 "./../../include/sqlca.h"
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
#ifndef DLLIMPORT
#if defined(WIN32) || defined(__CYGWIN__)
#define DLLIMPORT __declspec (dllimport)
#else
#define DLLIMPORT
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"
{
#endif
struct sqlca_t
{
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[SQLERRMC_LEN];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: OID of processed tuple if applicable */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or */
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/*
* 2: if 'W' a (hopefully) non-fatal notice occurred
*/ /* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlstate[5];
};
struct sqlca_t *ECPGget_sqlca(void);
#ifndef POSTGRES_ECPG_INTERNAL
#define sqlca (*ECPGget_sqlca())
#endif
#ifdef __cplusplus
}
#endif
#endif
#line 3 "indicators.pgc"
#line 1 "./../regression.h"
#line 4 "indicators.pgc"
int main(int argc, char **argv)
{
/* exec sql begin declare section */
#line 10 "indicators.pgc"
int intvar = 5 ;
#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); }
#line 16 "indicators.pgc"
{ 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);}
#line 22 "indicators.pgc"
{ 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);}
#line 25 "indicators.pgc"
/* use indicator in insert */
{ 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);}
#line 28 "indicators.pgc"
nullind = 0;
{ 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);}
#line 30 "indicators.pgc"
{ 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,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
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,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
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,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
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",
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
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,
ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
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);}
#line 46 "indicators.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 47 "indicators.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 49 "indicators.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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 17 action = off connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19: QUERY: create table test ( "id" int primary key , "str" text not null , val int null ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 23 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25: QUERY: insert into test ( id , str , val ) values( 1 , 'Hello' , 0 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28: QUERY: insert into test ( id , str , val ) values( 2 , 'Hi there' , null ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 28 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: QUERY: insert into test ( id , str , val ) values( 3 , 'Good evening' , 5 ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 31 action = commit connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34: QUERY: select val from test where id = 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 34: RESULT: 0 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35: QUERY: select val from test where id = 2 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 35: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 35: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: QUERY: select val from test where id = 3 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 37: RESULT: 5 offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42: QUERY: update test set val = null where id = 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 42 Ok: UPDATE 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 43: QUERY: select val from test where id = 1 on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 43: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 43: RESULT: offset: 4 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46: QUERY: drop table test on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 46 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 47 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
intvar: 0, nullind: -1
intvar: 5, nullind: 0
intvar: 5, nullind: -1
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "quote.pgc"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#line 1 "./../regression.h"
#line 5 "quote.pgc"
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); }
#line 13 "quote.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);}
#line 15 "quote.pgc"
/* exec sql whenever sql_warning sqlprint ; */
#line 16 "quote.pgc"
/* exec sql whenever sqlerror sqlprint ; */
#line 17 "quote.pgc"
{ 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();
#line 19 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 19 "quote.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 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 21 "quote.pgc"
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);
#line 25 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 25 "quote.pgc"
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);
#line 27 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 27 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 27 "quote.pgc"
{ 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();
#line 29 "quote.pgc"
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);
#line 32 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 32 "quote.pgc"
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);
#line 34 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 34 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 34 "quote.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 36 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 36 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "quote.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
#line 38 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 38 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 38 "quote.pgc"
{ ECPGdisconnect(__LINE__, "ALL");
#line 40 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 40 "quote.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 40 "quote.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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 15 action = on connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19: QUERY: create table My_Table ( Item1 int , Item2 text ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21: QUERY: show standard_conforming_strings on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: off offset: 25 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 25: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: nonstandard use of \\ in a string literal[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 0
[NO_PID]: sqlca: code: 0, state: 22P06
[NO_PID]: ECPGexecute line 25 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 22P06
sql error nonstandard use of \\ in a string literal
[NO_PID]: ECPGexecute line 27: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: nonstandard use of \\ in a string literal[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 0
[NO_PID]: sqlca: code: 0, state: 22P06
[NO_PID]: ECPGexecute line 27 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 22P06
sql error nonstandard use of \\ in a string literal
[NO_PID]: ECPGexecute line 29: QUERY: set standard_conforming_strings to on on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: QUERY: select * from My_Table on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: Correctly got 4 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -202 in line 36, 'Too few arguments in line 36.'.
[NO_PID]: sqlca: code: -202, state: 07002
sql error Too few arguments in line 36.
[NO_PID]: ECPGexecute line 38: QUERY: drop table My_Table on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "show.pgc"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#line 1 "./../regression.h"
#line 5 "show.pgc"
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); }
#line 13 "show.pgc"
/* exec sql whenever sql_warning sqlprint ; */
#line 15 "show.pgc"
/* exec sql whenever sqlerror sqlprint ; */
#line 16 "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"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 18 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 18 "show.pgc"
printf("Var: Search path: %s\n", var);
{ ECPGdo(__LINE__, 0, 1, NULL, "show wal_buffers", 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"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 21 "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"
printf("Var: Standard conforming strings: %s\n", var);
{ 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();
#line 27 "show.pgc"
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,
ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 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"
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 36 "show.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 36 "show.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "show.pgc"
return 0;
}
[NO_PID]: ECPGdebug: set to 1
[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]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 18: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 18: RESULT: "$user",public offset: 25 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21: QUERY: show wal_buffers on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 21: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: 8 offset: 25 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24: QUERY: show standard_conforming_strings on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 24: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 24: RESULT: off offset: 25 array: Yes
[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: 25 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: QUERY: show transaction isolation level on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 30: Correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 30: RESULT: read committed offset: 25 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection regress1 closed.
[NO_PID]: sqlca: code: 0, state: 00000
Var: Search path: "$user",public
Var: WAL buffers: 8
Var: Standard conforming strings: off
Time Zone: PST8PDT
Transaction isolation level: read committed
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "thread.pgc"
/*
* Thread test program
* by Philip Yarra & Lee Kindness.
*/
#include <stdlib.h>
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
printf("Success.\n");
return 0;
}
#else
#include <pthread.h>
#undef DEBUG
#line 1 "./../regression.h"
#line 19 "thread.pgc"
void *test_thread(void *arg);
int nthreads = 10;
int iterations = 20;
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 */
ECPGdebug(0, stderr);
/* setup test_thread table */
{ 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);}
#line 42 "thread.pgc"
/* DROP might fail */
{ 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);}
#line 48 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 49 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 50 "thread.pgc"
/* create, and start, threads */
threads = calloc(nthreads, sizeof(pthread_t));
if( threads == NULL )
{
fprintf(stderr, "Cannot alloc memory\n");
return( 1 );
}
for( n = 0; n < nthreads; n++ )
{
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
}
/* wait for thread completion */
for( n = 0; n < nthreads; n++ )
{
pthread_join(threads[n], NULL);
}
free(threads);
/* and check results */
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 72 "thread.pgc"
{ 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);}
#line 73 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 74 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 75 "thread.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 );
}
void *test_thread(void *arg)
{
long threadnum = (long)arg;
/* exec sql begin declare section */
#line 88 "thread.pgc"
int l_i ;
#line 89 "thread.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
#line 90 "thread.pgc"
/* build up connection name, and connect to database */
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
/* exec sql whenever sqlerror sqlprint ; */
#line 94 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , l_connection, 0);
#line 95 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 95 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL );
}
{ ECPGtrans(__LINE__, l_connection, "begin transaction ");
#line 101 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 101 "thread.pgc"
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
#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( ? , ? )",
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();}
#line 109 "thread.pgc"
#ifdef DEBUG
if( sqlca.sqlcode == 0 )
printf("%s: insert done\n", l_connection);
else
printf("%s: ERROR: insert failed!\n", l_connection);
#endif
}
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
#line 119 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 119 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
#line 120 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 120 "thread.pgc"
#ifdef DEBUG
printf("%s: done!\n", l_connection);
#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "thread_implicit.pgc"
/*
* Thread test program
* by Lee Kindness.
*/
#include <stdlib.h>
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
printf("Success.\n");
return 0;
}
#else
#include <pthread.h>
#undef DEBUG
#line 1 "./../regression.h"
#line 20 "thread_implicit.pgc"
void *test_thread(void *arg);
int nthreads = 10;
int iterations = 20;
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 */
ECPGdebug(0, stderr);
/* setup test_thread table */
{ 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);}
#line 43 "thread_implicit.pgc"
/* DROP might fail */
{ 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);}
#line 49 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 50 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 51 "thread_implicit.pgc"
/* create, and start, threads */
threads = calloc(nthreads, sizeof(pthread_t));
if( threads == NULL )
{
fprintf(stderr, "Cannot alloc memory\n");
return( 1 );
}
for( n = 0; n < nthreads; n++ )
{
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
}
/* wait for thread completion */
for( n = 0; n < nthreads; n++ )
{
pthread_join(threads[n], NULL);
}
free(threads);
/* and check results */
{ 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,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 74 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
#line 75 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 76 "thread_implicit.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 );
}
void *test_thread(void *arg)
{
long threadnum = (long)arg;
/* exec sql begin declare section */
#line 89 "thread_implicit.pgc"
int l_i ;
#line 90 "thread_implicit.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
#line 91 "thread_implicit.pgc"
/* build up connection name, and connect to database */
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
/* exec sql whenever sqlerror sqlprint ; */
#line 95 "thread_implicit.pgc"
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , l_connection, 0);
#line 96 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 96 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
{
printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL );
}
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
#line 102 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 102 "thread_implicit.pgc"
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
#ifdef DEBUG
printf("%s: inserting %d\n", l_connection, l_i);
#endif
{ 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();}
#line 110 "thread_implicit.pgc"
#ifdef DEBUG
if( sqlca.sqlcode == 0 )
printf("%s: insert done\n", l_connection);
else
printf("%s: ERROR: insert failed!\n", l_connection);
#endif
}
/* all done */
{ ECPGtrans(__LINE__, NULL, "commit");
#line 120 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 120 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
#line 121 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 121 "thread_implicit.pgc"
#ifdef DEBUG
printf("%s: done!\n", l_connection);
#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
exec sql include sqlca;
exec sql include ../regression;
exec sql whenever sqlerror sqlprint;
exec sql whenever not found sqlprint;
static void
print_result(long sec, long usec, char *text)
{
if (usec < 0)
{
sec--;
usec+=1000000;
}
printf("%ld seconds and %ld microseconds for test %s\n", sec, usec, text);
exec sql vacuum;
sleep(1);
}
int
main (void)
{
exec sql begin declare section;
long i;
exec sql end declare section;
struct timeval tvs, tve;
exec sql connect to REGRESSDB1;
exec sql create table perftest1(number int4, ascii char(16));
exec sql create unique index number1 on perftest1(number);
exec sql create table perftest2(number int4, next_number int4);
exec sql create unique index number2 on perftest2(number);
exec sql commit;
exec sql set autocommit to on;
exec sql begin transaction;
gettimeofday(&tvs, NULL);
for (i = 0;i < 1407; i++)
{
exec sql begin declare section;
char text[16];
exec sql end declare section;
sprintf(text, "%ld", i);
exec sql insert into perftest1(number, ascii) values (:i, :text);
exec sql insert into perftest2(number, next_number) values (:i, :i+1);
}
exec sql commit;
gettimeofday(&tve, NULL);
print_result(tve.tv_sec - tvs.tv_sec, tve.tv_usec - tvs.tv_usec, "insert");
exec sql begin transaction;
gettimeofday(&tvs, NULL);
for (i = 0;i < 1407; i++)
{
exec sql begin declare section;
char text[16];
exec sql end declare section;
exec sql select ascii into :text from perftest1 where number = :i;
}
exec sql commit;
gettimeofday(&tve, NULL);
print_result(tve.tv_sec - tvs.tv_sec, tve.tv_usec - tvs.tv_usec, "selection&projection");
exec sql begin transaction;
gettimeofday(&tvs, NULL);
for (i = 0;i < 1407; i++)
{
exec sql begin declare section;
char text[16];
exec sql end declare section;
exec sql select perftest1.ascii into :text from perftest1, perftest2 where perftest1.number = perftest2.number and perftest2.number = :i;
}
exec sql commit;
gettimeofday(&tve, NULL);
print_result(tve.tv_sec - tvs.tv_sec, tve.tv_usec - tvs.tv_usec, "join");
exec sql begin transaction;
gettimeofday(&tvs, NULL);
exec sql update perftest2 set next_number = next_number + 1;
exec sql commit;
gettimeofday(&tve, NULL);
print_result(tve.tv_sec - tvs.tv_sec, tve.tv_usec - tvs.tv_usec, "update");
exec sql begin transaction;
gettimeofday(&tvs, NULL);
exec sql delete from perftest2;
exec sql commit;
gettimeofday(&tve, NULL);
print_result(tve.tv_sec - tvs.tv_sec, tve.tv_usec - tvs.tv_usec, "delete");
exec sql set autocommit = off;
exec sql drop index number2;
exec sql drop table perftest2;
exec sql drop index number1;
exec sql drop table perftest1;
exec sql commit;
exec sql disconnect;
return (0);
}
/* $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>
#include <pgtypes_date.h>
#include <pgtypes_timestamp.h>
#include <pgtypes_interval.h>
exec sql include ../regression;
int
main(void)
{
exec sql begin declare section;
date date1;
timestamp ts1;
interval iv1;
char *text;
exec sql end declare section;
date date2;
int mdy[3] = { 4, 19, 1998 };
char *fmt, *out, *in;
char *d1 = "Mon Jan 17 1966";
char *t1 = "2000-7-12 17:34:29";
int i;
ECPGdebug(1, stderr);
exec sql whenever sqlerror do sqlprint();
exec sql connect to REGRESSDB1;
exec sql create table date_test (d date, ts timestamp, iv interval);
exec sql set datestyle to iso;
date1 = PGTYPESdate_from_asc(d1, NULL);
ts1 = PGTYPEStimestamp_from_asc(t1, NULL);
exec sql insert into date_test(d, ts, iv) values (:date1, :ts1, '2003-02-28 12:34'::timestamp-'Mon Jan 17 1966'::timestamp);
exec sql select * into :date1, :ts1 , :iv1 from date_test where d=:date1;
text = PGTYPESdate_to_asc(date1);
printf ("Date: %s\n", text);
free(text);
text = PGTYPEStimestamp_to_asc(ts1);
printf ("timestamp: %s\n", text);
free(text);
text = PGTYPESinterval_to_asc(&iv1);
printf ("interval: %s\n", text);
free(text);
PGTYPESdate_mdyjul(mdy, &date2);
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
/* reset */
mdy[0] = mdy[1] = mdy[2] = 0;
printf("date seems to get encoded to julian %ld\n", date2);
PGTYPESdate_julmdy(date2, mdy);
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(ts1));
PGTYPESdate_today(&date1);
/* can't output this in regression mode */
printf("using date %s\n", text);
free(text);
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
out = (char*) malloc(strlen(fmt) + 1);
date1 = PGTYPESdate_from_timestamp(ts1);
PGTYPESdate_fmt_asc(date1, fmt, out);
printf("Above date in format \"%s\" is \"%s\"\n", fmt, out);
free(out);
/* rdate_defmt_asc() */
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
*/
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("date_defmt_asc1: %s\n", text);
free(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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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);
/* abc-03:10:35-def-02/11/94-gh */
/* 12345678901234567890123456789 */
out = (char*) malloc(32);
i = PGTYPEStimestamp_fmt_asc(&ts1, out, 31, "abc-%X-def-%x-ghi%%");
printf("timestamp_fmt_asc: %d: %s\n", i, out);
free(out);
fmt = "This is a %m/%d/%y %H-%Ml%Stest";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%b %d %H:%M:%S %z %Y";
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);
fmt = "%b %d %H:%M:%S %z %Y";
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);
fmt = "%a %b %d %H:%M:%S %z %Y";
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);
fmt = "%";
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);
fmt = "a %";
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);
fmt = "%b, %d %H_%M`%S %z %Y";
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);
fmt = "%a %b %%%d %H:%M:%S %Z %Y";
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);
fmt = "%a %b %%%d %H:%M:%S %Z %Y";
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);
fmt = "abc%n %C %B %%%d %H:%M:%S %Z %Y";
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);
fmt = "abc%n %C %B %%%d %H:%M:%S %Z %y";
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);
fmt = "";
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);
fmt = NULL;
in = "1980-04-12 3:49:44 ";
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);
fmt = "%B %d, %Y. Time: %I:%M%p";
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);
in = "September 6 at 01:30 pm in the year 1983";
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);
in = " 1976, July 14. Time: 9:15am";
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);
in = " 1976, July 14. Time: 9:15 am";
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);
in = " 1976, P.M. July 14. Time: 9:15";
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);
exec sql rollback;
exec sql disconnect;
return (0);
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pgtypes_date.h>
#include <pgtypes_timestamp.h>
exec sql include ../regression;
int
main(void)
{
exec sql begin declare section;
date date1;
timestamp ts1;
char* text;
exec sql end declare section;
ECPGdebug(1, stderr);
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("timestamp: %s\n", text);
free(text);
date1 = PGTYPESdate_from_timestamp(ts1);
text = PGTYPESdate_to_asc(date1);
printf("Date of timestamp: %s\n", text);
free(text);
return (0);
}
/* $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>
#include <decimal.h>
exec sql include ../regression;
int
main(void)
{
char *text="error\n";
numeric *value1, *value2, *res;
exec sql begin declare section;
numeric(14,7) *des;
/* = {0, 0, 0, 0, 0, NULL, NULL} ; */
exec sql end declare section;
double d;
ECPGdebug(1, stderr);
exec sql whenever sqlerror do sqlprint();
exec sql connect to REGRESSDB1;
exec sql set autocommit = off;
exec sql create table test (text char(5), num numeric(14,7));
value1 = PGTYPESnumeric_new();
PGTYPESnumeric_from_int(1407, value1);
text = PGTYPESnumeric_to_asc(value1, -1);
printf("long = %s\n", text);
free(text);
PGTYPESnumeric_free(value1);
value1 = PGTYPESnumeric_from_asc("2369.7", NULL);
value2 = PGTYPESnumeric_from_asc("10.0", NULL);
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);
exec sql insert into test (text, num) values ('test', :des);
value2 = PGTYPESnumeric_from_asc("2369.7", NULL);
PGTYPESnumeric_mul(value1, value2, res);
PGTYPESnumeric_free(value2);
exec sql select num into :des from test where text = 'test';
PGTYPESnumeric_mul(res, des, res);
text = PGTYPESnumeric_to_asc(res, -1);
printf("mul = %s\n", text);
free(text);
PGTYPESnumeric_free(des);
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);
free(text);
PGTYPESnumeric_free(value1);
PGTYPESnumeric_free(value2);
PGTYPESnumeric_free(res);
exec sql rollback;
exec sql disconnect;
return (0);
}
exec sql include sqlca;
#include <stdio.h>
exec sql include ../regression;
int main(int argc, char **argv)
{ exec sql begin declare section;
int index;
exec sql end declare section;
ECPGdebug(1,stderr);
exec sql connect to REGRESSDB1;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql create table test (
"index" numeric(3) primary key,
"payload" int4 NOT NULL);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql commit work;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
for (index=0;index<10;++index)
{ exec sql insert into test
(payload, index)
values (0, :index);
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
}
exec sql commit work;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql update test
set payload=payload+1 where index=-1;
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql delete from test where index=-1;
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql insert into test (select * from test where index=-1);
if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql drop table test;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql commit work;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql disconnect;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
return 0;
}
#include <stdio.h>
EXEC SQL INCLUDE sqlca;
exec sql include ../regression;
EXEC SQL WHENEVER SQLERROR sqlprint;
int
main ()
{
/*
EXEC SQL BEGIN DECLARE SECTION;
char *fname = "/tmp/foo";
EXEC SQL END DECLARE SECTION;
*/
ECPGdebug (1, stderr);
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL CREATE TABLE foo (a int, b varchar);
EXEC SQL INSERT INTO foo VALUES (5, 'abc');
EXEC SQL INSERT INTO foo VALUES (6, 'def');
EXEC SQL INSERT INTO foo VALUES (7, 'ghi');
/* produces expected file "/tmp/foo" */
/* EXEC SQL COPY foo TO:fname WITH DELIMITER ','; */
/* printf ("copy to /tmp/foo : sqlca.sqlcode = %ld", sqlca.sqlcode); */
EXEC SQL COPY foo TO STDOUT WITH DELIMITER ',';
printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);
EXEC SQL DISCONNECT;
return 0;
}
exec sql include sqlca;
exec sql include ../regression;
exec sql define STR 'abcdef';
exec sql define INSERTNULL 1;
exec sql define NUMBER 29;
int main(void)
{
exec sql begin declare section;
int i;
char s[200];
exec sql end declare section;
ECPGdebug(1, stderr);
exec sql whenever sqlerror do sqlprint();
exec sql connect to REGRESSDB1;
exec sql create table test (a int, b text);
exec sql insert into test values (NUMBER, STR);
exec sql ifdef INSERTNULL;
exec sql insert into test values (NULL, 'defined');
exec sql endif;
exec sql ifndef INSERTNULL;
exec sql insert into test values (NULL, 'not defined');
exec sql elif SOMEOTHERVAR;
exec sql insert into test values (NULL, 'someothervar defined');
exec sql else;
exec sql insert into test values (NULL, 'someothervar not defined');
exec sql endif;
exec sql define NUMBER 29;
exec sql select INSERTNULL, NUMBER::text || '-' || STR INTO :i, :s;
printf("i: %d, s: %s\n", i, s);
exec sql undef STR;
exec sql ifndef STR;
exec sql insert into test values (NUMBER, 'no string');
exec sql endif;
exec sql define TZVAR; /* no value */
exec sql define TZVAR 'UTC';
exec sql ifndef TZVAR;
exec sql SET TIMEZONE TO 'GMT';
exec sql elif TZNAME;
exec sql SET TIMEZONE TO TZNAME;
exec sql else;
exec sql SET TIMEZONE TO TZVAR;
exec sql endif;
exec sql disconnect;
return 0;
}
EXEC SQL INCLUDE ../regression;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
int
main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
char *stmt1 = "INSERT INTO test1 VALUES (?, ?)";
char *stmt2 = "SELECT * from test1 where a = ? and b = ?";
char *stmt3 = "SELECT * from test1 where a = ?";
int val1 = 1;
char val2[] = "one", val2output[] = "AAA";
int val1output = 2, val2i = 0;
int val2null = -1;
EXEC SQL END DECLARE SECTION;
ECPGdebug(1, stderr);
EXEC SQL ALLOCATE DESCRIPTOR indesc;
EXEC SQL ALLOCATE DESCRIPTOR outdesc;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2i, DATA = :val2;
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL CREATE TABLE test1 (a int, b text);
EXEC SQL PREPARE foo1 FROM :stmt1;
EXEC SQL PREPARE foo2 FROM :stmt2;
EXEC SQL PREPARE foo3 FROM :stmt3;
EXEC SQL EXECUTE foo1 USING DESCRIPTOR indesc;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2null, DATA = :val2;
EXEC SQL EXECUTE foo1 USING DESCRIPTOR indesc;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2i, DATA = :val2;
EXEC SQL EXECUTE foo2 USING DESCRIPTOR indesc INTO DESCRIPTOR outdesc;
EXEC SQL GET DESCRIPTOR outdesc VALUE 1 :val2output = DATA;
printf("output = %s\n", val2output);
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 CLOSE c1;
EXEC SQL SET DESCRIPTOR indesc COUNT = 1;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
EXEC SQL DECLARE c2 CURSOR FOR foo3;
EXEC SQL OPEN c2 USING DESCRIPTOR indesc;
EXEC SQL FETCH next FROM c2 INTO :val1output, :val2output :val2i;
printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
EXEC SQL CLOSE c2;
EXEC SQL SELECT * INTO :val1output, :val2output :val2i FROM test1 where a = 2;
printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
EXEC SQL DROP TABLE test1;
EXEC SQL DISCONNECT;
EXEC SQL DEALLOCATE DESCRIPTOR indesc;
EXEC SQL DEALLOCATE DESCRIPTOR outdesc;
return 0;
}
#include <stdio.h>
exec sql include sqlca;
#include <stdlib.h>
exec sql include ../regression;
int main(void)
{
exec sql begin declare section;
char **cpp=0;
int *ipointer=0;
exec sql end declare section;
int i;
ECPGdebug(1, stderr);
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;
printf("Result ");
for (i=0;i<sqlca.sqlerrd[2];++i)
{
if (ipointer[i]) printf("NULL, ");
else printf("'%s', ",cpp[i]);
}
ECPGfree_auto_mem();
printf("\n");
exec sql deallocate descriptor mydesc;
exec sql disconnect;
return 0;
}
#include <stdio.h>
exec sql include sqlca;
#include <stdlib.h>
exec sql include ../regression;
int main(void)
{
exec sql begin declare section;
int *ip1=0;
char **cp2=0;
int *ipointer1=0;
int *ipointer2=0;
int colnum;
exec sql end declare section;
int i;
ECPGdebug(1, stderr);
exec sql whenever sqlerror do sqlprint();
exec sql connect to REGRESSDB1;
exec sql create table test (a int, b text);
exec sql insert into test values (1, 'one');
exec sql insert into test values (2, 'two');
exec sql insert into test values (NULL, 'three');
exec sql insert into test values (4, 'four');
exec sql insert into test values (5, NULL);
exec sql insert into test values (NULL, NULL);
exec sql allocate descriptor mydesc;
exec sql select * into descriptor mydesc from test;
exec sql get descriptor mydesc :colnum=COUNT;
exec sql get descriptor mydesc value 1 :ip1=DATA, :ipointer1=INDICATOR;
exec sql get descriptor mydesc value 2 :cp2=DATA, :ipointer2=INDICATOR;
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 (ipointer2[i]) printf("NULL, ");
else printf("'%s', ",cp2[i]);
printf("\n");
}
ECPGfree_auto_mem();
printf("\n");
exec sql deallocate descriptor mydesc;
exec sql rollback;
exec sql disconnect;
return 0;
}
/* dynamic SQL test program
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
exec sql include sql3types;
exec sql include sqlca;
exec sql include ../regression;
static void error(void)
{ printf("#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exit(1);
}
int main(int argc,char **argv)
{ exec sql begin declare section;
int COUNT;
int INTVAR;
int INDEX;
int INDICATOR;
bool BOOLVAR;
int TYPE,LENGTH,OCTET_LENGTH,PRECISION,SCALE,NULLABLE,RETURNED_OCTET_LENGTH;
int DATETIME_INTERVAL_CODE;
char NAME[120];
char STRINGVAR[1024];
float FLOATVAR;
double DOUBLEVAR;
char *QUERY;
exec sql end declare section;
int done=0;
ECPGdebug(1, stderr);
QUERY="select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite";
exec sql whenever sqlerror do error();
exec sql allocate descriptor MYDESC;
exec sql connect to REGRESSDB1;
exec sql prepare MYQUERY from :QUERY;
exec sql declare MYCURS cursor for MYQUERY;
exec sql open MYCURS;
while (1)
{
exec sql fetch in MYCURS into sql descriptor MYDESC;
if (sqlca.sqlcode) break;
exec sql get descriptor MYDESC :COUNT = count;
if (!done)
{
printf("%d Columns\n",COUNT);
for (INDEX=1;INDEX<=COUNT;++INDEX)
{
exec sql get descriptor MYDESC value :INDEX
:TYPE = type,
:LENGTH = length, :OCTET_LENGTH=octet_length,
:PRECISION = precision, :SCALE=scale,
:NULLABLE=nullable, :NAME=name,
:RETURNED_OCTET_LENGTH=returned_octet_length;
printf("%s ",NAME);
switch (TYPE)
{ case SQL3_BOOLEAN:
printf("bool ");
break;
case SQL3_NUMERIC:
printf("numeric(%d,%d) ",PRECISION,SCALE);
break;
case SQL3_DECIMAL:
printf("decimal(%d,%d) ",PRECISION,SCALE);
break;
case SQL3_INTEGER:
printf("integer ");
break;
case SQL3_SMALLINT:
printf("smallint ");
break;
case SQL3_FLOAT:
printf("float(%d,%d) ",PRECISION,SCALE);
break;
case SQL3_REAL:
printf("real ");
break;
case SQL3_DOUBLE_PRECISION:
printf("double precision ");
break;
case SQL3_DATE_TIME_TIMESTAMP:
exec sql get descriptor MYDESC value :INDEX
:DATETIME_INTERVAL_CODE=datetime_interval_code;
switch(DATETIME_INTERVAL_CODE)
{ case SQL3_DDT_DATE:
printf("date "); break;
case SQL3_DDT_TIME:
printf("time "); break;
case SQL3_DDT_TIMESTAMP:
printf("timestamp "); break;
case SQL3_DDT_TIME_WITH_TIME_ZONE:
printf("time with time zone "); break;
case SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE:
printf("timestamp with time zone "); break;
}
break;
case SQL3_INTERVAL:
printf("interval ");
break;
case SQL3_CHARACTER:
if (LENGTH>0) printf("char(%d) ",LENGTH);
else printf("char(?) ");
break;
case SQL3_CHARACTER_VARYING:
if (LENGTH>0) printf("varchar(%d) ",LENGTH);
else printf("varchar() ");
break;
default:
if (TYPE<0) printf("<OID %d> ",-TYPE);
else printf("<SQL3 %d> ",TYPE);
break;
}
/* nullable is not yet implemented in ecpg */
if (!NULLABLE) printf("not null ");
if (OCTET_LENGTH>0) printf("[%d bytes]",OCTET_LENGTH);
putchar('\n');
}
putchar('\n');
done=1;
}
for (INDEX=1;INDEX<=COUNT;++INDEX)
{
exec sql get descriptor MYDESC value :INDEX
:TYPE = type, :SCALE=scale, :PRECISION = precision,
:INDICATOR=indicator;
if (INDICATOR==-1) printf("NULL");
else switch (TYPE)
{ case SQL3_BOOLEAN:
exec sql get descriptor MYDESC value :INDEX :BOOLVAR=data;
printf(BOOLVAR?"true":"false");
break;
case SQL3_NUMERIC:
case SQL3_DECIMAL:
if (SCALE==0) /* we might even print leading zeros "%0*d" */
{ exec sql get descriptor MYDESC value :INDEX :INTVAR=data;
printf("%*d",PRECISION,INTVAR);
}
else
{ exec sql get descriptor MYDESC value :INDEX :FLOATVAR=data;
printf("%*.*f",PRECISION+1,SCALE,FLOATVAR);
}
break;
case SQL3_INTEGER:
case SQL3_SMALLINT:
exec sql get descriptor MYDESC value :INDEX :INTVAR=data;
printf("%d",INTVAR);
break;
case SQL3_FLOAT:
case SQL3_REAL:
exec sql get descriptor MYDESC value :INDEX :FLOATVAR=data;
printf("%f",FLOATVAR);
break;
case SQL3_DOUBLE_PRECISION:
exec sql get descriptor MYDESC value :INDEX :DOUBLEVAR=data;
printf("%f",DOUBLEVAR);
break;
case SQL3_DATE_TIME_TIMESTAMP:
case SQL3_INTERVAL:
case SQL3_CHARACTER:
case SQL3_CHARACTER_VARYING:
default:
exec sql get descriptor MYDESC value :INDEX :STRINGVAR=data;
printf("'%s'",STRINGVAR);
break;
}
putchar('|');
}
putchar('\n');
}
exec sql close MYCURS;
exec sql deallocate descriptor MYDESC;
/* no exec sql disconnect; */
return 0;
}
/* dynamic SQL test program
*/
#include <stdio.h>
#include <stdlib.h>
exec sql include sql3types;
exec sql include sqlca;
exec sql include ../regression;
static void error(void)
{
printf("\n#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exit(1);
}
int main(int argc,char **argv)
{
exec sql begin declare section;
int COUNT;
int INTVAR, BOOLVAR;
int INDEX;
int INDICATOR;
int TYPE,LENGTH,OCTET_LENGTH,PRECISION,SCALE,NULLABLE,RETURNED_OCTET_LENGTH;
int DATETIME_INTERVAL_CODE;
char NAME[120];
char STRINGVAR[1024];
float FLOATVAR;
double DOUBLEVAR;
char *QUERY;
exec sql end declare section;
int done=0;
exec sql var BOOLVAR is bool;
ECPGdebug(1, stderr);
QUERY="select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite";
exec sql whenever sqlerror do error();
exec sql allocate descriptor MYDESC;
exec sql connect to REGRESSDB1;
exec sql prepare MYQUERY from :QUERY;
exec sql declare MYCURS cursor for MYQUERY;
exec sql open MYCURS;
while (1)
{
exec sql fetch in MYCURS into sql descriptor MYDESC;
if (sqlca.sqlcode) break;
exec sql get descriptor MYDESC :COUNT = count;
if (!done)
{
printf("Count %d\n",COUNT);
done=1;
}
for (INDEX=1;INDEX<=COUNT;++INDEX)
{
exec sql get descriptor MYDESC value :INDEX
:TYPE = type,
:LENGTH = length, :OCTET_LENGTH=octet_length,
:RETURNED_OCTET_LENGTH=returned_octet_length,
:PRECISION = precision, :SCALE=scale,
:NULLABLE=nullable, :NAME=name,
:INDICATOR=indicator;
printf("%2d\t%s (type: %d length: %d precision: %d scale: %d\n"
"\toctet_length: %d returned_octet_length: %d nullable: %d)\n\t= "
,INDEX,NAME,TYPE,LENGTH,PRECISION,SCALE
,OCTET_LENGTH,RETURNED_OCTET_LENGTH,NULLABLE);
if (INDICATOR==-1) printf("NULL\n");
else switch (TYPE)
{
case SQL3_BOOLEAN:
exec sql get descriptor MYDESC value :INDEX :BOOLVAR=data;
printf("%s\n",BOOLVAR ? "true":"false");
break;
case SQL3_NUMERIC:
case SQL3_DECIMAL:
if (SCALE==0)
{
exec sql get descriptor MYDESC value :INDEX :INTVAR=data;
printf("%d\n",INTVAR);
}
else
{
exec sql get descriptor MYDESC value :INDEX :FLOATVAR=data;
printf("%.*f\n",SCALE,FLOATVAR);
}
break;
case SQL3_INTEGER:
case SQL3_SMALLINT:
exec sql get descriptor MYDESC value :INDEX :INTVAR=data;
printf("%d\n",INTVAR);
break;
case SQL3_FLOAT:
case SQL3_REAL:
exec sql get descriptor MYDESC value :INDEX :FLOATVAR=data;
printf("%.*f\n",PRECISION,FLOATVAR);
break;
case SQL3_DOUBLE_PRECISION:
exec sql get descriptor MYDESC value :INDEX :DOUBLEVAR=data;
printf("%.*f\n",PRECISION,DOUBLEVAR);
break;
case SQL3_DATE_TIME_TIMESTAMP:
exec sql get descriptor MYDESC value :INDEX
:DATETIME_INTERVAL_CODE=datetime_interval_code,
:STRINGVAR=data;
printf("%d \"%s\"\n",DATETIME_INTERVAL_CODE,STRINGVAR);
break;
case SQL3_INTERVAL:
exec sql get descriptor MYDESC value :INDEX :STRINGVAR=data;
printf("\"%s\"\n",STRINGVAR);
break;
case SQL3_CHARACTER:
case SQL3_CHARACTER_VARYING:
exec sql get descriptor MYDESC value :INDEX :STRINGVAR=data;
printf("\"%s\"\n",STRINGVAR);
break;
default:
exec sql get descriptor MYDESC value :INDEX :STRINGVAR=data;
printf("<\"%s\">\n",STRINGVAR);
break;
}
}
}
exec sql close MYCURS;
exec sql deallocate descriptor MYDESC;
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
EXEC SQL INCLUDE ../regression;
int main(int argc, char* argv[]) {
ECPGdebug(1, stderr);
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL SET AUTOCOMMIT TO ON;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL CREATE TABLE My_Table ( Item1 int, Item2 text );
EXEC SQL 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;
EXEC SQL CREATE TRIGGER My_Table_Check_Trigger
BEFORE INSERT
ON My_Table
FOR EACH ROW
EXECUTE PROCEDURE My_Table_Check();
EXEC SQL INSERT INTO My_Table VALUES (1234, 'Some random text');
EXEC SQL INSERT INTO My_Table VALUES (5678, 'The Quick Brown');
EXEC SQL DROP TRIGGER My_Table_Check_Trigger ON My_Table;
EXEC SQL DROP FUNCTION My_Table_Check();
EXEC SQL DROP TABLE My_Table;
EXEC SQL DISCONNECT ALL;
return 0;
}
#include <stdio.h>
exec sql include sqlca;
exec sql include ../regression;
int main(int argc, char **argv)
{
exec sql begin declare section;
int intvar = 5;
int nullind = -1;
exec sql end declare section;
ECPGdebug(1,stderr);
exec sql connect to REGRESSDB1;
exec sql set autocommit to off;
exec sql create table test (
"id" int primary key,
"str" text NOT NULL,
val int null);
exec sql commit work;
exec sql insert into test (id, str, val) values ( 1, 'Hello', 0);
/* use indicator in insert */
exec sql insert into test (id, str, val) values ( 2, 'Hi there', :intvar :nullind);
nullind = 0;
exec sql insert into test (id, str, val) values ( 3, 'Good evening', :intvar :nullind);
exec sql commit work;
/* use indicators to get information about selects */
exec sql select val into :intvar from test where id = 1;
exec sql select val into :intvar :nullind from test where id = 2;
printf("intvar: %d, nullind: %d\n", intvar, nullind);
exec sql select val into :intvar :nullind from test where id = 3;
printf("intvar: %d, nullind: %d\n", intvar, nullind);
/* use indicators for update */
intvar = 5; nullind = -1;
exec sql update test set val = :intvar :nullind where id = 1;
exec sql select val into :intvar :nullind from test where id = 1;
printf("intvar: %d, nullind: %d\n", intvar, nullind);
exec sql drop table test;
exec sql commit work;
exec sql disconnect;
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
EXEC SQL INCLUDE ../regression;
int main(int argc, char* argv[]) {
EXEC SQL BEGIN DECLARE SECTION;
char var[25];
EXEC SQL END DECLARE SECTION;
ECPGdebug(1, stderr);
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL SET AUTOCOMMIT TO ON;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL CREATE TABLE My_Table ( Item1 int, Item2 text );
EXEC SQL SHOW standard_conforming_strings INTO :var;
printf("Standard conforming strings: %s\n", var);
/* this is a\\b actually */
EXEC SQL INSERT INTO My_Table VALUES ( 1, 'a\\\\b' );
/* this is a\b */
EXEC SQL INSERT INTO My_Table VALUES ( 1, E'a\\\\b' );
EXEC SQL SET standard_conforming_strings TO on;
/* this is a\\b actually */
EXEC SQL INSERT INTO My_Table VALUES ( 1, 'a\\\\b' );
/* this is a\b */
EXEC SQL INSERT INTO My_Table VALUES ( 1, E'a\\\\b' );
EXEC SQL SELECT * FROM My_Table;
EXEC SQL DROP TABLE My_Table;
EXEC SQL DISCONNECT ALL;
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
EXEC SQL INCLUDE ../regression;
int main(int argc, char* argv[]) {
EXEC SQL BEGIN DECLARE SECTION;
char var[25];
EXEC SQL END DECLARE SECTION;
ECPGdebug(1, stderr);
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
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 SHOW standard_conforming_strings INTO :var;
printf("Var: Standard conforming strings: %s\n", var);
EXEC SQL SHOW TIME ZONE INTO :var;
printf("Time Zone: %s\n", var);
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;
}
/*
* Thread test program
* by Philip Yarra & Lee Kindness.
*/
#include <stdlib.h>
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
printf("Success.\n");
return 0;
}
#else
#include <pthread.h>
#undef DEBUG
exec sql include ../regression;
void *test_thread(void *arg);
int nthreads = 10;
int iterations = 20;
int main(int argc, char *argv[])
{
pthread_t *threads;
int n;
EXEC SQL BEGIN DECLARE SECTION;
int l_rows;
EXEC SQL END DECLARE SECTION;
/* Switch off debug output for regression tests. The threads get executed in
* more or less random order */
ECPGdebug(0, stderr);
/* setup test_thread table */
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL DROP TABLE test_thread; /* DROP might fail */
EXEC SQL COMMIT;
EXEC SQL 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));
EXEC SQL COMMIT;
EXEC SQL DISCONNECT;
/* create, and start, threads */
threads = calloc(nthreads, sizeof(pthread_t));
if( threads == NULL )
{
fprintf(stderr, "Cannot alloc memory\n");
return( 1 );
}
for( n = 0; n < nthreads; n++ )
{
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
}
/* wait for thread completion */
for( n = 0; n < nthreads; n++ )
{
pthread_join(threads[n], NULL);
}
free(threads);
/* and check results */
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL SELECT COUNT(*) INTO :l_rows FROM test_thread;
EXEC SQL COMMIT;
EXEC SQL DISCONNECT;
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 );
}
void *test_thread(void *arg)
{
long threadnum = (long)arg;
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
char l_connection[128];
EXEC SQL END DECLARE SECTION;
/* build up connection name, and connect to database */
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
EXEC SQL WHENEVER sqlerror sqlprint;
EXEC SQL CONNECT TO REGRESSDB1 AS :l_connection;
if( sqlca.sqlcode != 0 )
{
printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL );
}
EXEC SQL AT :l_connection BEGIN;
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
#ifdef DEBUG
printf("%s: inserting %d\n", l_connection, l_i);
#endif
EXEC SQL AT :l_connection INSERT INTO test_thread(thread, iteration) VALUES(:l_connection, :l_i);
#ifdef DEBUG
if( sqlca.sqlcode == 0 )
printf("%s: insert done\n", l_connection);
else
printf("%s: ERROR: insert failed!\n", l_connection);
#endif
}
/* all done */
EXEC SQL AT :l_connection COMMIT;
EXEC SQL DISCONNECT :l_connection;
#ifdef DEBUG
printf("%s: done!\n", l_connection);
#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */
/*
* Thread test program
* by Lee Kindness.
*/
#include <stdlib.h>
#ifndef ENABLE_THREAD_SAFETY
int
main(void)
{
printf("Success.\n");
return 0;
}
#else
#include <pthread.h>
#undef DEBUG
exec sql include ../regression;
void *test_thread(void *arg);
int nthreads = 10;
int iterations = 20;
int main(int argc, char *argv[])
{
pthread_t *threads;
int n;
EXEC SQL BEGIN DECLARE SECTION;
int l_rows;
EXEC SQL END DECLARE SECTION;
/* Switch off debug output for regression tests. The threads get executed in
* more or less random order */
ECPGdebug(0, stderr);
/* setup test_thread table */
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL DROP TABLE test_thread; /* DROP might fail */
EXEC SQL COMMIT;
EXEC SQL 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));
EXEC SQL COMMIT;
EXEC SQL DISCONNECT;
/* create, and start, threads */
threads = calloc(nthreads, sizeof(pthread_t));
if( threads == NULL )
{
fprintf(stderr, "Cannot alloc memory\n");
return( 1 );
}
for( n = 0; n < nthreads; n++ )
{
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
}
/* wait for thread completion */
for( n = 0; n < nthreads; n++ )
{
pthread_join(threads[n], NULL);
}
free(threads);
/* and check results */
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL SELECT COUNT(*) INTO :l_rows FROM test_thread;
EXEC SQL COMMIT;
EXEC SQL DISCONNECT;
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 );
}
void *test_thread(void *arg)
{
long threadnum = (long)arg;
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
char l_connection[128];
EXEC SQL END DECLARE SECTION;
/* build up connection name, and connect to database */
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
EXEC SQL WHENEVER sqlerror sqlprint;
EXEC SQL CONNECT TO REGRESSDB1 AS :l_connection;
if( sqlca.sqlcode != 0 )
{
printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL );
}
EXEC SQL BEGIN;
/* insert into test_thread table */
for( l_i = 1; l_i <= iterations; l_i++ )
{
#ifdef DEBUG
printf("%s: inserting %d\n", l_connection, l_i);
#endif
EXEC SQL INSERT INTO test_thread(thread, iteration) VALUES(:l_connection, :l_i);
#ifdef DEBUG
if( sqlca.sqlcode == 0 )
printf("%s: insert done\n", l_connection);
else
printf("%s: ERROR: insert failed!\n", l_connection);
#endif
}
/* all done */
EXEC SQL COMMIT;
EXEC SQL DISCONNECT :l_connection;
#ifdef DEBUG
printf("%s: done!\n", l_connection);
#endif
return( NULL );
}
#endif /* ENABLE_THREAD_SAFETY */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment