diff options
author | Michael Meskes <meskes@postgresql.org> | 2012-02-17 14:53:22 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2012-02-18 14:18:16 +0100 |
commit | 5e7710e725b1d1fe408ac20548d872cc52f7b8ab (patch) | |
tree | 7dcb6f8ed4ea78f3a91628757e48596fac932826 /src/interfaces/ecpg/test | |
parent | 08fd6ff37f71485e2fc04bc6ce07d2a483c36702 (diff) | |
download | postgresql-5e7710e725b1d1fe408ac20548d872cc52f7b8ab.tar.gz postgresql-5e7710e725b1d1fe408ac20548d872cc52f7b8ab.zip |
Make sure all connection paramters are used in call to PQconnectdbParams.
Diffstat (limited to 'src/interfaces/ecpg/test')
4 files changed, 25 insertions, 11 deletions
diff --git a/src/interfaces/ecpg/test/connect/test5.pgc b/src/interfaces/ecpg/test/connect/test5.pgc index c747a5b4371..d3efecbf62b 100644 --- a/src/interfaces/ecpg/test/connect/test5.pgc +++ b/src/interfaces/ecpg/test/connect/test5.pgc @@ -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; diff --git a/src/interfaces/ecpg/test/expected/connect-test1.stderr b/src/interfaces/ecpg/test/expected/connect-test1.stderr index de1bf17121d..e755a0a3458 100644 --- a/src/interfaces/ecpg/test/expected/connect-test1.stderr +++ b/src/interfaces/ecpg/test/expected/connect-test1.stderr @@ -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 diff --git a/src/interfaces/ecpg/test/expected/connect-test5.c b/src/interfaces/ecpg/test/expected/connect-test5.c index 8804eaaf9ec..a8f79f9a950 100644 --- a/src/interfaces/ecpg/test/expected/connect-test5.c +++ b/src/interfaces/ecpg/test/expected/connect-test5.c @@ -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" + { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "connectdb" , NULL , "main", 0); } +#line 62 "test5.pgc" + + { ECPGdisconnect(__LINE__, "main");} +#line 63 "test5.pgc" + + /* connect twice */ { ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "main", 0); } -#line 63 "test5.pgc" +#line 66 "test5.pgc" { ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "main", 0); } -#line 64 "test5.pgc" +#line 67 "test5.pgc" { ECPGdisconnect(__LINE__, "main");} -#line 65 "test5.pgc" +#line 68 "test5.pgc" /* not connected */ { ECPGdisconnect(__LINE__, "nonexistant");} -#line 68 "test5.pgc" +#line 71 "test5.pgc" return (0); diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stderr b/src/interfaces/ecpg/test/expected/connect-test5.stderr index ea6f9e2591c..9b405559847 100644 --- a/src/interfaces/ecpg/test/expected/connect-test5.stderr +++ b/src/interfaces/ecpg/test/expected/connect-test5.stderr @@ -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 |