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

Commit52a013b

Browse files
author
Michael Meskes
committed
More logic from complex/test* moved to their own testcases.
1 parent893632b commit52a013b

13 files changed

+975
-144
lines changed

‎src/interfaces/ecpg/test/expected/preproc-define.c

Lines changed: 115 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
/* End of automatic include section */
88

99
#line 1 "define.pgc"
10-
#include<stdio.h>
1110
#include<stdlib.h>
11+
#include<string.h>
12+
#include<stdlib.h>
13+
#include<stdio.h>
1214

1315

1416
#line 1 "regression.h"
@@ -18,110 +20,145 @@
1820

1921

2022

21-
#line 4 "define.pgc"
22-
23-
24-
typedeflongmmInteger ;
25-
2623
#line 6 "define.pgc"
2724

28-
#line 6 "define.pgc"
2925

30-
typedefcharmmChar ;
26+
/* exec sql whenever sqlerror sqlprint ; */
27+
#line 8 "define.pgc"
3128

32-
#line 7 "define.pgc"
3329

34-
#line 7 "define.pgc"
3530

36-
typedefshortmmSmallInt ;
3731

38-
#line 8 "define.pgc"
3932

40-
#line 8 "define.pgc"
33+
/* exec sql type intarray is int [ 6 ] */
34+
#line 13 "define.pgc"
4135

36+
typedefintintarray[6];
4237

