OSDN Git Service

d8e2807bb1f808796cd3cbf212dc02193f35f452
[pg-rex/syncrep.git] / 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  * Simle 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 #ifdef __cplusplus
31 extern          "C"
32 {
33 #endif
34
35         enum ECPGttype
36         {
37                 ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short,
38                 ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long,
39                 ECPGt_bool,
40                 ECPGt_float, ECPGt_double,
41                 ECPGt_varchar, ECPGt_varchar2,
42                 ECPGt_array,
43                 ECPGt_struct,
44                 ECPGt_union,
45                 ECPGt_char_variable,
46                 ECPGt_EOIT,                             /* End of insert types. */
47                 ECPGt_EORT,                             /* End of result types. */
48                 ECPGt_NO_INDICATOR,             /* no indicator */
49                 ECPGt_long_long, ECPGt_unsigned_long_long,
50                 ECPGt_descriptor                /* sql descriptor, no C variable */
51         };
52
53         /* descriptor items */
54         enum ECPGdtype
55         {
56                 ECPGd_count = 1,
57                 ECPGd_data,
58                 ECPGd_di_code,
59                 ECPGd_di_precision,
60                 ECPGd_indicator,
61                 ECPGd_key_member,
62                 ECPGd_length,
63                 ECPGd_name,
64                 ECPGd_nullable,
65                 ECPGd_octet,
66                 ECPGd_precision,
67                 ECPGd_ret_length,
68                 ECPGd_ret_octet,
69                 ECPGd_scale,
70                 ECPGd_type,
71                 ECPGd_EODT,                             /* End of descriptor types. */
72                 ECPGd_cardinality
73         };
74
75 #define IS_SIMPLE_TYPE(type) (((type) >= ECPGt_char && (type) <= ECPGt_varchar2) || ((type)>=ECPGt_long_long && (type) <= ECPGt_unsigned_long_long))
76
77 #ifdef __cplusplus
78 }
79
80 #endif