Skip to content

Commit 466a492

Browse files
committed
Fix an ecpg test, too. Are we there yet?
1 parent c83d1fb commit 466a492

File tree

3 files changed

+77
-55
lines changed

3 files changed

+77
-55
lines changed

src/interfaces/ecpg/test/expected/sql-binary.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,17 @@ main (void)
7878
exit (sqlca.sqlcode);
7979
}
8080

81+
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set bytea_output = escape", ECPGt_EOIT, ECPGt_EORT);}
82+
#line 36 "binary.pgc"
83+
84+
if (sqlca.sqlcode)
85+
{
86+
printf ("set bytea_output error = %ld\n", sqlca.sqlcode);
87+
exit (sqlca.sqlcode);
88+
}
89+
8190
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea )", ECPGt_EOIT, ECPGt_EORT);}
82-
#line 37 "binary.pgc"
91+
#line 44 "binary.pgc"
8392

8493
if (sqlca.sqlcode)
8594
{
@@ -90,7 +99,7 @@ main (void)
9099
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into empl values ( 1 , 'first user' , 320 , $1 )",
91100
ECPGt_char,&(data),(long)0,(long)1,(1)*sizeof(char),
92101
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
93-
#line 44 "binary.pgc"
102+
#line 51 "binary.pgc"
94103

95104
if (sqlca.sqlcode)
96105
{
@@ -99,12 +108,12 @@ main (void)
99108
}
100109

101110
/* declare C cursor for select name , accs , byte from empl where idnum = $1 */
102-
#line 51 "binary.pgc"
111+
#line 58 "binary.pgc"
103112

104113
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select name , accs , byte from empl where idnum = $1 ",
105114
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
106115
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
107-
#line 52 "binary.pgc"
116+
#line 59 "binary.pgc"
108117

109118
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch C", ECPGt_EOIT,
110119
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
@@ -113,7 +122,7 @@ main (void)
113122
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
114123
ECPGt_char,(empl.byte),(long)20,(long)1,(20)*sizeof(char),
115124
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
116-
#line 53 "binary.pgc"
125+
#line 60 "binary.pgc"
117126

118127
if (sqlca.sqlcode)
119128
{
@@ -125,12 +134,12 @@ main (void)
125134

126135
memset(empl.name, 0, 21L);
127136
/* declare B binary cursor for select name , accs , byte from empl where idnum = $1 */
128-
#line 63 "binary.pgc"
137+
#line 70 "binary.pgc"
129138

130139
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare B binary cursor for select name , accs , byte from empl where idnum = $1 ",
131140
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
132141
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
133-
#line 64 "binary.pgc"
142+
#line 71 "binary.pgc"
134143

135144
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch B", ECPGt_EOIT,
136145
ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
@@ -139,7 +148,7 @@ main (void)
139148
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
140149
ECPGt_char,(empl.byte),(long)20,(long)1,(20)*sizeof(char),
141150
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
142-
#line 65 "binary.pgc"
151+
#line 72 "binary.pgc"
143152

144153
if (sqlca.sqlcode)
145154
{
@@ -148,7 +157,7 @@ main (void)
148157
}
149158

150159
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close B", ECPGt_EOIT, ECPGt_EORT);}
151-
#line 72 "binary.pgc"
160+
#line 79 "binary.pgc"
152161

153162

154163
/* do not print a.accs because big/little endian will have different outputs here */
@@ -158,17 +167,17 @@ main (void)
158167
printf("\n");
159168

160169
/* declare A binary cursor for select byte from empl where idnum = $1 */
161-
#line 80 "binary.pgc"
170+
#line 87 "binary.pgc"
162171

163172
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare A binary cursor for select byte from empl where idnum = $1 ",
164173
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
165174
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
166-
#line 81 "binary.pgc"
175+
#line 88 "binary.pgc"
167176

168177
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch A", ECPGt_EOIT,
169178
ECPGt_char,&(pointer),(long)0,(long)1,(1)*sizeof(char),
170179
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
171-
#line 82 "binary.pgc"
180+
#line 89 "binary.pgc"
172181

173182
if (sqlca.sqlcode)
174183
{
@@ -177,7 +186,7 @@ main (void)
177186
}
178187

179188
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close A", ECPGt_EOIT, ECPGt_EORT);}
180-
#line 89 "binary.pgc"
189+
#line 96 "binary.pgc"
181190

182191

183192
printf ("pointer=");
@@ -187,7 +196,7 @@ main (void)
187196
free(pointer);
188197

189198
{ ECPGdisconnect(__LINE__, "CURRENT");}
190-
#line 97 "binary.pgc"
199+
#line 104 "binary.pgc"
191200

192201
exit (0);
193202
}

src/interfaces/ecpg/test/expected/sql-binary.stderr

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,89 +2,95 @@
22
[NO_PID]: sqlca: code: 0, state: 00000
33
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
44
[NO_PID]: sqlca: code: 0, state: 00000
5-
[NO_PID]: ecpg_execute on line 36: query: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ); with 0 parameter(s) on connection regress1
5+
[NO_PID]: ecpg_execute on line 36: query: set bytea_output = escape; with 0 parameter(s) on connection regress1
66
[NO_PID]: sqlca: code: 0, state: 00000
77
[NO_PID]: ecpg_execute on line 36: using PQexec
88
[NO_PID]: sqlca: code: 0, state: 00000
9-
[NO_PID]: ecpg_execute on line 36: OK: CREATE TABLE
9+
[NO_PID]: ecpg_execute on line 36: OK: SET
1010
[NO_PID]: sqlca: code: 0, state: 00000
11-
[NO_PID]: ecpg_execute on line 44: query: insert into empl values ( 1 , 'first user' , 320 , $1 ); with 1 parameter(s) on connection regress1
11+
[NO_PID]: ecpg_execute on line 43: query: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ); with 0 parameter(s) on connection regress1
1212
[NO_PID]: sqlca: code: 0, state: 00000
13-
[NO_PID]: ecpg_execute on line 44: using PQexecParams
13+
[NO_PID]: ecpg_execute on line 43: using PQexec
1414
[NO_PID]: sqlca: code: 0, state: 00000
15-
[NO_PID]: free_params on line 44: parameter 1 = \001\155\000\212
15+
[NO_PID]: ecpg_execute on line 43: OK: CREATE TABLE
1616
[NO_PID]: sqlca: code: 0, state: 00000
17-
[NO_PID]: ecpg_execute on line 44: OK: INSERT 0 1
17+
[NO_PID]: ecpg_execute on line 51: query: insert into empl values ( 1 , 'first user' , 320 , $1 ); with 1 parameter(s) on connection regress1
1818
[NO_PID]: sqlca: code: 0, state: 00000
19-
[NO_PID]: ecpg_execute on line 52: query: declare C cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection regress1
19+
[NO_PID]: ecpg_execute on line 51: using PQexecParams
2020
[NO_PID]: sqlca: code: 0, state: 00000
21-
[NO_PID]: ecpg_execute on line 52: using PQexecParams
21+
[NO_PID]: free_params on line 51: parameter 1 = \001\155\000\212
2222
[NO_PID]: sqlca: code: 0, state: 00000
23-
[NO_PID]: free_params on line 52: parameter 1 = 1
23+
[NO_PID]: ecpg_execute on line 51: OK: INSERT 0 1
2424
[NO_PID]: sqlca: code: 0, state: 00000
25-
[NO_PID]: ecpg_execute on line 52: OK: DECLARE CURSOR
25+
[NO_PID]: ecpg_execute on line 59: query: declare C cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection regress1
2626
[NO_PID]: sqlca: code: 0, state: 00000
27-
[NO_PID]: ecpg_execute on line 53: query: fetch C; with 0 parameter(s) on connection regress1
27+
[NO_PID]: ecpg_execute on line 59: using PQexecParams
2828
[NO_PID]: sqlca: code: 0, state: 00000
29-
[NO_PID]: ecpg_execute on line 53: using PQexec
29+
[NO_PID]: free_params on line 59: parameter 1 = 1
3030
[NO_PID]: sqlca: code: 0, state: 00000
31-
[NO_PID]: ecpg_execute on line 53: correctly got 1 tuples with 3 fields
31+
[NO_PID]: ecpg_execute on line 59: OK: DECLARE CURSOR
3232
[NO_PID]: sqlca: code: 0, state: 00000
33-
[NO_PID]: ecpg_get_data on line 53: RESULT: first user offset: -1; array: yes
33+
[NO_PID]: ecpg_execute on line 60: query: fetch C; with 0 parameter(s) on connection regress1
3434
[NO_PID]: sqlca: code: 0, state: 00000
35-
[NO_PID]: ecpg_get_data on line 53: RESULT: 320 offset: -1; array: yes
35+
[NO_PID]: ecpg_execute on line 60: using PQexec
3636
[NO_PID]: sqlca: code: 0, state: 00000
37-
[NO_PID]: ecpg_get_data on line 53: RESULT: \001m\000\212 offset: -1; array: yes
37+
[NO_PID]: ecpg_execute on line 60: correctly got 1 tuples with 3 fields
3838
[NO_PID]: sqlca: code: 0, state: 00000
39-
[NO_PID]: ecpg_execute on line 64: query: declare B binary cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection regress1
39+
[NO_PID]: ecpg_get_data on line 60: RESULT: first user offset: -1; array: yes
4040
[NO_PID]: sqlca: code: 0, state: 00000
41-
[NO_PID]: ecpg_execute on line 64: using PQexecParams
41+
[NO_PID]: ecpg_get_data on line 60: RESULT: 320 offset: -1; array: yes
4242
[NO_PID]: sqlca: code: 0, state: 00000
43-
[NO_PID]: free_params on line 64: parameter 1 = 1
43+
[NO_PID]: ecpg_get_data on line 60: RESULT: \001m\000\212 offset: -1; array: yes
4444
[NO_PID]: sqlca: code: 0, state: 00000
45-
[NO_PID]: ecpg_execute on line 64: OK: DECLARE CURSOR
45+
[NO_PID]: ecpg_execute on line 71: query: declare B binary cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection regress1
4646
[NO_PID]: sqlca: code: 0, state: 00000
47-
[NO_PID]: ecpg_execute on line 65: query: fetch B; with 0 parameter(s) on connection regress1
47+
[NO_PID]: ecpg_execute on line 71: using PQexecParams
4848
[NO_PID]: sqlca: code: 0, state: 00000
49-
[NO_PID]: ecpg_execute on line 65: using PQexec
49+
[NO_PID]: free_params on line 71: parameter 1 = 1
5050
[NO_PID]: sqlca: code: 0, state: 00000
51-
[NO_PID]: ecpg_execute on line 65: correctly got 1 tuples with 3 fields
51+
[NO_PID]: ecpg_execute on line 71: OK: DECLARE CURSOR
5252
[NO_PID]: sqlca: code: 0, state: 00000
53-
[NO_PID]: ecpg_get_data on line 65: RESULT: BINARY offset: -1; array: yes
53+
[NO_PID]: ecpg_execute on line 72: query: fetch B; with 0 parameter(s) on connection regress1
5454
[NO_PID]: sqlca: code: 0, state: 00000
55-
[NO_PID]: ecpg_get_data on line 65: RESULT: BINARY offset: -1; array: yes
55+
[NO_PID]: ecpg_execute on line 72: using PQexec
5656
[NO_PID]: sqlca: code: 0, state: 00000
57-
[NO_PID]: ecpg_get_data on line 65: RESULT: BINARY offset: -1; array: yes
57+
[NO_PID]: ecpg_execute on line 72: correctly got 1 tuples with 3 fields
5858
[NO_PID]: sqlca: code: 0, state: 00000
59-
[NO_PID]: ecpg_execute on line 72: query: close B; with 0 parameter(s) on connection regress1
59+
[NO_PID]: ecpg_get_data on line 72: RESULT: BINARY offset: -1; array: yes
6060
[NO_PID]: sqlca: code: 0, state: 00000
61-
[NO_PID]: ecpg_execute on line 72: using PQexec
61+
[NO_PID]: ecpg_get_data on line 72: RESULT: BINARY offset: -1; array: yes
6262
[NO_PID]: sqlca: code: 0, state: 00000
63-
[NO_PID]: ecpg_execute on line 72: OK: CLOSE CURSOR
63+
[NO_PID]: ecpg_get_data on line 72: RESULT: BINARY offset: -1; array: yes
6464
[NO_PID]: sqlca: code: 0, state: 00000
65-
[NO_PID]: ecpg_execute on line 81: query: declare A binary cursor for select byte from empl where idnum = $1 ; with 1 parameter(s) on connection regress1
65+
[NO_PID]: ecpg_execute on line 79: query: close B; with 0 parameter(s) on connection regress1
6666
[NO_PID]: sqlca: code: 0, state: 00000
67-
[NO_PID]: ecpg_execute on line 81: using PQexecParams
67+
[NO_PID]: ecpg_execute on line 79: using PQexec
6868
[NO_PID]: sqlca: code: 0, state: 00000
69-
[NO_PID]: free_params on line 81: parameter 1 = 1
69+
[NO_PID]: ecpg_execute on line 79: OK: CLOSE CURSOR
7070
[NO_PID]: sqlca: code: 0, state: 00000
71-
[NO_PID]: ecpg_execute on line 81: OK: DECLARE CURSOR
71+
[NO_PID]: ecpg_execute on line 88: query: declare A binary cursor for select byte from empl where idnum = $1 ; with 1 parameter(s) on connection regress1
7272
[NO_PID]: sqlca: code: 0, state: 00000
73-
[NO_PID]: ecpg_execute on line 82: query: fetch A; with 0 parameter(s) on connection regress1
73+
[NO_PID]: ecpg_execute on line 88: using PQexecParams
7474
[NO_PID]: sqlca: code: 0, state: 00000
75-
[NO_PID]: ecpg_execute on line 82: using PQexec
75+
[NO_PID]: free_params on line 88: parameter 1 = 1
7676
[NO_PID]: sqlca: code: 0, state: 00000
77-
[NO_PID]: ecpg_execute on line 82: correctly got 1 tuples with 1 fields
77+
[NO_PID]: ecpg_execute on line 88: OK: DECLARE CURSOR
7878
[NO_PID]: sqlca: code: 0, state: 00000
79-
[NO_PID]: ecpg_store_result on line 82: allocating memory for 1 tuples
79+
[NO_PID]: ecpg_execute on line 89: query: fetch A; with 0 parameter(s) on connection regress1
8080
[NO_PID]: sqlca: code: 0, state: 00000
81-
[NO_PID]: ecpg_get_data on line 82: RESULT: BINARY offset: -1; array: yes
81+
[NO_PID]: ecpg_execute on line 89: using PQexec
8282
[NO_PID]: sqlca: code: 0, state: 00000
83-
[NO_PID]: ecpg_execute on line 89: query: close A; with 0 parameter(s) on connection regress1
83+
[NO_PID]: ecpg_execute on line 89: correctly got 1 tuples with 1 fields
8484
[NO_PID]: sqlca: code: 0, state: 00000
85-
[NO_PID]: ecpg_execute on line 89: using PQexec
85+
[NO_PID]: ecpg_store_result on line 89: allocating memory for 1 tuples
86+
[NO_PID]: sqlca: code: 0, state: 00000
87+
[NO_PID]: ecpg_get_data on line 89: RESULT: BINARY offset: -1; array: yes
88+
[NO_PID]: sqlca: code: 0, state: 00000
89+
[NO_PID]: ecpg_execute on line 96: query: close A; with 0 parameter(s) on connection regress1
90+
[NO_PID]: sqlca: code: 0, state: 00000
91+
[NO_PID]: ecpg_execute on line 96: using PQexec
8692
[NO_PID]: sqlca: code: 0, state: 00000
87-
[NO_PID]: ecpg_execute on line 89: OK: CLOSE CURSOR
93+
[NO_PID]: ecpg_execute on line 96: OK: CLOSE CURSOR
8894
[NO_PID]: sqlca: code: 0, state: 00000
8995
[NO_PID]: ecpg_finish: connection regress1 closed
9096
[NO_PID]: sqlca: code: 0, state: 00000

src/interfaces/ecpg/test/sql/binary.pgc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ main (void)
3333
exit (sqlca.sqlcode);
3434
}
3535

36+
EXEC SQL set bytea_output = escape;
37+
if (sqlca.sqlcode)
38+
{
39+
printf ("set bytea_output error = %ld\n", sqlca.sqlcode);
40+
exit (sqlca.sqlcode);
41+
}
42+
3643
EXEC SQL create table empl
3744
(idnum integer, name char (20), accs smallint, byte bytea);
3845
if (sqlca.sqlcode)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy