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