Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20ba33d

Browse files
author
Michael Meskes
committed
Fixed compiler warnings in test case.
1 parent33803f6 commit20ba33d

File tree

3 files changed

+132
-130
lines changed

3 files changed

+132
-130
lines changed

‎src/interfaces/ecpg/test/compat_oracle/char_array.pgc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
EXEC SQL INCLUDE ../regression;
66

7-
static void warn();
7+
static void warn(void)
8+
{
9+
fprintf(stderr, "Warning: At least one column was truncated\n");
10+
}
811

912
/* Compatible handling of char array to retrieve varchar field to char array
1013
should be fixed-length, blank-padded, then null-terminated.
1114
Conforms to the ANSI Fixed Character type. */
1215

1316
int main() {
1417

15-
ECPGdebug(1, stderr);
16-
EXEC SQL CONNECT TO REGRESSDB1;
17-
1818
EXEC SQL WHENEVER SQLWARNING do warn();
1919
EXEC SQL WHENEVER SQLERROR SQLPRINT;
2020

@@ -27,6 +27,9 @@ int main() {
2727
short bigstr_ind = 0;
2828
EXEC SQL END DECLARE SECTION;
2929

30+
ECPGdebug(1, stderr);
31+
EXEC SQL CONNECT TO REGRESSDB1;
32+
3033
EXEC SQL CREATE TABLE strdbase (strval varchar(10));
3134
EXEC SQL INSERT INTO strdbase values ('');
3235
EXEC SQL INSERT INTO strdbase values ('AB');
@@ -59,8 +62,3 @@ int main() {
5962

6063
return 0;
6164
}
62-
63-
static void warn(void)
64-
{
65-
fprintf(stderr, "Warning: At least one column was truncated\n");
66-
}

‎src/interfaces/ecpg/test/expected/compat_oracle-char_array.c

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@
2222
#line 5 "char_array.pgc"
2323

2424

25-
staticvoidwarn();
25+
staticvoidwarn(void)
26+
{
27+
fprintf(stderr,"Warning: At least one column was truncated\n");
28+
}
2629

2730
/* Compatible handling of char array to retrieve varchar field to char array
2831
should be fixed-length, blank-padded, then null-terminated.
2932
Conforms to the ANSI Fixed Character type. */
3033

3134
intmain() {
3235

33-
ECPGdebug(1,stderr);
34-
{ECPGconnect(__LINE__,3,"ecpg1_regression" ,NULL,NULL ,NULL,0); }
35-
#line 16 "char_array.pgc"
36-
37-
3836
/* exec sql whenever sql_warning do warn ( ) ; */
3937
#line 18 "char_array.pgc"
4038

@@ -65,16 +63,8 @@ int main() {
6563
#line 28 "char_array.pgc"
6664

6765

68-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"create table strdbase ( strval varchar ( 10 ) )",ECPGt_EOIT,ECPGt_EORT);
69-
#line 30 "char_array.pgc"
70-
71-
if (sqlca.sqlwarn[0]=='W')warn ( );
72-
#line 30 "char_array.pgc"
73-
74-
if (sqlca.sqlcode<0)sqlprint();}
75-
#line 30 "char_array.pgc"
76-
77-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( '' )",ECPGt_EOIT,ECPGt_EORT);
66+
ECPGdebug(1,stderr);
67+
{ECPGconnect(__LINE__,3,"ecpg1_regression" ,NULL,NULL ,NULL,0);
7868
#line 31 "char_array.pgc"
7969

8070
if (sqlca.sqlwarn[0]=='W')warn ( );
@@ -83,16 +73,8 @@ if (sqlca.sqlwarn[0] == 'W') warn ( );
8373
if (sqlca.sqlcode<0)sqlprint();}
8474
#line 31 "char_array.pgc"
8575

86-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'AB' )",ECPGt_EOIT,ECPGt_EORT);
87-
#line 32 "char_array.pgc"
88-
89-
if (sqlca.sqlwarn[0]=='W')warn ( );
90-
#line 32 "char_array.pgc"
91-
92-
if (sqlca.sqlcode<0)sqlprint();}
93-
#line 32 "char_array.pgc"
9476

