| 1 |
/* Processed by ecpg (regression mode) */ |
| 2 |
/* These include files are added by the preprocessor */ |
| 3 |
#include <ecpglib.h> |
| 4 |
#include <ecpgerrno.h> |
| 5 |
#include <sqlca.h> |
| 6 |
/* End of automatic include section */ |
| 7 |
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y)) |
| 8 |
|
| 9 |
#line 1 "test3.pgc" |
| 10 |
/* |
| 11 |
* this file just tests the several possibilities you have for a disconnect |
| 12 |
*/ |
| 13 |
|
| 14 |
#include <stdlib.h> |
| 15 |
#include <string.h> |
| 16 |
#include <stdlib.h> |
| 17 |
#include <stdio.h> |
| 18 |
|
| 19 |
|
| 20 |
#line 1 "regression.h" |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
#line 10 "test3.pgc" |
| 28 |
|
| 29 |
|
| 30 |
int |
| 31 |
main(void) |
| 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 |
} |