1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-06 18:42:54 +03:00

Implemented Informix special way to treat NULLs, removed warnings, synced.

This commit is contained in:
Michael Meskes
2003-06-25 10:44:21 +00:00
parent ff4c69e021
commit fd3ca524eb
20 changed files with 373 additions and 156 deletions

View File

@@ -1,4 +1,4 @@
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/test/Makefile,v 1.36 2003/04/08 17:09:51 tgl Exp $
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/test/Makefile,v 1.37 2003/06/25 10:44:21 meskes Exp $
subdir = src/interfaces/ecpg/test
top_builddir = ../../../..
@@ -8,15 +8,21 @@ override CPPFLAGS := -I$(srcdir)/../include $(CPPFLAGS)
ECPG = ../preproc/ecpg -I$(srcdir)/../include
TESTS = test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 test_init testdynalloc num_test dt_test
TESTS = test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 test_init testdynalloc num_test dt_test test_informix
all: $(TESTS)
%: %.o
$(CC) $(CFLAGS) $(LDFLAGS) -L../ecpglib -L ../pgtypeslib -L../../libpq $^ $(LIBS) -lpgtypes -lecpg -lpq -o $@
test_informix: test_informix.o
$(CC) $(CFLAGS) $(LDFLAGS) -L../compatlib -L../ecpglib -L ../pgtypeslib -L../../libpq $^ $(LIBS) -lpgtypes -lecpg -lecpg_compat -lpq -o $@
%.c: %.pgc
$(ECPG) $<
test_informix.c: test_informix.pgc
$(ECPG) -C INFORMIX $<
clean:
rm -f $(TESTS) $(TESTS:%=%.o) $(TESTS:%=%.c) log

View File

@@ -0,0 +1,49 @@
#include "sqltypes.h"
void openit(void);
int main()
{
$int i = 14;
$int j;
FILE *dbgs;
if ((dbgs = fopen("log", "w")) != NULL)
ECPGdebug(1, dbgs);
$connect to mm;
$create table test(i int primary key, j int);
rsetnull(CINTTYPE, (char *)&j);
$insert into test (i, j) values (7, :j);
$insert into test (i, j) values (:i, 1);
$declare c cursor for select * from test where i <= :i;
openit();
j=0;
while (1)
{
$fetch in c into :i, :j;
if (sqlca.sqlcode == 100) break;
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
if (risnull(CINTTYPE, (char *)&j))
printf("%d\n", i);
else
printf("%d %d\n", i, j);
}
$drop table test;
$disconnect;
return 0;
}
void openit(void)
{
$open c;
}