mirror of https://github.com/postgres/postgres
parent
ff4c69e021
commit
fd3ca524eb
@ -1,25 +1,25 @@ |
||||
#define CCHARTYPE 100 |
||||
#define CSHORTTYPE 101 |
||||
#define CINTTYPE 102 |
||||
#define CLONGTYPE 103 |
||||
#define CFLOATTYPE 104 |
||||
#define CDOUBLETYPE 105 |
||||
#define CDECIMALTYPE 107 |
||||
#define CCHARTYPE ECPGt_char |
||||
#define CSHORTTYPE ECPGt_short |
||||
#define CINTTYPE ECPGt_int |
||||
#define CLONGTYPE ECPGt_long |
||||
#define CFLOATTYPE ECPGt_float |
||||
#define CDOUBLETYPE ECPGt_double |
||||
#define CDECIMALTYPE ECPGt_numeric |
||||
#define CFIXCHARTYPE 108 |
||||
#define CSTRINGTYPE 109 |
||||
#define CDATETYPE 110 |
||||
#define CSTRINGTYPE ECPGt_char |
||||
#define CDATETYPE ECPGt_date |
||||
#define CMONEYTYPE 111 |
||||
#define CDTIMETYPE 112 |
||||
#define CLOCATORTYPE 113 |
||||
#define CVCHARTYPE 114 |
||||
#define CVCHARTYPE ECPGt_varchar |
||||
#define CINVTYPE 115 |
||||
#define CFILETYPE 116 |
||||
#define CINT8TYPE 117 |
||||
#define CINT8TYPE ECPGt_long_long |
||||
#define CCOLLTYPE 118 |
||||
#define CLVCHARTYPE 119 |
||||
#define CFIXBINTYPE 120 |
||||
#define CVARBINTYPE 121 |
||||
#define CBOOLTYPE 122 |
||||
#define CBOOLTYPE ECPGt_bool |
||||
#define CROWTYPE 123 |
||||
#define CLVCHARPTRTYPE 124 |
||||
#define CTYPEMAX 25 |
||||
|
||||
@ -0,0 +1,49 @@ |
||||
#include "sqltypes.h" |
||||
|
||||
void openit(void); |
||||
|
||||
int main() |
||||
{ |
||||
$int i = 14; |
||||
$int j; |
||||
FILE *dbgs; |
||||
|
||||
if ((dbgs = fopen("log", "w")) != NULL) |
||||
ECPGdebug(1, dbgs); |
||||
|
||||
$connect to mm; |
||||
|
||||
$create table test(i int primary key, j int); |
||||
|
||||
rsetnull(CINTTYPE, (char *)&j); |
||||
$insert into test (i, j) values (7, :j); |
||||
$insert into test (i, j) values (:i, 1); |
||||
|
||||
$declare c cursor for select * from test where i <= :i; |
||||
openit(); |
||||
|
||||
j=0; |
||||
while (1) |
||||
{ |
||||
$fetch in c into :i, :j; |
||||
if (sqlca.sqlcode == 100) break; |
||||
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode); |
||||
|
||||
if (risnull(CINTTYPE, (char *)&j)) |
||||
printf("%d\n", i); |
||||
else |
||||
printf("%d %d\n", i, j); |
||||
} |
||||
|
||||
$drop table test; |
||||
|
||||
$disconnect; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
void openit(void) |
||||
{ |
||||
$open c; |
||||
} |
||||
|
||||
Loading…
Reference in new issue