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

Commit2f86ab7

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent79bb263 commit2f86ab7

File tree

5 files changed

+53
-41
lines changed

5 files changed

+53
-41
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,13 @@ Tue, 06 Nov 2007 09:29:22 +0100
22722272
Fri, 21 Dec 2007 15:30:39 +0100
22732273

22742274
- Fixed a few minor glitches pointed out by splint.
2275+
2276+
Fri, 28 Dec 2007 12:15:38 +0100
2277+
2278+
- Applied patch send by ITAGAKI Takahiro
2279+
<itagaki.takahiro@oss.ntt.co.jp> to fix bug in connect statement if
2280+
user name is a variable.
2281+
- Also fixed test case that didn't detect this.
22752282
- Set pgtypes library version to 3.0.
22762283
- Set compat library version to 3.0.
22772284
- Set ecpg library version to 6.0.

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.356 2007/12/21 14:33:20 meskes Exp $*/
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.357 2007/12/28 11:25:21 meskes Exp $*/
22

33
/* Copyright comment*/
44
%{
@@ -5114,7 +5114,7 @@ user_name: RoleId
51145114
{
51155115
if ($1[0] =='\"')
51165116
$$ =$1;
5117-
elseif (strcmp($1," ?")==0)/* variable*/
5117+
elseif ($1[1]=='$')/* variable*/
51185118
{
51195119
enum ECPGttype type = argsinsert->variable->type->type;
51205120

‎src/interfaces/ecpg/test/connect/test5.pgc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ main(void)
1515
exec sql begin declare section;
1616
char db[200];
1717
char id[200];
18+
char *user="connectuser";
1819
exec sql end declare section;
1920

2021
ECPGdebug(1, stderr);
@@ -49,7 +50,7 @@ exec sql end declare section;
4950
exec sql connect to "unix:postgresql://localhost/connectdb" as main user connectuser;
5051
exec sql disconnect main;
5152

52-
exec sql connect to 'unix:postgresql://localhost/connectdb' as main userconnectuser;
53+
exec sql connect to 'unix:postgresql://localhost/connectdb' as main user:user;
5354
exec sql disconnect main;
5455

5556
exec sql connect to "unix:postgresql://200.46.204.71/connectdb" as main user connectuser;

‎src/interfaces/ecpg/test/expected/connect-test5.c

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,121 +25,125 @@ main(void)
2525
/* exec sql begin declare section */
2626

2727

28+
2829

2930
#line 16 "test5.pgc"
3031
chardb [200 ] ;
3132

3233
#line 17 "test5.pgc"
3334
charid [200 ] ;
34-
/* exec sql end declare section */
35+
3536
#line 18 "test5.pgc"
37+
char*user="connectuser" ;
38+
/* exec sql end declare section */
39+
#line 19 "test5.pgc"
3640

3741

3842
ECPGdebug(1,stderr);
3943

4044
{ECPGconnect(__LINE__,0,"connectdb" ,NULL,NULL ,"main",0); }
41-
#line22 "test5.pgc"
45+
#line23 "test5.pgc"
4246

4347
{ECPGdo(__LINE__,0,1,NULL,0,ECPGst_normal,"alter user connectuser encrypted password 'connectpw'",ECPGt_EOIT,ECPGt_EORT);}
44-
#line23 "test5.pgc"
48+
#line24 "test5.pgc"
4549

4650
{ECPGdisconnect(__LINE__,"CURRENT");}
47-
#line24 "test5.pgc"
51+
#line25 "test5.pgc"
4852
/* <-- "main" not specified */
4953

5054
strcpy(db,"connectdb");
5155
strcpy(id,"main");
5256
{ECPGconnect(__LINE__,0,db ,NULL,NULL ,id,0); }
53-
#line28 "test5.pgc"
57+
#line29 "test5.pgc"
5458

5559
{ECPGdisconnect(__LINE__,id);}
56-
#line29 "test5.pgc"
60+
#line30 "test5.pgc"
5761

5862

5963
{ECPGconnect(__LINE__,0,"connectdb" ,NULL,NULL ,"main",0); }
60-
#line31 "test5.pgc"
64+
#line32 "test5.pgc"
6165

6266
{ECPGdisconnect(__LINE__,"main");}
63-
#line32 "test5.pgc"
67+
#line33 "test5.pgc"
6468

6569

6670
{ECPGconnect(__LINE__,0,"connectdb" ,NULL,NULL ,"main",0); }
67-
#line34 "test5.pgc"
71+
#line35 "test5.pgc"
6872

6973
{ECPGdisconnect(__LINE__,"main");}
70-
#line35 "test5.pgc"
74+
#line36 "test5.pgc"
7175

7276

7377
{ECPGconnect(__LINE__,0,"connectdb" ,NULL,NULL ,"main",0); }
74-
#line37 "test5.pgc"
78+
#line38 "test5.pgc"
7579

7680
{ECPGdisconnect(__LINE__,"main");}
77-
#line38 "test5.pgc"
81+
#line39 "test5.pgc"
7882

7983

8084
{ECPGconnect(__LINE__,0,"" ,"connectdb" ,NULL ,"main",0); }
81-
#line40 "test5.pgc"
85+
#line41 "test5.pgc"
8286

8387
{ECPGdisconnect(__LINE__,"main");}
84-
#line41 "test5.pgc"
88+
#line42 "test5.pgc"
8589

8690

8791
{ECPGconnect(__LINE__,0,"connectdb" ,"connectuser" ,"connectdb" ,"main",0); }
88-
#line43 "test5.pgc"
92+
#line44 "test5.pgc"
8993

9094
{ECPGdisconnect(__LINE__,"main");}
91-
#line44 "test5.pgc"
95+
#line45 "test5.pgc"
9296

9397

9498
{ECPGconnect(__LINE__,0,"unix:postgresql://localhost/connectdb" ,"connectuser" ,NULL ,"main",0); }
95-
#line46 "test5.pgc"
99+
#line47 "test5.pgc"
96100

97101
{ECPGdisconnect(__LINE__,"main");}
98-
#line47 "test5.pgc"
102+
#line48 "test5.pgc"
99103

100104

101105
{ECPGconnect(__LINE__,0,"unix:postgresql://localhost/connectdb" ,"connectuser" ,NULL ,"main",0); }
102-
#line49 "test5.pgc"
106+
#line50 "test5.pgc"
103107

104108
{ECPGdisconnect(__LINE__,"main");}
105-
#line50 "test5.pgc"
109+
#line51 "test5.pgc"
106110

107111

108-
{ECPGconnect(__LINE__,0,"unix:postgresql://localhost/connectdb" ,"connectuser" ,NULL ,"main",0); }
109-
#line52 "test5.pgc"
112+
{ECPGconnect(__LINE__,0,"unix:postgresql://localhost/connectdb" ,user ,NULL ,"main",0); }
113+
#line53 "test5.pgc"
110114

111115
{ECPGdisconnect(__LINE__,"main");}
112-
#line53 "test5.pgc"
116+
#line54 "test5.pgc"
113117

114118

115119
{ECPGconnect(__LINE__,0,"unix:postgresql://200.46.204.71/connectdb" ,"connectuser" ,NULL ,"main",0); }
116-
#line55 "test5.pgc"
120+
#line56 "test5.pgc"
117121

118122
{ECPGdisconnect(__LINE__,"main");}
119-
#line56 "test5.pgc"
123+
#line57 "test5.pgc"
120124

121125

122126
{ECPGconnect(__LINE__,0,"unix:postgresql://localhost/" ,"connectdb" ,NULL ,"main",0); }
123-
#line58 "test5.pgc"
127+
#line59 "test5.pgc"
124128

125129
{ECPGdisconnect(__LINE__,"main");}
126-
#line59 "test5.pgc"
130+
#line60 "test5.pgc"
127131

128132

129133
/* connect twice */
130134
{ECPGconnect(__LINE__,0,"connectdb" ,NULL,NULL ,"main",0); }
131-
#line62 "test5.pgc"
135+
#line63 "test5.pgc"
132136

133137
{ECPGconnect(__LINE__,0,"connectdb" ,NULL,NULL ,"main",0); }
134-
#line63 "test5.pgc"
138+
#line64 "test5.pgc"
135139

136140
{ECPGdisconnect(__LINE__,"main");}
137-
#line64 "test5.pgc"
141+
#line65 "test5.pgc"
138142

139143

140144
/* not connected */
141145
{ECPGdisconnect(__LINE__,"nonexistant");}
142-
#line67 "test5.pgc"
146+
#line68 "test5.pgc"
143147

144148

145149
return (0);

‎src/interfaces/ecpg/test/expected/connect-test5.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
[NO_PID]: sqlca: code: 0, state: 00000
33
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
44
[NO_PID]: sqlca: code: 0, state: 00000
5-
[NO_PID]: ecpg_execute line23: QUERY: alter user connectuser encrypted password 'connectpw' with 0 parameter on connection main
5+
[NO_PID]: ecpg_execute line24: QUERY: alter user connectuser encrypted password 'connectpw' with 0 parameter on connection main
66
[NO_PID]: sqlca: code: 0, state: 00000
7-
[NO_PID]: ecpg_execute line23: using PQexec
7+
[NO_PID]: ecpg_execute line24: using PQexec
88
[NO_PID]: sqlca: code: 0, state: 00000
9-
[NO_PID]: ecpg_execute line23 Ok: ALTER ROLE
9+
[NO_PID]: ecpg_execute line24 Ok: ALTER ROLE
1010
[NO_PID]: sqlca: code: 0, state: 00000
1111
[NO_PID]: ecpg_finish: Connection main closed.
1212
[NO_PID]: sqlca: code: 0, state: 00000
@@ -46,11 +46,11 @@
4646
[NO_PID]: sqlca: code: 0, state: 00000
4747
[NO_PID]: ecpg_finish: Connection main closed.
4848
[NO_PID]: sqlca: code: 0, state: 00000
49-
[NO_PID]: ECPGconnect: non-localhost access via sockets in line55
49+
[NO_PID]: ECPGconnect: non-localhost access via sockets in line56
5050
[NO_PID]: sqlca: code: 0, state: 00000
51-
[NO_PID]: raising sqlcode -402 in line55, 'Could not connect to database connectdb in line55.'.
51+
[NO_PID]: raising sqlcode -402 in line56, 'Could not connect to database connectdb in line56.'.
5252
[NO_PID]: sqlca: code: -402, state: 08001
53-
[NO_PID]: raising sqlcode -220 in line56, 'No such connection main in line56.'.
53+
[NO_PID]: raising sqlcode -220 in line57, 'No such connection main in line57.'.
5454
[NO_PID]: sqlca: code: -220, state: 08003
5555
[NO_PID]: ECPGconnect: opening database on <DEFAULT> port <DEFAULT> for user connectdb
5656
[NO_PID]: sqlca: code: 0, state: 00000
@@ -62,5 +62,5 @@
6262
[NO_PID]: sqlca: code: 0, state: 00000
6363
[NO_PID]: ecpg_finish: Connection main closed.
6464
[NO_PID]: sqlca: code: 0, state: 00000
65-
[NO_PID]: raising sqlcode -220 in line67, 'No such connection nonexistant in line67.'.
65+
[NO_PID]: raising sqlcode -220 in line68, 'No such connection nonexistant in line68.'.
6666
[NO_PID]: sqlca: code: -220, state: 08003

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp