]> granicus.if.org Git - postgresql/blob - src/interfaces/ecpg/include/ecpgtype.h
bd1902a093e32cc1e8f9ec9c95ef93e7448bb7ed
[postgresql] / src / interfaces / ecpg / include / ecpgtype.h
1 /*
2  * This file implements a data structure that is built and maintained by the
3  * preprocessor.
4  *
5  * All types that can be handled for host variable declarations has to
6  * be handled eventually.
7  */
8
9 /*
10  * Here are all the types that we are to handle. Note that it is the type
11  * that is registered and that has nothing whatsoever to do with the storage
12  * class.
13  *
14  * Simple types
15  * integers: char, short, int, long (signed and unsigned)
16  * floats: float, double
17  *
18  * Complex types:
19  * VARCHAR, VARCHAR2 - Strings with length (maxlen is given in the declaration)
20  * Arrays of simple types and of VARCHAR, VARCHAR2 (size given in declaration)
21  * Records build of simple types, arrays and other structs.
22  *
23  * Complicating things:
24  * typedefs and struct names!
25  *
26  * Conclusion:
27  * This is a typically recursive definition. A structure of typed list elements
28  * would probably work fine:
29  */
30
31 #ifndef _ECPGTYPE_H
32 #define _ECPGTYPE_H
33
34 #ifdef __cplusplus
35 extern          "C"
36 {
37 #endif
38
39 enum ECPGttype
40 {
41         ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short,
42         ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long,
43         ECPGt_long_long, ECPGt_unsigned_long_long,
44         ECPGt_bool,
45         ECPGt_float, ECPGt_double,
46         ECPGt_varchar, ECPGt_varchar2,
47         ECPGt_numeric,
48         ECPGt_date,
49         ECPGt_timestamp,
50         ECPGt_interval,
51         ECPGt_array,
52         ECPGt_struct,
53         ECPGt_union,
54         ECPGt_descriptor,               /* sql descriptor, no C variable */
55         ECPGt_char_variable,
56         ECPGt_const,                    /* a constant is needed sometimes */
57         ECPGt_EOIT,                     /* End of insert types. */
58         ECPGt_EORT,                     /* End of result types. */
59         ECPGt_NO_INDICATOR              /* no indicator */
60 };
61
62  /* descriptor items */
63 enum ECPGdtype
64 {
65         ECPGd_count = 1,
66         ECPGd_data,
67         ECPGd_di_code,
68         ECPGd_di_precision,
69         ECPGd_indicator,
70         ECPGd_key_member,
71         ECPGd_length,
72         ECPGd_name,
73         ECPGd_nullable,
74         ECPGd_octet,
75         ECPGd_precision,
76         ECPGd_ret_length,
77         ECPGd_ret_octet,
78         ECPGd_scale,
79         ECPGd_type,
80         ECPGd_EODT,                                     /* End of descriptor types. */
81         ECPGd_cardinality
82 };
83
84 #define IS_SIMPLE_TYPE(type) ((type) >= ECPGt_char && (type) <= ECPGt_interval)
85
86 #ifdef __cplusplus
87 }
88 #endif
89
90 #endif /* _ECPGTYPE_H */