--- /dev/null
+#include "sqltypes.h"
+#include <stdlib.h>
+#
+$include ../regression;
+$define NUMBER 12;
+
+static void
+test_null(int type, char *ptr)
+{
+ printf("null: %d\n", risnull(type, ptr));
+}
+
+int main(void)
+{
+ $char c[] = "abc ";
+ $short s = 17;
+ $int i = -74874;
+ $bool b = 1;
+ $float f = 3.71;
+ $long l = 487444;
+ $double dbl = 404.404;
+ $decimal dec;
+ $date dat;
+ $timestamp tmp;
+
+ ECPGdebug(1, stderr);
+ $whenever sqlerror do sqlprint();
+
+ $connect to REGRESSDB1;
+
+ $create table test(id int, c char(10), s smallint, i int, b bool,
+ f float, l bigint, dbl double precision,
+ dec decimal, dat date, tmp timestamptz);
+ $commit;
+
+ $insert into test (id, c, s, i, b, f, l, dbl) values (
+ 1, :c, :s, :i, :b, :f, :l, :dbl
+ );
+ $commit;
+
+ rsetnull(CCHARTYPE, (char *) c);
+ rsetnull(CSHORTTYPE, (char *) &s);
+ rsetnull(CINTTYPE, (char *) &i);
+ rsetnull(CBOOLTYPE, (char *) &b);
+ rsetnull(CFLOATTYPE, (char *) &f);
+ rsetnull(CLONGTYPE, (char *) &l);
+ rsetnull(CDOUBLETYPE, (char *) &dbl);
+ rsetnull(CDECIMALTYPE, (char *) &dec);
+ rsetnull(CDATETYPE, (char *) &dat);
+ rsetnull(CDTIMETYPE, (char *) &tmp);
+
+ $insert into test (id, c, s, i, b, f, l, dbl, dec, dat, tmp) values (
+ 2, :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
+ );
+ $commit;
+
+ printf("first select\n");
+
+ $select c, s, i, b, f, l, dbl, dec, dat, tmp
+ into :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
+ from test where id = 1;
+
+ test_null(CCHARTYPE, (char *) c);
+ test_null(CSHORTTYPE, (char *) &s);
+ test_null(CINTTYPE, (char *) &i);
+ test_null(CBOOLTYPE, (char *) &b);
+ test_null(CFLOATTYPE, (char *) &f);
+ test_null(CLONGTYPE, (char *) &l);
+ test_null(CDOUBLETYPE, (char *) &dbl);
+ test_null(CDECIMALTYPE, (char *) &dec);
+ test_null(CDATETYPE, (char *) &dat);
+ test_null(CDTIMETYPE, (char *) &tmp);
+
+ printf("second select\n");
+
+ $select c, s, i, b, f, l, dbl, dec, dat, tmp
+ into :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
+ from test where id = 2;
+
+ test_null(CCHARTYPE, (char *) c);
+ test_null(CSHORTTYPE, (char *) &s);
+ test_null(CINTTYPE, (char *) &i);
+ test_null(CBOOLTYPE, (char *) &b);
+ test_null(CFLOATTYPE, (char *) &f);
+ test_null(CLONGTYPE, (char *) &l);
+ test_null(CDOUBLETYPE, (char *) &dbl);
+ test_null(CDECIMALTYPE, (char *) &dec);
+ test_null(CDATETYPE, (char *) &dat);
+ test_null(CDTIMETYPE, (char *) &tmp);
+
+ $drop table test;
+ $commit;
+
+ $close database;
+
+ return 0;
+}
--- /dev/null
+/* Processed by ecpg (4.2.1) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+
+#line 1 "rnull.pgc"
+#include "sqltypes.h"
+#include <stdlib.h>
+#
+
+#line 1 "./../regression.h"
+
+
+
+
+
+
+#line 4 "rnull.pgc"
+
+
+
+static void
+test_null(int type, char *ptr)
+{
+ printf("null: %d\n", risnull(type, ptr));
+}
+
+int main(void)
+{
+
+#line 15 "rnull.pgc"
+ char c [] = "abc " ;
+
+#line 15 "rnull.pgc"
+
+
+#line 16 "rnull.pgc"
+ short s = 17 ;
+
+#line 16 "rnull.pgc"
+
+
+#line 17 "rnull.pgc"
+ int i = - 74874 ;
+
+#line 17 "rnull.pgc"
+
+
+#line 18 "rnull.pgc"
+ bool b = 1 ;
+
+#line 18 "rnull.pgc"
+
+
+#line 19 "rnull.pgc"
+ float f = 3.71 ;
+
+#line 19 "rnull.pgc"
+
+
+#line 20 "rnull.pgc"
+ long l = 487444 ;
+
+#line 20 "rnull.pgc"
+
+
+#line 21 "rnull.pgc"
+ double dbl = 404.404 ;
+
+#line 21 "rnull.pgc"
+
+
+#line 22 "rnull.pgc"
+ decimal dec ;
+
+#line 22 "rnull.pgc"
+
+
+#line 23 "rnull.pgc"
+ date dat ;
+
+#line 23 "rnull.pgc"
+
+
+#line 24 "rnull.pgc"
+ timestamp tmp ;
+
+#line 24 "rnull.pgc"
+
+
+ ECPGdebug(1, stderr);
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 27 "rnull.pgc"
+
+
+ { ECPGconnect(__LINE__, 1, "regress1" , NULL,NULL , NULL, 0);
+#line 29 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 29 "rnull.pgc"
+
+
+ { ECPGdo(__LINE__, 1, 0, NULL, "create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 33 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 34 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 34 "rnull.pgc"
+
+
+ { ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl ) values( 1 , ? , ? , ? , ? , ? , ? , ? ) ",
+ ECPGt_char,&(c),(long)-1,(long)1,(-1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 38 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 38 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 39 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 39 "rnull.pgc"
+
+
+ rsetnull(CCHARTYPE, (char *) c);
+ rsetnull(CSHORTTYPE, (char *) &s);
+ rsetnull(CINTTYPE, (char *) &i);
+ rsetnull(CBOOLTYPE, (char *) &b);
+ rsetnull(CFLOATTYPE, (char *) &f);
+ rsetnull(CLONGTYPE, (char *) &l);
+ rsetnull(CDOUBLETYPE, (char *) &dbl);
+ rsetnull(CDECIMALTYPE, (char *) &dec);
+ rsetnull(CDATETYPE, (char *) &dat);
+ rsetnull(CDTIMETYPE, (char *) &tmp);
+
+ { ECPGdo(__LINE__, 1, 0, NULL, "insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values( 2 , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ",
+ ECPGt_char,&(c),(long)-1,(long)1,(-1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_decimal,&(dec),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(dat),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 54 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 54 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 55 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 55 "rnull.pgc"
+
+
+ printf("first select\n");
+
+ { ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 ", ECPGt_EOIT,
+ ECPGt_char,&(c),(long)-1,(long)1,(-1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_decimal,&(dec),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(dat),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 61 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 61 "rnull.pgc"
+
+
+ test_null(CCHARTYPE, (char *) c);
+ test_null(CSHORTTYPE, (char *) &s);
+ test_null(CINTTYPE, (char *) &i);
+ test_null(CBOOLTYPE, (char *) &b);
+ test_null(CFLOATTYPE, (char *) &f);
+ test_null(CLONGTYPE, (char *) &l);
+ test_null(CDOUBLETYPE, (char *) &dbl);
+ test_null(CDECIMALTYPE, (char *) &dec);
+ test_null(CDATETYPE, (char *) &dat);
+ test_null(CDTIMETYPE, (char *) &tmp);
+
+ printf("second select\n");
+
+ { ECPGdo(__LINE__, 1, 0, NULL, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 ", ECPGt_EOIT,
+ ECPGt_char,&(c),(long)-1,(long)1,(-1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_decimal,&(dec),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(dat),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 78 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 78 "rnull.pgc"
+
+
+ test_null(CCHARTYPE, (char *) c);
+ test_null(CSHORTTYPE, (char *) &s);
+ test_null(CINTTYPE, (char *) &i);
+ test_null(CBOOLTYPE, (char *) &b);
+ test_null(CFLOATTYPE, (char *) &f);
+ test_null(CLONGTYPE, (char *) &l);
+ test_null(CDOUBLETYPE, (char *) &dbl);
+ test_null(CDECIMALTYPE, (char *) &dec);
+ test_null(CDATETYPE, (char *) &dat);
+ test_null(CDTIMETYPE, (char *) &tmp);
+
+ { ECPGdo(__LINE__, 1, 0, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+#line 91 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 91 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 92 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 92 "rnull.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 94 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 94 "rnull.pgc"
+
+
+ return 0;
+}
--- /dev/null
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 31: QUERY: create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 31 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 34 action = commit connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: QUERY: insert into test ( id , c , s , i , b , f , l , dbl ) values( 1 , 'abc ' , 17 , -74874 , 't' , 3.710000038147 , 487444 , 404.404 ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 39 action = commit connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: QUERY: insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values( 2 , null , null , null , 't' , null , null , null , null , null , null ) 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]: ECPGtrans line 55 action = commit connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 59: QUERY: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1 on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 59: Correctly got 1 tuples with 10 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: abc offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: 17 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: -74874 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: 3.710000038147 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: 487444 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: 404.404 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 59: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 76: QUERY: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2 on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 76: Correctly got 1 tuples with 10 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 76: RESULT: offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 91: QUERY: drop table test on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 91 Ok: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 92 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