00001
00002
00003 #include <ecpglib.h>
00004 #include <ecpgerrno.h>
00005 #include <sqlca.h>
00006
00007 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
00008
00009 #line 1 "define.pgc"
00010
00011 #line 1 "sqlca.h"
00012 #ifndef POSTGRES_SQLCA_H
00013 #define POSTGRES_SQLCA_H
00014
00015 #ifndef PGDLLIMPORT
00016 #if defined(WIN32) || defined(__CYGWIN__)
00017 #define PGDLLIMPORT __declspec (dllimport)
00018 #else
00019 #define PGDLLIMPORT
00020 #endif
00021 #endif
00022
00023 #define SQLERRMC_LEN 150
00024
00025 #ifdef __cplusplus
00026 extern "C"
00027 {
00028 #endif
00029
00030 struct sqlca_t
00031 {
00032 char sqlcaid[8];
00033 long sqlabc;
00034 long sqlcode;
00035 struct
00036 {
00037 int sqlerrml;
00038 char sqlerrmc[SQLERRMC_LEN];
00039 } sqlerrm;
00040 char sqlerrp[8];
00041 long sqlerrd[6];
00042
00043
00044
00045
00046
00047
00048
00049
00050 char sqlwarn[8];
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 char sqlstate[5];
00065 };
00066
00067 struct sqlca_t *ECPGget_sqlca(void);
00068
00069 #ifndef POSTGRES_ECPG_INTERNAL
00070 #define sqlca (*ECPGget_sqlca())
00071 #endif
00072
00073 #ifdef __cplusplus
00074 }
00075 #endif
00076
00077 #endif
00078
00079 #line 1 "define.pgc"
00080
00081
00082 #line 1 "regression.h"
00083
00084
00085
00086
00087
00088
00089 #line 2 "define.pgc"
00090
00091
00092
00093
00094
00095 int main(void)
00096 {
00097
00098
00099
00100
00101 #line 10 "define.pgc"
00102 int i ;
00103
00104 #line 11 "define.pgc"
00105 char s [ 200 ] ;
00106
00107 #line 12 "define.pgc"
00108
00109
00110 ECPGdebug(1, stderr);
00111
00112
00113 #line 16 "define.pgc"
00114
00115 { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0);
00116 #line 17 "define.pgc"
00117
00118 if (sqlca.sqlcode < 0) sqlprint ( );}
00119 #line 17 "define.pgc"
00120
00121
00122 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( a int , b text )", ECPGt_EOIT, ECPGt_EORT);
00123 #line 19 "define.pgc"
00124
00125 if (sqlca.sqlcode < 0) sqlprint ( );}
00126 #line 19 "define.pgc"
00127
00128 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 29 , 'abcdef' )", ECPGt_EOIT, ECPGt_EORT);
00129 #line 20 "define.pgc"
00130
00131 if (sqlca.sqlcode < 0) sqlprint ( );}
00132 #line 20 "define.pgc"
00133
00134
00135
00136 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , 'defined' )", ECPGt_EOIT, ECPGt_EORT);
00137 #line 23 "define.pgc"
00138
00139 if (sqlca.sqlcode < 0) sqlprint ( );}
00140 #line 23 "define.pgc"
00141
00142
00143
00144
00145
00146
00147
00148
00149 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , 'someothervar not defined' )", ECPGt_EOIT, ECPGt_EORT);
00150 #line 31 "define.pgc"
00151
00152 if (sqlca.sqlcode < 0) sqlprint ( );}
00153 #line 31 "define.pgc"
00154
00155
00156
00157
00158
00159 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 1 , 29 :: text || '-' || 'abcdef'", ECPGt_EOIT,
00160 ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
00161 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
00162 ECPGt_char,(s),(long)200,(long)1,(200)*sizeof(char),
00163 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
00164 #line 36 "define.pgc"
00165
00166 if (sqlca.sqlcode < 0) sqlprint ( );}
00167 #line 36 "define.pgc"
00168
00169
00170 printf("i: %d, s: %s\n", i, s);
00171
00172
00173
00174 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 29 , 'no string' )", ECPGt_EOIT, ECPGt_EORT);
00175 #line 42 "define.pgc"
00176
00177 if (sqlca.sqlcode < 0) sqlprint ( );}
00178 #line 42 "define.pgc"
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set TIMEZONE to 'UTC'", ECPGt_EOIT, ECPGt_EORT);
00191 #line 53 "define.pgc"
00192
00193 if (sqlca.sqlcode < 0) sqlprint ( );}
00194 #line 53 "define.pgc"
00195
00196
00197
00198 { ECPGdisconnect(__LINE__, "CURRENT");
00199 #line 56 "define.pgc"
00200
00201 if (sqlca.sqlcode < 0) sqlprint ( );}
00202 #line 56 "define.pgc"
00203
00204 return 0;
00205 }