38+
int
39+
main(void)
40+
{
4341
/* exec sql begin declare section */
44-
4542

46-
47-
48-
43+
typedefcharstring [8 ] ;
4944

50-
structTBempl {
51-
#line 13 "define.pgc"
52-
mmIntegeridnum ;
45+
#line 21 "define.pgc"
46+
47+
48+
49+
5350

54-
#line14 "define.pgc"
55-
mmCharname [21 ] ;
51+
#line22 "define.pgc"
52+
intarrayamount ;
5653

57-
#line 15 "define.pgc"
58-
mmSmallIntaccs ;
59-
} ;/* exec sql end declare section */
60-
#line 17 "define.pgc"
61-
62-
63-
int
64-
main (void)
65-
{
66-
/* exec sql begin declare section */
67-
68-
6954
#line 23 "define.pgc"
70-
structTBemplempl ;
71-
/* exec sql end declare section */
55+
charname [6 ] [8 ] ;
56+
7257
#line 24 "define.pgc"
58+
charletter [6 ] [1 ] ;
59+
60+
#if0
61+
62+
#line 26 "define.pgc"
63+
intnot_used ;
64+
65+
#endif
66+
/* exec sql end declare section */
67+
#line 29 "define.pgc"
7368

69+
inti,j;
7470

75-
ECPGdebug(1,stderr);
71+
ECPGdebug(1,stderr);
7672

77-
empl.idnum=1;
78-
{ECPGconnect(__LINE__,0,"regress1" ,NULL,NULL ,NULL,0); }
79-
#line 29 "define.pgc"
73+
{ECPGconnect(__LINE__,0,"regress1" ,NULL,NULL ,NULL,0);
74+
#line 34 "define.pgc"
75+
76+
if (sqlca.sqlcode<0)sqlprint();}
77+
#line 34 "define.pgc"
8078

81-
if (sqlca.sqlcode)
82-
{
83-
printf ("connect error = %ld\n",sqlca.sqlcode);
84-
exit (sqlca.sqlcode);
85-
}
8679

87-
{ECPGdo(__LINE__,0,1,NULL,"create table empl ( idnum integer , name char ( 20 ) , accs smallint ) ",ECPGt_EOIT,ECPGt_EORT);}
80+
{ECPGdo(__LINE__,0,1,NULL,"create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ",ECPGt_EOIT,ECPGt_EORT);
81+
#line 36 "define.pgc"
82+
83+
if (sqlca.sqlcode<0)sqlprint();}
84+
#line 36 "define.pgc"
85+
86+
{ECPGtrans(__LINE__,NULL,"commit");
8887
#line 37 "define.pgc"
8988

90-
if (sqlca.sqlcode)
91-
{
92-
printf ("create error = %ld\n",sqlca.sqlcode);
93-
exit (sqlca.sqlcode);
94-
}
95-
96-
{ECPGdo(__LINE__,0,1,NULL,"insert into empl values ( 1 , 'first user' , 320 ) ",ECPGt_EOIT,ECPGt_EORT);}
97-
#line 44 "define.pgc"
98-
99-
if (sqlca.sqlcode)
100-
{
101-
printf ("insert error = %ld\n",sqlca.sqlcode);
102-
exit (sqlca.sqlcode);
103-
}
104-
105-
{ECPGdo(__LINE__,0,1,NULL,"select idnum , name , accs from empl where idnum = ? ",
106-
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
107-
ECPGt_NO_INDICATOR,NULL ,0L,0L,0L,ECPGt_EOIT,
108-
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
89+
if (sqlca.sqlcode<0)sqlprint();}
90+
#line 37 "define.pgc"
91+
92+
93+
{ECPGdo(__LINE__,0,1,NULL,"insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) ",ECPGt_EOIT,ECPGt_EORT);
94+
#line 39 "define.pgc"
95+
96+
if (sqlca.sqlcode<0)sqlprint();}
97+
#line 39 "define.pgc"
98+
99+
{ECPGdo(__LINE__,0,1,NULL,"insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) ",ECPGt_EOIT,ECPGt_EORT);
100+
#line 40 "define.pgc"
101+
102+
if (sqlca.sqlcode<0)sqlprint();}
103+
#line 40 "define.pgc"
104+
105+
{ECPGtrans(__LINE__,NULL,"commit");
106+
#line 41 "define.pgc"
107+
108+
if (sqlca.sqlcode<0)sqlprint();}
109+
#line 41 "define.pgc"
110+
111+
112+
{ECPGdo(__LINE__,0,1,NULL,"select * from test ",ECPGt_EOIT,
113+
ECPGt_char,(name),(long)8,(long)6,(8)*sizeof(char),
109114
ECPGt_NO_INDICATOR,NULL ,0L,0L,0L,
110-
ECPGt_char,&(empl.name),(long)21,(long)1,(21)*sizeof(char),
115+
ECPGt_int,(amount),(long)1,(long)6,sizeof(int),
111116
ECPGt_NO_INDICATOR,NULL ,0L,0L,0L,
112-
ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
113-
ECPGt_NO_INDICATOR,NULL ,0L,0L,0L,ECPGt_EORT);}
114-
#line 54 "define.pgc"
117+
ECPGt_char,(letter),(long)1,(long)6,(1)*sizeof(char),
118+
ECPGt_NO_INDICATOR,NULL ,0L,0L,0L,ECPGt_EORT);
119+
#line 43 "define.pgc"
120+
121+
if (sqlca.sqlcode<0)sqlprint();}
122+
#line 43 "define.pgc"
123+
124+
125+
for (i=0,j=sqlca.sqlerrd[2];i<j;i++)
126+
{
127+
/* exec sql begin declare section */
128+
129+
130+
131+
#line 48 "define.pgc"
132+
charn [8 ] ,l=letter [i ] [0 ] ;
133+
134+
#line 49 "define.pgc"
135+
inta=amount [i ] ;
136+
/* exec sql end declare section */
137+
#line 50 "define.pgc"
138+
139+
140+
strncpy(n,name[i],8);
141+
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n",i,n,i,a,i,l);
142+
}
143+
144+
{ECPGdo(__LINE__,0,1,NULL,"drop table test ",ECPGt_EOIT,ECPGt_EORT);
145+
#line 56 "define.pgc"
146+
147+
if (sqlca.sqlcode<0)sqlprint();}
148+
#line 56 "define.pgc"
149+
150+
{ECPGtrans(__LINE__,NULL,"commit");
151+
#line 57 "define.pgc"
152+
153+
if (sqlca.sqlcode<0)sqlprint();}
154+
#line 57 "define.pgc"
155+
156+
{ECPGdisconnect(__LINE__,"CURRENT");
157+
#line 58 "define.pgc"
115158

116-
if (sqlca.sqlcode)
117-
{
118-
printf ("select error = %ld\n",sqlca.sqlcode);
119-
exit (sqlca.sqlcode);
120-
}
121-
printf ("id=%ld name=%s, accs=%d\n",empl.idnum,empl.name,empl.accs);
159+
if (sqlca.sqlcode<0)sqlprint();}
160+
#line 58 "define.pgc"
122161

123-
{ECPGdisconnect(__LINE__,"CURRENT");}
124-
#line 62 "define.pgc"
125162

126-
exit (0);
163+
return (0);
127164
}

‎src/interfaces/ecpg/test/expected/preproc-define.stderr

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,43 @@
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]: ECPGexecute line 36: QUERY: create tableempl (idnum integer , name char ( 20 ) ,accs smallint ) on connection regress1
5+
[NO_PID]: ECPGexecute line 36: QUERY: create tabletest (name char ( 8 ) , amount int ,letter char ( 1 ) ) on connection regress1
66
[NO_PID]: sqlca: code: 0, state: 00000
77
[NO_PID]: ECPGexecute line 36 Ok: CREATE TABLE
88
[NO_PID]: sqlca: code: 0, state: 00000
9-
[NO_PID]:ECPGexecute line44: QUERY: insert into empl values ( 1 , 'first user' , 320 ) onconnection regress1
9+
[NO_PID]:ECPGtrans line37 action = commitconnection = regress1
1010
[NO_PID]: sqlca: code: 0, state: 00000
11-
[NO_PID]: ECPGexecute line44 Ok: INSERT 0 1
11+
[NO_PID]: ECPGexecute line39: QUERY: insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ) on connection regress1
1212
[NO_PID]: sqlca: code: 0, state: 00000
13-
[NO_PID]: ECPGexecute line51: QUERY: select idnum , name , accs from empl where idnum = 1 on connection regress1
13+
[NO_PID]: ECPGexecute line39 Ok: INSERT 0 1
1414
[NO_PID]: sqlca: code: 0, state: 00000
15-
[NO_PID]: ECPGexecute line51: Correctly got 1 tuples with 3 fields
15+
[NO_PID]: ECPGexecute line40: QUERY: insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ) on connection regress1
1616
[NO_PID]: sqlca: code: 0, state: 00000
17-
[NO_PID]:ECPGget_data line51: RESULT: 1 offset: -1 array: Yes
17+
[NO_PID]:ECPGexecute line40 Ok: INSERT 0 1
1818
[NO_PID]: sqlca: code: 0, state: 00000
19-
[NO_PID]:ECPGget_data line51: RESULT: first user offset: -1 array: Yes
19+
[NO_PID]:ECPGtrans line41 action = commit connection = regress1
2020
[NO_PID]: sqlca: code: 0, state: 00000
21-
[NO_PID]: ECPGget_data line 51: RESULT: 320 offset: -1 array: Yes
21+
[NO_PID]: ECPGexecute line 43: QUERY: select * from test on connection regress1
22+
[NO_PID]: sqlca: code: 0, state: 00000
23+
[NO_PID]: ECPGexecute line 43: Correctly got 2 tuples with 3 fields
24+
[NO_PID]: sqlca: code: 0, state: 00000
25+
[NO_PID]: ECPGget_data line 43: RESULT: false offset: -1 array: Yes
26+
[NO_PID]: sqlca: code: 0, state: 00000
27+
[NO_PID]: ECPGget_data line 43: RESULT: true offset: -1 array: Yes
28+
[NO_PID]: sqlca: code: 0, state: 00000
29+
[NO_PID]: ECPGget_data line 43: RESULT: 1 offset: -1 array: Yes
30+
[NO_PID]: sqlca: code: 0, state: 00000
31+
[NO_PID]: ECPGget_data line 43: RESULT: 2 offset: -1 array: Yes
32+
[NO_PID]: sqlca: code: 0, state: 00000
33+
[NO_PID]: ECPGget_data line 43: RESULT: f offset: -1 array: Yes
34+
[NO_PID]: sqlca: code: 0, state: 00000
35+
[NO_PID]: ECPGget_data line 43: RESULT: t offset: -1 array: Yes
36+
[NO_PID]: sqlca: code: 0, state: 00000
37+
[NO_PID]: ECPGexecute line 56: QUERY: drop table test on connection regress1
38+
[NO_PID]: sqlca: code: 0, state: 00000
39+
[NO_PID]: ECPGexecute line 56 Ok: DROP TABLE
40+
[NO_PID]: sqlca: code: 0, state: 00000
41+
[NO_PID]: ECPGtrans line 57 action = commit connection = regress1
2242
[NO_PID]: sqlca: code: 0, state: 00000
2343
[NO_PID]: ecpg_finish: Connection regress1 closed.
2444
[NO_PID]: sqlca: code: 0, state: 00000
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
id=1 name=first user , accs=320
1+
name[0]=false amount[0]=1letter[0]=f
2+
name[1]=true amount[1]=2letter[1]=t

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp