PostgreSQL Source Code  git master
ecpg_informix.h
Go to the documentation of this file.
1 /*
2  * This file contains stuff needed to be as compatible to Informix as possible.
3  * src/interfaces/ecpg/include/ecpg_informix.h
4  */
5 #ifndef _ECPG_INFORMIX_H
6 #define _ECPG_INFORMIX_H
7 
8 #include <ecpglib.h>
9 #include <pgtypes_date.h>
10 #include <pgtypes_interval.h>
11 #include <pgtypes_numeric.h>
12 #include <pgtypes_timestamp.h>
13 
14 #define SQLNOTFOUND 100
15 
16 #define ECPG_INFORMIX_NUM_OVERFLOW -1200
17 #define ECPG_INFORMIX_NUM_UNDERFLOW -1201
18 #define ECPG_INFORMIX_DIVIDE_ZERO -1202
19 #define ECPG_INFORMIX_BAD_YEAR -1204
20 #define ECPG_INFORMIX_BAD_MONTH -1205
21 #define ECPG_INFORMIX_BAD_DAY -1206
22 #define ECPG_INFORMIX_ENOSHORTDATE -1209
23 #define ECPG_INFORMIX_DATE_CONVERT -1210
24 #define ECPG_INFORMIX_OUT_OF_MEMORY -1211
25 #define ECPG_INFORMIX_ENOTDMY -1212
26 #define ECPG_INFORMIX_BAD_NUMERIC -1213
27 #define ECPG_INFORMIX_BAD_EXPONENT -1216
28 #define ECPG_INFORMIX_BAD_DATE -1218
29 #define ECPG_INFORMIX_EXTRA_CHARS -1264
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 extern int rdatestr(date d, char *str);
37 extern void rtoday(date * d);
38 extern int rjulmdy(date d, short *mdy);
39 extern int rdefmtdate(date * d, const char *fmt, const char *str);
40 extern int rfmtdate(date d, const char *fmt, char *str);
41 extern int rmdyjul(short *mdy, date * d);
42 extern int rstrdate(const char *str, date * d);
43 extern int rdayofweek(date d);
44 
45 extern int rfmtlong(long lng_val, const char *fmt, char *outbuf);
46 extern int rgetmsg(int msgnum, char *s, int maxsize);
47 extern int risnull(int t, const char *ptr);
48 extern int rsetnull(int t, char *ptr);
49 extern int rtypalign(int offset, int type);
50 extern int rtypmsize(int type, int len);
51 extern int rtypwidth(int sqltype, int sqllen);
52 extern void rupshift(char *str);
53 
54 extern int byleng(char *str, int len);
55 extern void ldchar(char *src, int len, char *dest);
56 
57 extern void ECPG_informix_set_var(int number, void *pointer, int lineno);
58 extern void *ECPG_informix_get_var(int number);
59 extern void ECPG_informix_reset_sqlca(void);
60 
61 /* Informix defines these in decimal.h */
62 int decadd(decimal *arg1, decimal *arg2, decimal *sum);
63 int deccmp(decimal *arg1, decimal *arg2);
64 void deccopy(decimal *src, decimal *target);
65 int deccvasc(const char *cp, int len, decimal *np);
66 int deccvdbl(double dbl, decimal *np);
67 int deccvint(int in, decimal *np);
68 int deccvlong(long lng, decimal *np);
69 int decdiv(decimal *n1, decimal *n2, decimal *result);
70 int decmul(decimal *n1, decimal *n2, decimal *result);
71 int decsub(decimal *n1, decimal *n2, decimal *result);
72 int dectoasc(decimal *np, char *cp, int len, int right);
73 int dectodbl(decimal *np, double *dblp);
74 int dectoint(decimal *np, int *ip);
75 int dectolong(decimal *np, long *lngp);
76 
77 /* Informix defines these in datetime.h */
78 extern void dtcurrent(timestamp * ts);
79 extern int dtcvasc(char *str, timestamp * ts);
80 extern int dtsub(timestamp * ts1, timestamp * ts2, interval * iv);
81 extern int dttoasc(timestamp * ts, char *output);
82 extern int dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr);
83 extern int intoasc(interval * i, char *str);
84 extern int dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* ndef _ECPG_INFORMIX_H */
int deccvasc(const char *cp, int len, decimal *np)
Definition: informix.c:179
int rstrdate(const char *str, date *d)
Definition: informix.c:510
int dttofmtasc(timestamp *ts, char *output, int str_len, char *fmtstr)
Definition: informix.c:647
int decadd(decimal *arg1, decimal *arg2, decimal *sum)
Definition: informix.c:151
int rtypwidth(int sqltype, int sqllen)
Definition: informix.c:992
void ldchar(char *src, int len, char *dest)
Definition: informix.c:958
int rdatestr(date d, char *str)
Definition: informix.c:489
int dtsub(timestamp *ts1, timestamp *ts2, interval *iv)
Definition: informix.c:631
int rfmtlong(long lng_val, const char *fmt, char *outbuf)
Definition: informix.c:749
int deccvlong(long lng, decimal *np)
Definition: informix.c:271
int rtypalign(int offset, int type)
Definition: informix.c:976
int deccvint(int in, decimal *np)
Definition: informix.c:249
int rjulmdy(date d, short *mdy)
Definition: informix.c:522
int dectoasc(decimal *np, char *cp, int len, int right)
Definition: informix.c:362
int dectoint(decimal *np, int *ip)
Definition: informix.c:434
void rupshift(char *str)
Definition: informix.c:943
int dtcvfmtasc(char *inbuf, char *fmtstr, timestamp *dtvalue)
Definition: informix.c:625
int dtcvasc(char *str, timestamp *ts)
Definition: informix.c:599
int decmul(decimal *n1, decimal *n2, decimal *result)
Definition: informix.c:318
int risnull(int t, const char *ptr)
Definition: informix.c:1030
int byleng(char *str, int len)
Definition: informix.c:951
void ECPG_informix_reset_sqlca(void)
Definition: informix.c:1012
int rmdyjul(short *mdy, date *d)
Definition: informix.c:573
void ECPG_informix_set_var(int number, void *pointer, int lineno)
Definition: informix.c:1000
int rdayofweek(date d)
Definition: informix.c:585
int rfmtdate(date d, const char *fmt, char *str)
Definition: informix.c:560
int decsub(decimal *n1, decimal *n2, decimal *result)
Definition: informix.c:340
int dectolong(decimal *np, long *lngp)
Definition: informix.c:461
int deccvdbl(double dbl, decimal *np)
Definition: informix.c:227
int rtypmsize(int type, int len)
Definition: informix.c:984
int deccmp(decimal *arg1, decimal *arg2)
Definition: informix.c:167
int decdiv(decimal *n1, decimal *n2, decimal *result)
Definition: informix.c:293
int dttoasc(timestamp *ts, char *output)
Definition: informix.c:637
int rsetnull(int t, char *ptr)
Definition: informix.c:1023
void * ECPG_informix_get_var(int number)
Definition: informix.c:1006
void rtoday(date *d)
Definition: informix.c:516
int rgetmsg(int msgnum, char *s, int maxsize)
Definition: informix.c:967
void dtcurrent(timestamp *ts)
Definition: informix.c:593
int rdefmtdate(date *d, const char *fmt, const char *str)
Definition: informix.c:534
int dectodbl(decimal *np, double *dblp)
Definition: informix.c:413
void deccopy(decimal *src, decimal *target)
Definition: informix.c:173
int intoasc(interval *i, char *str)
Definition: informix.c:653
const char * str
FILE * output
int i
Definition: isn.c:73
static void const char * fmt
const void size_t len
long date
Definition: pgtypes_date.h:9
int64 timestamp
static void fmtstr(const char *value, int leftjust, int minlen, int maxwidth, int pointflag, PrintfTarget *target)
Definition: snprintf.c:967
const char * type