Merge commit 'origin/master'
[versaplex.git] / vxodbc / pgtypes.h
blob83a35d58c3170a05bd8e143d8a99f16c46a44f46
1 /* File: pgtypes.h
3 * Description: See "pgtypes.c"
5 * Comments: See "notice.txt" for copyright and license information.
7 */
9 #ifndef __PGTYPES_H__
10 #define __PGTYPES_H__
12 #include "psqlodbc.h"
14 /* the type numbers are defined by the OID's of the types' rows */
15 /* in table pg_type */
18 #ifdef NOT_USED
19 #define PG_TYPE_LO ???? /* waiting for permanent type */
20 #endif
22 #define MS_ACCESS_SERIAL "int identity"
23 #define PG_TYPE_BOOL 16
24 #define PG_TYPE_BYTEA 17
25 #define PG_TYPE_CHAR 18
26 #define PG_TYPE_NAME 19
27 #define PG_TYPE_INT8 20
28 #define PG_TYPE_INT2 21
29 #define PG_TYPE_INT2VECTOR 22
30 #define PG_TYPE_INT4 23
31 #define PG_TYPE_REGPROC 24
32 #define PG_TYPE_TEXT 25
33 #define PG_TYPE_OID 26
34 #define PG_TYPE_TID 27
35 #define PG_TYPE_XID 28
36 #define PG_TYPE_CID 29
37 #define PG_TYPE_OIDVECTOR 30
38 #define PG_TYPE_SET 32
39 #define PG_TYPE_CHAR2 409
40 #define PG_TYPE_CHAR4 410
41 #define PG_TYPE_CHAR8 411
42 #define PG_TYPE_POINT 600
43 #define PG_TYPE_LSEG 601
44 #define PG_TYPE_PATH 602
45 #define PG_TYPE_BOX 603
46 #define PG_TYPE_POLYGON 604
47 #define PG_TYPE_FILENAME 605
48 #define PG_TYPE_FLOAT4 700
49 #define PG_TYPE_FLOAT8 701
50 #define PG_TYPE_RELTIME 703
51 #define PG_TYPE_TINTERVAL 704
52 #define PG_TYPE_UNKNOWN 705
53 #define PG_TYPE_MONEY 790
54 #define PG_TYPE_OIDINT2 810
55 #define PG_TYPE_OIDINT4 910
56 #define PG_TYPE_OIDNAME 911
57 #define PG_TYPE_TEXTARRAY 1009
58 #define PG_TYPE_BPCHARARRAY 1014
59 #define PG_TYPE_VARCHARARRAY 1015
60 #define PG_TYPE_BPCHAR 1042
61 #define PG_TYPE_VARCHAR 1043
62 #define PG_TYPE_DATE 1082
63 #define PG_TYPE_TIME 1083
64 #define PG_TYPE_NUMERIC 1700
65 #define PG_TYPE_RECORD 2249
66 #define PG_TYPE_VOID 2278
67 #define VX_TYPE_DATETIME 3000
68 #define INTERNAL_ASIS_TYPE (-9999)
70 /* extern Int4 pgtypes_defined[]; */
71 extern SQLSMALLINT sqlTypes[];
73 /* Defines for pgtype_precision */
74 #define PG_STATIC (-1)
76 OID sqltype_to_pgtype(StatementClass *stmt, SQLSMALLINT fSqlType);
78 SQLSMALLINT pgtype_to_concise_type(StatementClass *stmt, OID type, int col);
79 SQLSMALLINT pgtype_to_sqldesctype(StatementClass *stmt, OID type, int col);
80 SQLSMALLINT pgtype_to_datetime_sub(StatementClass *stmt, OID type);
81 SQLSMALLINT pgtype_to_ctype(StatementClass *stmt, OID type);
82 const char *pgtype_to_name(StatementClass *stmt, OID type, BOOL auto_increment);
84 /* These functions can use static numbers or result sets(col parameter) */
85 Int4 pgtype_column_size(StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* corresponds to "precision" in ODBC 2.x */
86 SQLSMALLINT pgtype_precision(StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* "precsion in ODBC 3.x */
87 /* the following size/length are of Int4 due to PG restriction */
88 Int4 pgtype_display_size(StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
89 Int4 pgtype_buffer_length(StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
90 Int4 pgtype_desclength(StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
91 Int4 pgtype_transfer_octet_length(StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
93 SQLSMALLINT pgtype_decimal_digits(StatementClass *stmt, OID type, int col); /* corresponds to "scale" in ODBC 2.x */
94 SQLSMALLINT pgtype_min_decimal_digits(StatementClass *stmt, OID type); /* corresponds to "min_scale" in ODBC 2.x */
95 SQLSMALLINT pgtype_max_decimal_digits(StatementClass *stmt, OID type); /* corresponds to "max_scale" in ODBC 2.x */
96 SQLSMALLINT pgtype_scale(StatementClass *stmt, OID type, int col); /* ODBC 3.x " */
97 Int2 pgtype_radix(StatementClass *stmt, OID type);
98 Int2 pgtype_nullable(StatementClass *stmt, OID type);
99 Int2 pgtype_auto_increment(StatementClass *stmt, OID type);
100 Int2 pgtype_case_sensitive(StatementClass *stmt, OID type);
101 Int2 pgtype_money(StatementClass *stmt, OID type);
102 Int2 pgtype_searchable(StatementClass *stmt, OID type);
103 Int2 pgtype_unsigned(StatementClass *stmt, OID type);
104 char *pgtype_literal_prefix(StatementClass *stmt, OID type);
105 char *pgtype_literal_suffix(StatementClass *stmt, OID type);
106 char *pgtype_create_params(StatementClass *stmt, OID type);
108 SQLSMALLINT sqltype_to_default_ctype(const ConnectionClass *stmt, SQLSMALLINT sqltype);
109 Int4 ctype_length(SQLSMALLINT ctype);
111 #define USE_ZONE FALSE
112 #endif