PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
connect-test3.c File Reference
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Include dependency graph for connect-test3.c:

Go to the source code of this file.

Macros

#define ECPGdebug(X, Y)   ECPGdebug((X)+100,(Y))
 

Functions

int main (void)
 

Macro Definition Documentation

◆ ECPGdebug

#define ECPGdebug (   X,
 
)    ECPGdebug((X)+100,(Y))

Definition at line 7 of file connect-test3.c.

Function Documentation

◆ main()

int main ( void  )

Definition at line 31 of file connect-test3.c.

32{
33/* exec sql begin declare section */
34
35
36
37#line 16 "test3.pgc"
38 char id [ 200 ] ;
39
40#line 17 "test3.pgc"
41 char res [ 200 ] ;
42/* exec sql end declare section */
43#line 18 "test3.pgc"
44
45
46 ECPGdebug(1, stderr);
47
48 strcpy(id, "first");
49 { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , id, 0); }
50#line 23 "test3.pgc"
51
52 { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "second", 0); }
53#line 24 "test3.pgc"
54
55
56 /* this selects from "second" which was opened last */
57 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
58 ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
59 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
60#line 27 "test3.pgc"
61
62
63 /* will close "second" */
64 { ECPGdisconnect(__LINE__, "CURRENT");}
65#line 30 "test3.pgc"
66
67 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
68 ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
69 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
70#line 31 "test3.pgc"
71
72
73 { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "second", 0); }
74#line 33 "test3.pgc"
75
76 /* will close "second" */
77 { ECPGdisconnect(__LINE__, "DEFAULT");}
78#line 35 "test3.pgc"
79
80
81 { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "second", 0); }
82#line 37 "test3.pgc"
83
84 { ECPGdisconnect(__LINE__, "ALL");}
85#line 38 "test3.pgc"
86
87
88 { ECPGdisconnect(__LINE__, "CURRENT");}
89#line 40 "test3.pgc"
90
91 { ECPGdisconnect(__LINE__, "DEFAULT");}
92#line 41 "test3.pgc"
93
94 { ECPGdisconnect(__LINE__, "ALL");}
95#line 42 "test3.pgc"
96
97
98 /*
99 * exec sql disconnect;
100 * exec sql disconnect name;
101 *
102 * are used in other tests
103 */
104
105 return 0;
106}
#define ECPGdebug(X, Y)
Definition: connect-test3.c:7
bool ECPGdisconnect(int lineno, const char *connection_name)
Definition: connect.c:676
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
Definition: connect.c:255
@ ECPGst_normal
Definition: ecpgtype.h:97
@ ECPGt_EOIT
Definition: ecpgtype.h:62
@ ECPGt_NO_INDICATOR
Definition: ecpgtype.h:64
@ ECPGt_EORT
Definition: ecpgtype.h:63
@ ECPGt_char
Definition: ecpgtype.h:43
bool ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...)
Definition: execute.c:2275

References ECPGconnect(), ECPGdebug, ECPGdisconnect(), ECPGdo(), ECPGst_normal, ECPGt_char, ECPGt_EOIT, ECPGt_EORT, ECPGt_NO_INDICATOR, and res.