Age Owner Branch data TLA Line data Source code
1 : : /*
2 : : * this file tests all sorts of connecting to one single database.
3 : : */
4 : :
5 : : #include <stdlib.h>
6 : : #include <string.h>
7 : : #include <stdlib.h>
8 : : #include <stdio.h>
9 : :
10 : : /* do not include regression.h */
11 : :
12 : : int
6440 meskes@postgresql.or 13 :CBC 1 : main(void)
14 : : {
15 : : exec sql begin declare section;
16 : : char db[200];
17 : : char id[200];
2828 tgl@sss.pgh.pa.us 18 : 1 : char *user="regress_ecpg_user1";
19 : : exec sql end declare section;
20 : :
6440 meskes@postgresql.or 21 : 1 : ECPGdebug(1, stderr);
22 : :
2828 tgl@sss.pgh.pa.us 23 : 1 : exec sql connect to ecpg2_regression as main;
24 : 1 : exec sql alter user regress_ecpg_user2 ENCRYPTED PASSWORD 'insecure';
25 : 1 : exec sql alter user regress_ecpg_user1 ENCRYPTED PASSWORD 'connectpw';
3587 noah@leadboat.com 26 : 1 : exec sql commit;
6440 meskes@postgresql.or 27 : 1 : exec sql disconnect; /* <-- "main" not specified */
28 : :
2828 tgl@sss.pgh.pa.us 29 : 1 : strcpy(db, "ecpg2_regression");
6440 meskes@postgresql.or 30 : 1 : strcpy(id, "main");
31 : 1 : exec sql connect to :db as :id;
32 : 1 : exec sql disconnect :id;
33 : :
2828 tgl@sss.pgh.pa.us 34 : 1 : exec sql connect to ecpg2_regression as main;
6440 meskes@postgresql.or 35 : 1 : exec sql disconnect main;
36 : :
2828 tgl@sss.pgh.pa.us 37 : 1 : exec sql connect to "ecpg2_regression" as main;
6440 meskes@postgresql.or 38 : 1 : exec sql disconnect main;
39 : :
2828 tgl@sss.pgh.pa.us 40 : 1 : exec sql connect to 'ecpg2_regression' as main;
6440 meskes@postgresql.or 41 : 1 : exec sql disconnect main;
42 : :
43 : : /* exec sql connect to as main user regress_ecpg_user2/insecure;
44 : : exec sql disconnect main; */
45 : :
2828 tgl@sss.pgh.pa.us 46 : 1 : exec sql connect to ecpg2_regression as main user regress_ecpg_user1/connectpw;
6440 meskes@postgresql.or 47 : 1 : exec sql disconnect main;
48 : :
2828 tgl@sss.pgh.pa.us 49 : 1 : exec sql connect to unix:postgresql://localhost/ecpg2_regression as main user regress_ecpg_user1/connectpw;
6440 meskes@postgresql.or 50 : 1 : exec sql disconnect main;
51 : :
2828 tgl@sss.pgh.pa.us 52 : 1 : exec sql connect to "unix:postgresql://localhost/ecpg2_regression" as main user regress_ecpg_user1/connectpw;
6440 meskes@postgresql.or 53 : 1 : exec sql disconnect main;
54 : :
2828 tgl@sss.pgh.pa.us 55 : 1 : exec sql connect to 'unix:postgresql://localhost/ecpg2_regression' as main user :user USING "connectpw";
6440 meskes@postgresql.or 56 : 1 : exec sql disconnect main;
57 : :
402 jdavis@postgresql.or 58 : 1 : exec sql connect to unix:postgresql://localhost/ecpg2_regression?connect_timeout=180&client_encoding=sql_ascii as main user regress_ecpg_user1/connectpw;
4440 meskes@postgresql.or 59 : 1 : exec sql disconnect main;
60 : :
2828 tgl@sss.pgh.pa.us 61 : 1 : exec sql connect to "unix:postgresql://200.46.204.71/ecpg2_regression" as main user regress_ecpg_user1/connectpw;
6440 meskes@postgresql.or 62 : 1 : exec sql disconnect main;
63 : :
1039 tgl@sss.pgh.pa.us 64 : 1 : exec sql connect to "unix:postgresql://localhost/?gssencmode=disable" as main user regress_ecpg_user2 IDENTIFIED BY insecure;
6438 meskes@postgresql.or 65 : 1 : exec sql disconnect main;
66 : :
67 : : /* connect twice */
2828 tgl@sss.pgh.pa.us 68 : 1 : exec sql connect to ecpg2_regression as main;
69 : 1 : exec sql connect to ecpg2_regression as main;
6440 meskes@postgresql.or 70 : 1 : exec sql disconnect main;
71 : :
72 : : /* not connected */
1772 noah@leadboat.com 73 : 1 : exec sql disconnect nonexistent;
74 : :
2432 peter_e@gmx.net 75 : 1 : return 0;
76 : : }
|