]> granicus.if.org Git - postgresql/blob - src/interfaces/ecpg/test/expected/connect-test1.c
Simplified regression handling
[postgresql] / src / interfaces / ecpg / test / expected / connect-test1.c
1 /* Processed by ecpg (regression mode) */
2 /* These include files are added by the preprocessor */
3 #include <ecpgtype.h>
4 #include <ecpglib.h>
5 #include <ecpgerrno.h>
6 #include <sqlca.h>
7 /* End of automatic include section */
8 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
9
10 #line 1 "test1.pgc"
11 /*
12  * this file tests all sorts of connecting to one single database.
13  */
14
15 #include <stdlib.h>
16 #include <string.h>
17 #include <stdlib.h>
18 #include <stdio.h>
19
20 /* do not include regression.h */
21
22 int
23 main(void)
24 {
25 /* exec sql begin declare section */
26          
27          
28
29 #line 16 "test1.pgc"
30  char  db [ 200 ]    ;
31  
32 #line 17 "test1.pgc"
33  char  pw [ 200 ]    ;
34 /* exec sql end declare section */
35 #line 18 "test1.pgc"
36
37
38         ECPGdebug(1, stderr);
39
40         { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
41 #line 22 "test1.pgc"
42
43         { ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser  encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
44 #line 23 "test1.pgc"
45
46         { ECPGdisconnect(__LINE__, "CURRENT");}
47 #line 24 "test1.pgc"
48   /* <-- "main" not specified */
49
50         { ECPGconnect(__LINE__, 0, "connectdb@localhost" , NULL,NULL , "main", 0); }
51 #line 26 "test1.pgc"
52
53         { ECPGdisconnect(__LINE__, "main");}
54 #line 27 "test1.pgc"
55
56
57         { ECPGconnect(__LINE__, 0, "@localhost" , "connectdb" , NULL , "main", 0); }
58 #line 29 "test1.pgc"
59
60         { ECPGdisconnect(__LINE__, "main");}
61 #line 30 "test1.pgc"
62
63
64         { ECPGconnect(__LINE__, 0, "connectdb@localhost:55432" , NULL,NULL , "main", 0); }
65 #line 32 "test1.pgc"
66
67         { ECPGdisconnect(__LINE__, "main");}
68 #line 33 "test1.pgc"
69
70
71         { ECPGconnect(__LINE__, 0, "@localhost:55432" , "connectdb" , NULL , "main", 0); }
72 #line 35 "test1.pgc"
73
74         { ECPGdisconnect(__LINE__, "main");}
75 #line 36 "test1.pgc"
76
77
78         { ECPGconnect(__LINE__, 0, "connectdb:55432" , NULL,NULL , "main", 0); }
79 #line 38 "test1.pgc"
80
81         { ECPGdisconnect(__LINE__, "main");}
82 #line 39 "test1.pgc"
83
84
85         { ECPGconnect(__LINE__, 0, ":55432" , "connectdb" , NULL , "main", 0); }
86 #line 41 "test1.pgc"
87
88         { ECPGdisconnect(__LINE__, "main");}
89 #line 42 "test1.pgc"
90
91
92         { ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
93 #line 44 "test1.pgc"
94
95         { ECPGdisconnect(__LINE__, "CURRENT");}
96 #line 45 "test1.pgc"
97
98
99         { ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/" , "connectdb" , NULL , NULL, 0); }
100 #line 47 "test1.pgc"
101
102         { ECPGdisconnect(__LINE__, "CURRENT");}
103 #line 48 "test1.pgc"
104
105
106         strcpy(pw, "connectpw");
107         strcpy(db, "tcp:postgresql://localhost:55432/connectdb");
108         { ECPGconnect(__LINE__, 0, db , "connectuser" , pw , NULL, 0); }
109 #line 52 "test1.pgc"
110
111         { ECPGdisconnect(__LINE__, "CURRENT");}
112 #line 53 "test1.pgc"
113
114
115         { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
116 #line 55 "test1.pgc"
117
118         { ECPGdisconnect(__LINE__, "CURRENT");}
119 #line 56 "test1.pgc"
120
121
122         { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , NULL , NULL, 0); }
123 #line 58 "test1.pgc"
124
125         { ECPGdisconnect(__LINE__, "CURRENT");}
126 #line 59 "test1.pgc"
127
128
129         /* wrong db */
130         { ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/nonexistant" , "connectuser" , "connectpw" , NULL, 0); }
131 #line 62 "test1.pgc"
132
133         { ECPGdisconnect(__LINE__, "CURRENT");}
134 #line 63 "test1.pgc"
135
136
137         /* wrong port */
138         { ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:20/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
139 #line 66 "test1.pgc"
140
141         /* no disconnect necessary */
142
143         /* wrong password */
144         { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "wrongpw" , NULL, 0); }
145 #line 70 "test1.pgc"
146
147         /* no disconnect necessary */
148
149         return (0);
150 }