aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/expected
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/test/expected')
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test4.stderr62
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test5.stderr56
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c109
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout95
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-define.c127
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-define.stderr24
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-define.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-init.c (renamed from src/interfaces/ecpg/test/expected/errors-init.c)0
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-init.stderr (renamed from src/interfaces/ecpg/test/expected/errors-init.stderr)0
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-init.stdout (renamed from src/interfaces/ecpg/test/expected/errors-init.stdout)0
-rw-r--r--src/interfaces/ecpg/test/expected/sql-array.c (renamed from src/interfaces/ecpg/test/expected/complex-test4.c)125
-rw-r--r--src/interfaces/ecpg/test/expected/sql-array.stderr60
-rw-r--r--src/interfaces/ecpg/test/expected/sql-array.stdout (renamed from src/interfaces/ecpg/test/expected/complex-test4.stdout)2
-rw-r--r--src/interfaces/ecpg/test/expected/sql-binary.c (renamed from src/interfaces/ecpg/test/expected/complex-test5.c)105
-rw-r--r--src/interfaces/ecpg/test/expected/sql-binary.stderr46
-rw-r--r--src/interfaces/ecpg/test/expected/sql-binary.stdout (renamed from src/interfaces/ecpg/test/expected/complex-test5.stdout)1
16 files changed, 531 insertions, 282 deletions
diff --git a/src/interfaces/ecpg/test/expected/complex-test4.stderr b/src/interfaces/ecpg/test/expected/complex-test4.stderr
deleted file mode 100644
index e9924b1a6a4..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test4.stderr
+++ /dev/null
@@ -1,62 +0,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: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 63: RESULT: 0123456789 offset: -1 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: -1 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: -1 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
diff --git a/src/interfaces/ecpg/test/expected/complex-test5.stderr b/src/interfaces/ecpg/test/expected/complex-test5.stderr
deleted file mode 100644
index 164d09b55a0..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test5.stderr
+++ /dev/null
@@ -1,56 +0,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: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 59: RESULT: 320 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 59: RESULT: \001m\000\212 offset: -1 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: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 72: RESULT: 320 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 72: RESULT: \001m\000\212 offset: -1 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: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 85: RESULT: BINARY offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 85: RESULT: BINARY offset: -1 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
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
index 805f50f7e81..4a30736e780 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <limits.h>
#include <pgtypes_date.h>
#include <pgtypes_timestamp.h>
@@ -21,28 +22,72 @@
-#line 7 "dt_test2.pgc"
+#line 8 "dt_test2.pgc"
+char *dates[] = { "19990108foobar",
+ "19990108 foobar",
+ "1999-01-08 foobar",
+ "January 8, 1999",
+ "1999-01-08",
+ "1/8/1999",
+ "1/18/1999",
+ "01/02/03",
+ "1999-Jan-08",
+ "Jan-08-1999",
+ "08-Jan-1999",
+ "99-Jan-08",
+ "08-Jan-99",
+ "08-Jan-06",
+ "Jan-08-99",
+ "19990108",
+ "990108",
+ "1999.008",
+ "J2451187",
+ "January 8, 99 BC",
+ NULL };
+
+char *times[] = { "0:04",
+ "1:59 PDT",
+ "13:24:40 -8:00",
+ "13:24:40.495+3",
+ NULL };
+
+char *intervals[] = { "1 minute",
+ "1 12:59:10",
+ "2 day 12 hour 59 minute 10 second",
+ "1 days 12 hrs 59 mins 10 secs",
+ "1 days 1 hours 1 minutes 1 seconds",
+ "1 year 59 mins",
+ "1 year 59 mins foobar",
+ NULL };
+
int
main(void)
{
/* exec sql begin declare section */
+
-#line 13 "dt_test2.pgc"
+#line 51 "dt_test2.pgc"
date date1 ;
-#line 14 "dt_test2.pgc"
- timestamp ts1 ;
+#line 52 "dt_test2.pgc"
+ timestamp ts1 , ts2 ;
-#line 15 "dt_test2.pgc"
+#line 53 "dt_test2.pgc"
char * text ;
+
+#line 54 "dt_test2.pgc"
+ interval * i1 ;
/* exec sql end declare section */
-#line 16 "dt_test2.pgc"
+#line 55 "dt_test2.pgc"
+
+ int i, j;
+ char *endptr;
ECPGdebug(1, stderr);
@@ -57,6 +102,58 @@ main(void)
printf("Date of timestamp: %s\n", text);
free(text);
+ for (i = 0; dates[i]; i++)
+ {
+ bool err = false;
+ date1 = PGTYPESdate_from_asc(dates[i], &endptr);
+ if (date1 == INT_MIN) {
+ err = true;
+ }
+ text = PGTYPESdate_to_asc(date1);
+ printf("Date[%d]: %s (%c - %c)\n",
+ i, err ? "-" : text,
+ endptr ? 'N' : 'Y',
+ err ? 'T' : 'F');
+ free(text);
+ if (!err)
+ {
+ for (j = 0; times[j]; j++)
+ {
+ int length = strlen(dates[i])
+ + 1
+ + strlen(times[j])
+ + 1;
+ char* t = malloc(length);
+ sprintf(t, "%s %s", dates[i], times[j]);
+ ts1 = PGTYPEStimestamp_from_asc(t, NULL);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("TS[%d,%d]: %s\n",
+ i, j, errno ? "-" : text);
+ free(text);
+ }
+ }
+ }
+
+ ts1 = PGTYPEStimestamp_from_asc("2004-04-04 23:23:23", NULL);
+
+ for (i = 0; intervals[i]; i++)
+ {
+ i1 = PGTYPESinterval_from_asc(intervals[i], &endptr);
+ if (*endptr)
+ printf("endptr set to %s\n", endptr);
+ if (!i1)
+ {
+ printf("Error parsing interval %d\n", i);
+ continue;
+ }
+ j = PGTYPEStimestamp_add_interval(&ts1, i1, &ts2);
+ if (j < 0)
+ continue;
+ text = PGTYPESinterval_to_asc(i1);
+ printf("interval[%d]: %s\n", i, text ? text : "-");
+ free(text);
+ }
+
return (0);
}
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
index d4c783887b0..d52555f510a 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
@@ -1,2 +1,97 @@
timestamp: 2003-12-04 17:34:29
Date of timestamp: 2003-12-04
+Date[0]: - (N - T)
+Date[1]: - (N - T)
+Date[2]: - (N - T)
+Date[3]: 1999-01-08 (N - F)
+TS[3,0]: 1999-01-08 00:04:00
+TS[3,1]: 1999-01-08 01:59:00
+TS[3,2]: 1999-01-08 13:24:40
+TS[3,3]: 1999-01-08 13:24:40.495
+Date[4]: 1999-01-08 (N - F)
+TS[4,0]: 1999-01-08 00:04:00
+TS[4,1]: 1999-01-08 01:59:00
+TS[4,2]: 1999-01-08 13:24:40
+TS[4,3]: 1999-01-08 13:24:40.495
+Date[5]: 1999-01-08 (N - F)
+TS[5,0]: 1999-01-08 00:04:00
+TS[5,1]: 1999-01-08 01:59:00
+TS[5,2]: 1999-01-08 13:24:40
+TS[5,3]: 1999-01-08 13:24:40.495
+Date[6]: 1999-01-18 (N - F)
+TS[6,0]: 1999-01-18 00:04:00
+TS[6,1]: 1999-01-18 01:59:00
+TS[6,2]: 1999-01-18 13:24:40
+TS[6,3]: 1999-01-18 13:24:40.495
+Date[7]: 2003-01-02 (N - F)
+TS[7,0]: 2003-01-02 00:04:00
+TS[7,1]: 2003-01-02 01:59:00
+TS[7,2]: 2003-01-02 13:24:40
+TS[7,3]: 2003-01-02 13:24:40.495
+Date[8]: 1999-01-08 (N - F)
+TS[8,0]: 1999-01-08 00:04:00
+TS[8,1]: 1999-01-08 01:59:00
+TS[8,2]: 1999-01-08 13:24:40
+TS[8,3]: 1999-01-08 13:24:40.495
+Date[9]: 1999-01-08 (N - F)
+TS[9,0]: 1999-01-08 00:04:00
+TS[9,1]: 1999-01-08 01:59:00
+TS[9,2]: 1999-01-08 13:24:40
+TS[9,3]: 1999-01-08 13:24:40.495
+Date[10]: 1999-01-08 (N - F)
+TS[10,0]: 1999-01-08 00:04:00
+TS[10,1]: 1999-01-08 01:59:00
+TS[10,2]: 1999-01-08 13:24:40
+TS[10,3]: 1999-01-08 13:24:40.495
+Date[11]: 1999-01-08 (N - F)
+TS[11,0]: 1999-01-08 00:04:00
+TS[11,1]: 1999-01-08 01:59:00
+TS[11,2]: 1999-01-08 13:24:40
+TS[11,3]: 1999-01-08 13:24:40.495
+Date[12]: 1999-01-08 (N - F)
+TS[12,0]: 1999-01-08 00:04:00
+TS[12,1]: 1999-01-08 01:59:00
+TS[12,2]: 1999-01-08 13:24:40
+TS[12,3]: 1999-01-08 13:24:40.495
+Date[13]: 2006-01-08 (N - F)
+TS[13,0]: 2006-01-08 00:04:00
+TS[13,1]: 2006-01-08 01:59:00
+TS[13,2]: 2006-01-08 13:24:40
+TS[13,3]: 2006-01-08 13:24:40.495
+Date[14]: 1999-01-08 (N - F)
+TS[14,0]: 1999-01-08 00:04:00
+TS[14,1]: 1999-01-08 01:59:00
+TS[14,2]: 1999-01-08 13:24:40
+TS[14,3]: 1999-01-08 13:24:40.495
+Date[15]: 1999-01-08 (N - F)
+TS[15,0]: 1999-01-08 00:04:00
+TS[15,1]: 1999-01-08 01:59:00
+TS[15,2]: 1999-01-08 13:24:40
+TS[15,3]: 1999-01-08 13:24:40.495
+Date[16]: 1999-01-08 (N - F)
+TS[16,0]: 1999-01-08 00:04:00
+TS[16,1]: 1999-01-08 01:59:00
+TS[16,2]: 1999-01-08 13:24:40
+TS[16,3]: 1999-01-08 13:24:40.495
+Date[17]: 1999-01-08 (N - F)
+TS[17,0]: 1999-01-08 00:04:00
+TS[17,1]: 1999-01-08 01:59:00
+TS[17,2]: 1999-01-08 13:24:40
+TS[17,3]: 1999-01-08 13:24:40.495
+Date[18]: 1999-01-08 (N - F)
+TS[18,0]: 1999-01-08 00:04:00
+TS[18,1]: 1999-01-08 01:59:00
+TS[18,2]: 1999-01-08 13:24:40
+TS[18,3]: 1999-01-08 13:24:40.495
+Date[19]: 0099-01-08 BC (N - F)
+TS[19,0]: 0099-01-08 00:04:00 BC
+TS[19,1]: 0099-01-08 01:59:00 BC
+TS[19,2]: 0099-01-08 13:24:40 BC
+TS[19,3]: 0099-01-08 13:24:40.495 BC
+interval[0]: @ 1 min
+interval[1]: @ 1 day 12 hours 59 mins 10 secs
+interval[2]: @ 2 days 12 hours 59 mins 10 secs
+interval[3]: @ 1 day 12 hours 59 mins 10 secs
+interval[4]: @ 1 day 1 hour 1 min 1 sec
+interval[5]: @ 1 year 59 mins
+Error parsing interval 6
diff --git a/src/interfaces/ecpg/test/expected/preproc-define.c b/src/interfaces/ecpg/test/expected/preproc-define.c
new file mode 100644
index 00000000000..b5d01a94035
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-define.c
@@ -0,0 +1,127 @@
+/* Processed by ecpg (4.2.1) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+
+#line 1 "define.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "define.pgc"
+
+
+typedef long mmInteger ;
+
+#line 6 "define.pgc"
+
+#line 6 "define.pgc"
+
+typedef char mmChar ;
+
+#line 7 "define.pgc"
+
+#line 7 "define.pgc"
+
+typedef short mmSmallInt ;
+
+#line 8 "define.pgc"
+
+#line 8 "define.pgc"
+
+
+/* exec sql begin declare section */
+
+
+
+
+
+
+struct TBempl {
+#line 13 "define.pgc"
+ mmInteger idnum ;
+
+#line 14 "define.pgc"
+ mmChar name [ 21 ] ;
+
+#line 15 "define.pgc"
+ mmSmallInt accs ;
+ } ;/* exec sql end declare section */
+#line 17 "define.pgc"
+
+
+int
+main (void)
+{
+ /* exec sql begin declare section */
+
+
+#line 23 "define.pgc"
+ struct TBempl empl ;
+/* exec sql end declare section */
+#line 24 "define.pgc"
+
+
+ ECPGdebug (1, stderr);
+
+ empl.idnum = 1;
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
+#line 29 "define.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 ) ", ECPGt_EOIT, ECPGt_EORT);}
+#line 37 "define.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_EOIT, ECPGt_EORT);}
+#line 44 "define.pgc"
+
+ if (sqlca.sqlcode)
+ {
+ printf ("insert error = %ld\n", sqlca.sqlcode);
+ exit (sqlca.sqlcode);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select idnum , name , accs from empl where idnum = ? ",
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ 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_EORT);}
+#line 54 "define.pgc"
+
+ if (sqlca.sqlcode)
+ {
+ printf ("select error = %ld\n", sqlca.sqlcode);
+ exit (sqlca.sqlcode);
+ }
+ printf ("id=%ld name=%s, accs=%d\n", empl.idnum, empl.name, empl.accs);
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 62 "define.pgc"
+
+ exit (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-define.stderr b/src/interfaces/ecpg/test/expected/preproc-define.stderr
new file mode 100644
index 00000000000..34610cb50f8
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-define.stderr
@@ -0,0 +1,24 @@
+[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 36: QUERY: create table empl ( idnum integer , name char ( 20 ) , accs smallint ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 44: QUERY: insert into empl values ( 1 , 'first user' , 320 ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 44 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: QUERY: select idnum , name , accs from empl where idnum = 1 on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: Correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 51: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 51: RESULT: first user offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 51: RESULT: 320 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection regress1 closed.
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-define.stdout b/src/interfaces/ecpg/test/expected/preproc-define.stdout
new file mode 100644
index 00000000000..63c2bbbc0df
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-define.stdout
@@ -0,0 +1 @@
+id=1 name=first user , accs=320
diff --git a/src/interfaces/ecpg/test/expected/errors-init.c b/src/interfaces/ecpg/test/expected/preproc-init.c
index 0d085b140dd..0d085b140dd 100644
--- a/src/interfaces/ecpg/test/expected/errors-init.c
+++ b/src/interfaces/ecpg/test/expected/preproc-init.c
diff --git a/src/interfaces/ecpg/test/expected/errors-init.stderr b/src/interfaces/ecpg/test/expected/preproc-init.stderr
index c85fce83dc8..c85fce83dc8 100644
--- a/src/interfaces/ecpg/test/expected/errors-init.stderr
+++ b/src/interfaces/ecpg/test/expected/preproc-init.stderr
diff --git a/src/interfaces/ecpg/test/expected/errors-init.stdout b/src/interfaces/ecpg/test/expected/preproc-init.stdout
index 4738d795aac..4738d795aac 100644
--- a/src/interfaces/ecpg/test/expected/errors-init.stdout
+++ b/src/interfaces/ecpg/test/expected/preproc-init.stdout
diff --git a/src/interfaces/ecpg/test/expected/complex-test4.c b/src/interfaces/ecpg/test/expected/sql-array.c
index d56b1954c7c..87ec88f985a 100644
--- a/src/interfaces/ecpg/test/expected/complex-test4.c
+++ b/src/interfaces/ecpg/test/expected/sql-array.c
@@ -6,13 +6,13 @@
#include <sqlca.h>
/* End of automatic include section */
-#line 1 "test4.pgc"
+#line 1 "array.pgc"
#include <locale.h>
#include <string.h>
#include <stdlib.h>
/* exec sql whenever sqlerror sqlprint ; */
-#line 5 "test4.pgc"
+#line 5 "array.pgc"
@@ -84,7 +84,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
-#line 7 "test4.pgc"
+#line 7 "array.pgc"
#line 1 "regression.h"
@@ -94,61 +94,39 @@ struct sqlca_t *ECPGget_sqlca(void);
-#line 8 "test4.pgc"
-
-
-typedef enum { OK = 0 , ERR = 1 , WARN = 2 } errtype ;
-#line 15 "test4.pgc"
+#line 8 "array.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"
+#line 14 "array.pgc"
int i = 1 ;
-#line 27 "test4.pgc"
+#line 15 "array.pgc"
int * did = & i ;
-#line 28 "test4.pgc"
+#line 16 "array.pgc"
int a [ 10 ] = { 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 } ;
-#line 29 "test4.pgc"
+#line 17 "array.pgc"
char text [ 25 ] = "klmnopqrst" ;
-#line 30 "test4.pgc"
+#line 18 "array.pgc"
char * t = ( char * ) malloc ( 11 ) ;
-#line 31 "test4.pgc"
+#line 19 "array.pgc"
double f ;
-
-#line 32 "test4.pgc"
- bool b = true ;
/* exec sql end declare section */
-#line 33 "test4.pgc"
+#line 20 "array.pgc"
strcpy(t, "0123456789");
@@ -157,99 +135,90 @@ main (void)
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
-#line 40 "test4.pgc"
+#line 27 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 40 "test4.pgc"
+#line 27 "array.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 42 "test4.pgc"
+#line 29 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 42 "test4.pgc"
+#line 29 "array.pgc"
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
-#line 44 "test4.pgc"
+#line 31 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 44 "test4.pgc"
+#line 31 "array.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"
+ { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 46 "test4.pgc"
+#line 33 "array.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"
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 48 "test4.pgc"
+#line 35 "array.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text , b , t , err ) values( 140787.0 , 2 , ? , ? , 't' , 2 , 14 ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 140787.0 , 2 , ? , ? ) ",
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"
+#line 37 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 50 "test4.pgc"
+#line 37 "array.pgc"
-
-
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text , b , t , err ) values( 14.07 , ? , ? , ? , ? , 1 , 147 ) ",
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( f , i , a , text ) values ( 14.07 , ? , ? , ? ) ",
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"
+#line 39 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 55 "test4.pgc"
-
- error.code=0;
+#line 39 "array.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
-#line 59 "test4.pgc"
+#line 41 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 59 "test4.pgc"
+#line 41 "array.pgc"
{ ECPGtrans(__LINE__, NULL, "begin transaction ");
-#line 61 "test4.pgc"
+#line 43 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 61 "test4.pgc"
+#line 43 "array.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select f , text , b from test where i = 1 ", ECPGt_EOIT,
+ { ECPGdo(__LINE__, 0, 1, NULL, "select f , text 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"
+#line 48 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 66 "test4.pgc"
+#line 48 "array.pgc"
- printf("Found f=%f text=%10.10s b=%d\n", f, text, b);
+ printf("Found f=%f text=%10.10s\n", f, text);
f=140787;
{ ECPGdo(__LINE__, 0, 1, NULL, "select a , text from test where f = ? ",
@@ -259,10 +228,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
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"
+#line 56 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 74 "test4.pgc"
+#line 56 "array.pgc"
for (i = 0; i < 10; i++)
@@ -275,33 +244,33 @@ if (sqlca.sqlcode < 0) sqlprint();}
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"
+#line 66 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 84 "test4.pgc"
+#line 66 "array.pgc"
printf("Found text=%s\n", text);
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
-#line 88 "test4.pgc"
+#line 70 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 88 "test4.pgc"
+#line 70 "array.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");
-#line 90 "test4.pgc"
+#line 72 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 90 "test4.pgc"
+#line 72 "array.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
-#line 92 "test4.pgc"
+#line 74 "array.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 92 "test4.pgc"
+#line 74 "array.pgc"
return (0);
diff --git a/src/interfaces/ecpg/test/expected/sql-array.stderr b/src/interfaces/ecpg/test/expected/sql-array.stderr
new file mode 100644
index 00000000000..00eda214549
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-array.stderr
@@ -0,0 +1,60 @@
+[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 29 action = on connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 31 action = begin transaction connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: QUERY: create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: QUERY: insert into test ( f , i , a , text ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37: QUERY: insert into test ( f , i , a , text ) values ( 140787.0 , 2 , array [9,8,7,6,5,4,3,2,1,0] , 'klmnopqrst' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: QUERY: insert into test ( f , i , a , text ) values ( 14.07 , 1 , array [9,8,7,6,5,4,3,2,1,0] , '0123456789' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 41 action = commit connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 43 action = begin transaction connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 45: QUERY: select f , text from test where i = 1 on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 45: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 45: RESULT: 14.07 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 45: RESULT: 0123456789 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: QUERY: select a , text from test where f = 140787 on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGis_type_an_array line 53: TYPE database: 1007 C: 5 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: {9,8,7,6,5,4,3,2,1,0} offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: klmnopqrst offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 63: QUERY: select a from test where f = 140787 on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 63: Correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 63: RESULT: {9,8,7,6,5,4,3,2,1,0} offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 70: QUERY: drop table test on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 70 Ok: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 72 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
diff --git a/src/interfaces/ecpg/test/expected/complex-test4.stdout b/src/interfaces/ecpg/test/expected/sql-array.stdout
index 7e8a326fa11..88c19f2498a 100644
--- a/src/interfaces/ecpg/test/expected/complex-test4.stdout
+++ b/src/interfaces/ecpg/test/expected/sql-array.stdout
@@ -1,4 +1,4 @@
-Found f=14.070000 text=0123456789 b=1
+Found f=14.070000 text=0123456789
Found a[0] = 9
Found a[1] = 8
Found a[2] = 7
diff --git a/src/interfaces/ecpg/test/expected/complex-test5.c b/src/interfaces/ecpg/test/expected/sql-binary.c
index 337a5d8984b..deb0220d44f 100644
--- a/src/interfaces/ecpg/test/expected/complex-test5.c
+++ b/src/interfaces/ecpg/test/expected/sql-binary.c
@@ -6,7 +6,7 @@
#include <sqlca.h>
/* End of automatic include section */
-#line 1 "test5.pgc"
+#line 1 "binary.pgc"
#include <stdio.h>
#include <stdlib.h>
@@ -18,26 +18,7 @@
-#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"
+#line 4 "binary.pgc"
/* exec sql begin declare section */
@@ -49,19 +30,19 @@ typedef short mmSmallInt ;
struct TBempl {
-#line 13 "test5.pgc"
- mmInteger idnum ;
+#line 9 "binary.pgc"
+ long idnum ;
-#line 14 "test5.pgc"
- mmChar name [ 21 ] ;
+#line 10 "binary.pgc"
+ char name [ 21 ] ;
-#line 15 "test5.pgc"
- mmSmallInt accs ;
+#line 11 "binary.pgc"
+ short accs ;
-#line 16 "test5.pgc"
- mmChar byte [ 20 ] ;
+#line 12 "binary.pgc"
+ char byte [ 20 ] ;
} ;/* exec sql end declare section */
-#line 18 "test5.pgc"
+#line 14 "binary.pgc"
int
@@ -70,28 +51,14 @@ main (void)
/* exec sql begin declare section */
-
-
-
-
-
-#line 24 "test5.pgc"
+#line 20 "binary.pgc"
struct TBempl empl ;
-#line 25 "test5.pgc"
+#line 21 "binary.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"
+#line 22 "binary.pgc"
int i;
@@ -99,7 +66,7 @@ main (void)
empl.idnum = 1;
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
-#line 37 "test5.pgc"
+#line 28 "binary.pgc"
if (sqlca.sqlcode)
{
@@ -108,7 +75,7 @@ main (void)
}
{ 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"
+#line 36 "binary.pgc"
if (sqlca.sqlcode)
{
@@ -116,10 +83,10 @@ main (void)
exit (sqlca.sqlcode);
}
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values( 1 , 'first user' , 320 , ? ) ",
+ { 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"
+#line 43 "binary.pgc"
if (sqlca.sqlcode)
{
@@ -127,31 +94,13 @@ main (void)
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"
+#line 50 "binary.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"
+#line 51 "binary.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch C", ECPGt_EOIT,
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
@@ -160,7 +109,7 @@ main (void)
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"
+#line 52 "binary.pgc"
if (sqlca.sqlcode)
{
@@ -173,21 +122,21 @@ main (void)
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"
+#line 63 "binary.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"
+#line 64 "binary.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_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 85 "test5.pgc"
+#line 65 "binary.pgc"
if (sqlca.sqlcode)
{
@@ -196,7 +145,7 @@ main (void)
}
{ ECPGdo(__LINE__, 0, 1, NULL, "close B", ECPGt_EOIT, ECPGt_EORT);}
-#line 92 "test5.pgc"
+#line 72 "binary.pgc"
/* do not print a.accs because big/little endian will have different outputs here */
@@ -209,7 +158,7 @@ main (void)
}
printf("\n");
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 103 "test5.pgc"
+#line 83 "binary.pgc"
exit (0);
}
diff --git a/src/interfaces/ecpg/test/expected/sql-binary.stderr b/src/interfaces/ecpg/test/expected/sql-binary.stderr
new file mode 100644
index 00000000000..8b589b7c641
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-binary.stderr
@@ -0,0 +1,46 @@
+[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 35: 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 35 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: 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 43 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: 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 51 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: QUERY: fetch C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: Correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 52: RESULT: first user offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 52: RESULT: 320 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 52: RESULT: \001m\000\212 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 64: 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 64 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 65: QUERY: fetch B on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 65: Correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 65: RESULT: BINARY offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 65: RESULT: BINARY offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 65: RESULT: BINARY offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 72: QUERY: close B on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 72 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection regress1 closed.
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/complex-test5.stdout b/src/interfaces/ecpg/test/expected/sql-binary.stdout
index 745889b486c..e8b92563190 100644
--- a/src/interfaces/ecpg/test/expected/complex-test5.stdout
+++ b/src/interfaces/ecpg/test/expected/sql-binary.stdout
@@ -1,3 +1,2 @@
name=first user , accs=320 byte=\001m\000\212
-name=first user , accs=320 byte=\001m\000\212
name=first user , byte=(1)(155)(0)(212)