Header And Logo

PostgreSQL
| The world's most advanced open source database.

ecpgtype.h

Go to the documentation of this file.
00001 /*
00002  * This file implements a data structure that is built and maintained by the
00003  * preprocessor.
00004  *
00005  * All types that can be handled for host variable declarations has to
00006  * be handled eventually.
00007  *
00008  * src/interfaces/ecpg/include/ecpgtype.h
00009  */
00010 
00011 /*
00012  * Here are all the types that we are to handle. Note that it is the type
00013  * that is registered and that has nothing whatsoever to do with the storage
00014  * class.
00015  *
00016  * Simple types
00017  * integers: char, short, int, long (signed and unsigned)
00018  * floats: float, double
00019  *
00020  * Complex types:
00021  * VARCHAR, VARCHAR2 - Strings with length (maxlen is given in the declaration)
00022  * Arrays of simple types and of VARCHAR, VARCHAR2 (size given in declaration)
00023  * Records build of simple types, arrays and other structs.
00024  *
00025  * Complicating things:
00026  * typedefs and struct names!
00027  *
00028  * Conclusion:
00029  * This is a typically recursive definition. A structure of typed list elements
00030  * would probably work fine:
00031  */
00032 
00033 #ifndef _ECPGTYPE_H
00034 #define _ECPGTYPE_H
00035 
00036 #ifdef __cplusplus
00037 extern      "C"
00038 {
00039 #endif
00040 
00041 enum ECPGttype
00042 {
00043     ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short,
00044     ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long,
00045     ECPGt_long_long, ECPGt_unsigned_long_long,
00046     ECPGt_bool,
00047     ECPGt_float, ECPGt_double,
00048     ECPGt_varchar, ECPGt_varchar2,
00049     ECPGt_numeric,              /* this is a decimal that stores its digits in
00050                                  * a malloced array */
00051     ECPGt_decimal,              /* this is a decimal that stores its digits in
00052                                  * a fixed array */
00053     ECPGt_date,
00054     ECPGt_timestamp,
00055     ECPGt_interval,
00056     ECPGt_array,
00057     ECPGt_struct,
00058     ECPGt_union,
00059     ECPGt_descriptor,           /* sql descriptor, no C variable */
00060     ECPGt_char_variable,
00061     ECPGt_const,                /* a constant is needed sometimes */
00062     ECPGt_EOIT,                 /* End of insert types. */
00063     ECPGt_EORT,                 /* End of result types. */
00064     ECPGt_NO_INDICATOR,         /* no indicator */
00065     ECPGt_string,               /* trimmed (char *) type */
00066     ECPGt_sqlda                 /* C struct descriptor */
00067 };
00068 
00069  /* descriptor items */
00070 enum ECPGdtype
00071 {
00072     ECPGd_count = 1,
00073     ECPGd_data,
00074     ECPGd_di_code,
00075     ECPGd_di_precision,
00076     ECPGd_indicator,
00077     ECPGd_key_member,
00078     ECPGd_length,
00079     ECPGd_name,
00080     ECPGd_nullable,
00081     ECPGd_octet,
00082     ECPGd_precision,
00083     ECPGd_ret_length,
00084     ECPGd_ret_octet,
00085     ECPGd_scale,
00086     ECPGd_type,
00087     ECPGd_EODT,                 /* End of descriptor types. */
00088     ECPGd_cardinality
00089 };
00090 
00091 #define IS_SIMPLE_TYPE(type) (((type) >= ECPGt_char && (type) <= ECPGt_interval) || ((type) == ECPGt_string))
00092 
00093 /* we also have to handle different statement types */
00094 enum ECPG_statement_type
00095 {
00096     ECPGst_normal,
00097     ECPGst_execute,
00098     ECPGst_exec_immediate,
00099     ECPGst_prepnormal
00100 };
00101 
00102 #ifdef __cplusplus
00103 }
00104 #endif
00105 
00106 #endif   /* _ECPGTYPE_H */