1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Make sure all connection paramters are used in call to PQconnectdbParams.

This commit is contained in:
Michael Meskes
2012-02-17 14:53:22 +01:00
parent 08fd6ff37f
commit 5e7710e725
5 changed files with 102 additions and 25 deletions

View File

@ -53,6 +53,9 @@ exec sql end declare section;
exec sql connect to 'unix:postgresql://localhost/connectdb' as main user :user;
exec sql disconnect main;
exec sql connect to unix:postgresql://localhost/connectdb?connect_timeout=14&client_encoding=latin1 as main user connectuser;
exec sql disconnect main;
exec sql connect to "unix:postgresql://200.46.204.71/connectdb" as main user connectuser;
exec sql disconnect main;

View File

@ -52,7 +52,7 @@
[NO_PID]: ECPGconnect: opening database connectdb on localhost port <REGRESSION_PORT> for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: could not open database: could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 20?
[NO_PID]: sqlca: code: 0, state: 00000

View File

@ -115,34 +115,41 @@ main(void)
#line 54 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/connectdb" , "connectuser" , NULL , "main", 0); }
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb?connect_timeout=14 & client_encoding=latin1" , "connectuser" , NULL , "main", 0); }
#line 56 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 57 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "connectdb" , NULL , "main", 0); }
{ ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/connectdb" , "connectuser" , NULL , "main", 0); }
#line 59 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 60 "test5.pgc"
/* connect twice */
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "main", 0); }
#line 63 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "main", 0); }
#line 64 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "connectdb" , NULL , "main", 0); }
#line 62 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 65 "test5.pgc"
#line 63 "test5.pgc"
/* connect twice */
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "main", 0); }
#line 66 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "main", 0); }
#line 67 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 68 "test5.pgc"
/* not connected */
{ ECPGdisconnect(__LINE__, "nonexistant");}
#line 68 "test5.pgc"
#line 71 "test5.pgc"
return (0);

View File

@ -46,11 +46,15 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: non-localhost access via sockets on line 56
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> with options connect_timeout=14 & client_encoding=latin1 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -402 on line 56: could not connect to database "connectdb" on line 56
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: non-localhost access via sockets on line 59
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -402 on line 59: could not connect to database "connectdb" on line 59
[NO_PID]: sqlca: code: -402, state: 08001
[NO_PID]: raising sqlcode -220 on line 57: connection "main" does not exist on line 57
[NO_PID]: raising sqlcode -220 on line 60: connection "main" does not exist on line 60
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> for user connectdb
[NO_PID]: sqlca: code: 0, state: 00000
@ -62,5 +66,5 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -220 on line 68: connection "nonexistant" does not exist on line 68
[NO_PID]: raising sqlcode -220 on line 71: connection "nonexistant" does not exist on line 71
[NO_PID]: sqlca: code: -220, state: 08003