95-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbasevalues ( 'ABCD' )",ECPGt_EOIT,ECPGt_EORT);
77+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"create table strdbase( strval varchar ( 10 ) )",ECPGt_EOIT,ECPGt_EORT);
9678
#line 33 "char_array.pgc"
9779

9880
if (sqlca.sqlwarn[0]=='W')warn ( );
@@ -101,7 +83,7 @@ if (sqlca.sqlwarn[0] == 'W') warn ( );
10183
if (sqlca.sqlcode<0)sqlprint();}
10284
#line 33 "char_array.pgc"
10385

104-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'ABCDE' )",ECPGt_EOIT,ECPGt_EORT);
86+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( '' )",ECPGt_EOIT,ECPGt_EORT);
10587
#line 34 "char_array.pgc"
10688

10789
if (sqlca.sqlwarn[0]=='W')warn ( );
@@ -110,7 +92,7 @@ if (sqlca.sqlwarn[0] == 'W') warn ( );
11092
if (sqlca.sqlcode<0)sqlprint();}
11193
#line 34 "char_array.pgc"
11294

113-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'ABCDEF' )",ECPGt_EOIT,ECPGt_EORT);
95+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'AB' )",ECPGt_EOIT,ECPGt_EORT);
11496
#line 35 "char_array.pgc"
11597

11698
if (sqlca.sqlwarn[0]=='W')warn ( );
@@ -119,7 +101,7 @@ if (sqlca.sqlwarn[0] == 'W') warn ( );
119101
if (sqlca.sqlcode<0)sqlprint();}
120102
#line 35 "char_array.pgc"
121103

122-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'ABCDEFGHIJ' )",ECPGt_EOIT,ECPGt_EORT);
104+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'ABCD' )",ECPGt_EOIT,ECPGt_EORT);
123105
#line 36 "char_array.pgc"
124106

125107
if (sqlca.sqlwarn[0]=='W')warn ( );
@@ -128,11 +110,25 @@ if (sqlca.sqlwarn[0] == 'W') warn ( );
128110
if (sqlca.sqlcode<0)sqlprint();}
129111
#line 36 "char_array.pgc"
130112

113+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'ABCDE' )",ECPGt_EOIT,ECPGt_EORT);
114+
#line 37 "char_array.pgc"
131115

132-
/* declare C cursor for select strval , strval from strdbase */
116+
if (sqlca.sqlwarn[0]=='W')warn ( );
117+
#line 37 "char_array.pgc"
118+
119+
if (sqlca.sqlcode<0)sqlprint();}
120+
#line 37 "char_array.pgc"
121+
122+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'ABCDEF' )",ECPGt_EOIT,ECPGt_EORT);
133123
#line 38 "char_array.pgc"
134124

135-
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"declare C cursor for select strval , strval from strdbase",ECPGt_EOIT,ECPGt_EORT);
125+
if (sqlca.sqlwarn[0]=='W')warn ( );
126+
#line 38 "char_array.pgc"
127+
128+
if (sqlca.sqlcode<0)sqlprint();}
129+
#line 38 "char_array.pgc"
130+
131+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"insert into strdbase values ( 'ABCDEFGHIJ' )",ECPGt_EOIT,ECPGt_EORT);
136132
#line 39 "char_array.pgc"
137133

138134
if (sqlca.sqlwarn[0]=='W')warn ( );
@@ -142,9 +138,22 @@ if (sqlca.sqlcode < 0) sqlprint();}
142138
#line 39 "char_array.pgc"
143139

144140

145-
/*exec sql whenever not found break ; */
141+
/*declare C cursor for select strval , strval from strdbase */
146142
#line 41 "char_array.pgc"
147143

144+
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"declare C cursor for select strval , strval from strdbase",ECPGt_EOIT,ECPGt_EORT);
145+
#line 42 "char_array.pgc"
146+
147+
if (sqlca.sqlwarn[0]=='W')warn ( );
148+
#line 42 "char_array.pgc"
149+
150+
if (sqlca.sqlcode<0)sqlprint();}
151+
#line 42 "char_array.pgc"
152+
153+
154+
/* exec sql whenever not found break ; */
155+
#line 44 "char_array.pgc"
156+
148157

149158
printf("Full Str. : Short Ind.\n");
150159
while(1) {
@@ -155,65 +164,60 @@ if (sqlca.sqlcode < 0) sqlprint();}
155164
ECPGt_short,&(bigstr_ind),(long)1,(long)1,sizeof(short),
156165
ECPGt_char,(shortstr),(long)5,(long)1,(5)*sizeof(char),
157166
ECPGt_short,&(shstr_ind),(long)1,(long)1,sizeof(short),ECPGt_EORT);
158-
#line47 "char_array.pgc"
167+
#line50 "char_array.pgc"
159168

160169
if (sqlca.sqlcode==ECPG_NOT_FOUND)break;
161-
#line47 "char_array.pgc"
170+
#line50 "char_array.pgc"
162171

163172
if (sqlca.sqlwarn[0]=='W')warn ( );
164-
#line47 "char_array.pgc"
173+
#line50 "char_array.pgc"
165174

166175
if (sqlca.sqlcode<0)sqlprint();}
167-
#line47 "char_array.pgc"
176+
#line50 "char_array.pgc"
168177

169178
printf("\"%s\": \"%s\" %d\n",bigstr,shortstr,shstr_ind);
170179
}
171180

172181
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"close cstr",ECPGt_EOIT,ECPGt_EORT);
173-
#line51 "char_array.pgc"
182+
#line54 "char_array.pgc"
174183

175184
if (sqlca.sqlwarn[0]=='W')warn ( );
176-
#line51 "char_array.pgc"
185+
#line54 "char_array.pgc"
177186

178187
if (sqlca.sqlcode<0)sqlprint();}
179-
#line51 "char_array.pgc"
188+
#line54 "char_array.pgc"
180189

181190
{ECPGdo(__LINE__,3,1,NULL,0,ECPGst_normal,"drop table strdbase",ECPGt_EOIT,ECPGt_EORT);
182-
#line52 "char_array.pgc"
191+
#line55 "char_array.pgc"
183192

184193
if (sqlca.sqlwarn[0]=='W')warn ( );
185-
#line52 "char_array.pgc"
194+
#line55 "char_array.pgc"
186195

187196
if (sqlca.sqlcode<0)sqlprint();}
188-
#line52 "char_array.pgc"
197+
#line55 "char_array.pgc"
189198

190199

191200
printf("\nGOOD-BYE!!\n\n");
192201

193202
{ECPGtrans(__LINE__,NULL,"commit work");
194-
#line56 "char_array.pgc"
203+
#line59 "char_array.pgc"
195204

196205
if (sqlca.sqlwarn[0]=='W')warn ( );
197-
#line56 "char_array.pgc"
206+
#line59 "char_array.pgc"
198207

199208
if (sqlca.sqlcode<0)sqlprint();}
200-
#line56 "char_array.pgc"
209+
#line59 "char_array.pgc"
201210

202211

203212
{ECPGdisconnect(__LINE__,"ALL");
204-
#line58 "char_array.pgc"
213+
#line61 "char_array.pgc"
205214

206215
if (sqlca.sqlwarn[0]=='W')warn ( );
207-
#line58 "char_array.pgc"
216+
#line61 "char_array.pgc"
208217

209218
if (sqlca.sqlcode<0)sqlprint();}
210-
#line58 "char_array.pgc"
219+
#line61 "char_array.pgc"
211220

212221

213222
return0;
214223
}
215-
216-
staticvoidwarn(void)
217-
{
218-
fprintf(stderr,"Warning: At least one column was truncated\n");
219-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp