Line data Source code
1 : /* 2 : * this file just tests the several possibilities you have for a disconnect 3 : */ 4 : 5 : #include <stdlib.h> 6 : #include <string.h> 7 : #include <stdlib.h> 8 : #include <stdio.h> 9 : 10 : exec sql include ../regression; 11 : 12 : int 13 4 : main(void) 14 : { 15 : exec sql begin declare section; 16 : char id[200]; 17 : char res[200]; 18 : exec sql end declare section; 19 : 20 4 : ECPGdebug(1, stderr); 21 : 22 4 : strcpy(id, "first"); 23 4 : exec sql connect to ecpg2_regression as :id; 24 4 : exec sql connect to REGRESSDB1 as second; 25 : 26 : /* this selects from "second" which was opened last */ 27 4 : exec sql select current_database() into :res; 28 : 29 : /* will close "second" */ 30 4 : exec sql disconnect CURRENT; 31 4 : exec sql select current_database() into :res; 32 : 33 4 : exec sql connect to REGRESSDB1 as second; 34 : /* will close "second" */ 35 4 : exec sql disconnect DEFAULT; 36 : 37 4 : exec sql connect to "ecpg2_regression" as second; 38 4 : exec sql disconnect ALL; 39 : 40 4 : exec sql disconnect CURRENT; 41 4 : exec sql disconnect DEFAULT; 42 4 : exec sql disconnect ALL; 43 : 44 : /* 45 : * exec sql disconnect; 46 : * exec sql disconnect name; 47 : * 48 : * are used in other tests 49 : */ 50 : 51 4 : return 0; 52 : }