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
This diff is collapsed.
This diff is collapsed.
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
This diff is collapsed.
[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
This diff is collapsed.
[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);
}
This diff is collapsed.
This diff is collapsed.
[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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
[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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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