~ubuntu-branches/ubuntu/trusty/psqlodbc/trusty-proposed

« back to all changes in this revision

Viewing changes to pgtypes.h

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-10-24 07:21:55 UTC
  • mfrom: (16.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131024072155-xlf5odyk3iblcd51
Tags: 1:09.02.0100-2ubuntu1
* Merge with Debian unstable. Remaining Ubuntu changes:
  - debian/tests: Disable iodbc test and dependency, as in Ubuntu iodbc and
    unixodbc are not installable in parallel, and iodbc is obsolete and
    should be removed at some point.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* File:                        pgtypes.h
2
 
 *
3
 
 * Description:         See "pgtypes.c"
4
 
 *
5
 
 * Comments:            See "notice.txt" for copyright and license information.
6
 
 *
7
 
 */
8
 
 
9
 
#ifndef __PGTYPES_H__
10
 
#define __PGTYPES_H__
11
 
 
12
 
#include "psqlodbc.h"
13
 
 
14
 
/* the type numbers are defined by the OID's of the types' rows */
15
 
/* in table pg_type */
16
 
 
17
 
 
18
 
#ifdef NOT_USED
19
 
#define PG_TYPE_LO                              ????    /* waiting for permanent type */
20
 
#endif
21
 
 
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_XML                     142
40
 
#define PG_TYPE_XMLARRAY                143
41
 
#define PG_TYPE_CHAR2                   409
42
 
#define PG_TYPE_CHAR4                   410
43
 
#define PG_TYPE_CHAR8                   411
44
 
#define PG_TYPE_POINT                   600
45
 
#define PG_TYPE_LSEG                    601
46
 
#define PG_TYPE_PATH                    602
47
 
#define PG_TYPE_BOX                             603
48
 
#define PG_TYPE_POLYGON                 604
49
 
#define PG_TYPE_FILENAME                605
50
 
#define PG_TYPE_CIDR                    650
51
 
#define PG_TYPE_FLOAT4                  700
52
 
#define PG_TYPE_FLOAT8                  701
53
 
#define PG_TYPE_ABSTIME                 702
54
 
#define PG_TYPE_RELTIME                 703
55
 
#define PG_TYPE_TINTERVAL               704
56
 
#define PG_TYPE_UNKNOWN                 705
57
 
#define PG_TYPE_MONEY                   790
58
 
#define PG_TYPE_OIDINT2                 810
59
 
#define PG_TYPE_MACADDR                 829
60
 
#define PG_TYPE_INET                    869
61
 
#define PG_TYPE_OIDINT4                 910
62
 
#define PG_TYPE_OIDNAME                 911
63
 
#define PG_TYPE_TEXTARRAY               1009
64
 
#define PG_TYPE_BPCHARARRAY             1014
65
 
#define PG_TYPE_VARCHARARRAY            1015
66
 
#define PG_TYPE_BPCHAR                  1042
67
 
#define PG_TYPE_VARCHAR                 1043
68
 
#define PG_TYPE_DATE                    1082
69
 
#define PG_TYPE_TIME                    1083
70
 
#define PG_TYPE_TIMESTAMP_NO_TMZONE     1114            /* since 7.2 */
71
 
#define PG_TYPE_DATETIME                1184
72
 
#define PG_TYPE_INTERVAL                1186
73
 
#define PG_TYPE_TIME_WITH_TMZONE        1266            /* since 7.1 */
74
 
#define PG_TYPE_TIMESTAMP               1296    /* deprecated since 7.0 */
75
 
#define PG_TYPE_BIT                     1560
76
 
#define PG_TYPE_NUMERIC                 1700
77
 
#define PG_TYPE_REFCURSOR               1790
78
 
#define PG_TYPE_RECORD                  2249
79
 
#define PG_TYPE_VOID                    2278
80
 
#define PG_TYPE_UUID                    2950
81
 
#define INTERNAL_ASIS_TYPE              (-9999)
82
 
 
83
 
#define TYPE_MAY_BE_ARRAY(type) ((type) == PG_TYPE_XMLARRAY || ((type) >= 1000 && (type) <= 1041)) 
84
 
/* extern Int4 pgtypes_defined[]; */
85
 
extern SQLSMALLINT sqlTypes[];
86
 
 
87
 
/*      Defines for pgtype_precision */
88
 
#define PG_STATIC                               (-1)
89
 
#define PG_UNSPECIFIED                          (-1)
90
 
#define PG_WIDTH_OF_BOOLS_AS_CHAR               5
91
 
 
92
 
#if (ODBCVER >= 0x0300)
93
 
/* 
94
 
 *      SQL_INTERVAL support is disabled because I found
95
 
 *      some applications which are unhappy with it.
96
 
 *
97
 
#define PG_INTERVAL_AS_SQL_INTERVAL
98
 
 */
99
 
#endif /* ODBCVER */
100
 
 
101
 
OID             pg_true_type(const ConnectionClass *, OID, OID);
102
 
OID             sqltype_to_pgtype(const ConnectionClass *conn, SQLSMALLINT fSqlType);
103
 
 
104
 
SQLSMALLINT     pgtype_to_concise_type(const StatementClass *stmt, OID type, int col);
105
 
SQLSMALLINT     pgtype_to_sqldesctype(const StatementClass *stmt, OID type, int col);
106
 
SQLSMALLINT     pgtype_to_datetime_sub(const StatementClass *stmt, OID type, int col);
107
 
SQLSMALLINT     pgtype_to_ctype(const StatementClass *stmt, OID type, int col);
108
 
const char      *pgtype_to_name(const StatementClass *stmt, OID type, int col, BOOL auto_increment);
109
 
 
110
 
SQLSMALLINT     pgtype_attr_to_concise_type(const ConnectionClass *conn, OID type, int typmod, int adtsize_or_longestlen);
111
 
SQLSMALLINT     pgtype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int typmod);
112
 
SQLSMALLINT     pgtype_attr_to_datetime_sub(const ConnectionClass *conn, OID type, int typmod);
113
 
SQLSMALLINT     pgtype_attr_to_ctype(const ConnectionClass *conn, OID type, int typmod);
114
 
const char      *pgtype_attr_to_name(const ConnectionClass *conn, OID type, int typmod, BOOL auto_increment);
115
 
Int4            pgtype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longest, int handle_unknown_size_as);
116
 
Int4            pgtype_attr_buffer_length(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as);
117
 
Int4            pgtype_attr_display_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as);
118
 
Int2            pgtype_attr_decimal_digits(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as);
119
 
Int4            pgtype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, int atttypmod, int handle_unknown_size_as);
120
 
 
121
 
/*      These functions can use static numbers or result sets(col parameter) */
122
 
Int4            pgtype_column_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* corresponds to "precision" in ODBC 2.x */
123
 
SQLSMALLINT     pgtype_precision(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* "precsion in ODBC 3.x */
124
 
/* the following size/length are of Int4 due to PG restriction */ 
125
 
Int4            pgtype_display_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
126
 
Int4            pgtype_buffer_length(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
127
 
Int4            pgtype_desclength(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
128
 
// Int4         pgtype_transfer_octet_length(const ConnectionClass *conn, OID type, int column_size);
129
 
 
130
 
SQLSMALLINT     pgtype_decimal_digits(const StatementClass *stmt, OID type, int col); /* corresponds to "scale" in ODBC 2.x */
131
 
SQLSMALLINT     pgtype_min_decimal_digits(const ConnectionClass *conn, OID type); /* corresponds to "min_scale" in ODBC 2.x */
132
 
SQLSMALLINT     pgtype_max_decimal_digits(const ConnectionClass *conn, OID type); /* corresponds to "max_scale" in ODBC 2.x */
133
 
SQLSMALLINT     pgtype_scale(const StatementClass *stmt, OID type, int col); /* ODBC 3.x " */
134
 
Int2            pgtype_radix(const ConnectionClass *conn, OID type);
135
 
Int2            pgtype_nullable(const ConnectionClass *conn, OID type);
136
 
Int2            pgtype_auto_increment(const ConnectionClass *conn, OID type);
137
 
Int2            pgtype_case_sensitive(const ConnectionClass *conn, OID type);
138
 
Int2            pgtype_money(const ConnectionClass *conn, OID type);
139
 
Int2            pgtype_searchable(const ConnectionClass *conn, OID type);
140
 
Int2            pgtype_unsigned(const ConnectionClass *conn, OID type);
141
 
const char      *pgtype_literal_prefix(const ConnectionClass *conn, OID type);
142
 
const char      *pgtype_literal_suffix(const ConnectionClass *conn, OID type);
143
 
const char      *pgtype_create_params(const ConnectionClass *conn, OID type);
144
 
 
145
 
SQLSMALLINT     sqltype_to_default_ctype(const ConnectionClass *stmt, SQLSMALLINT sqltype);
146
 
Int4            ctype_length(SQLSMALLINT ctype);
147
 
 
148
 
#define USE_ZONE        FALSE
149
 
#endif
 
1
/* File:                        pgtypes.h
 
2
 *
 
3
 * Description:         See "pgtypes.c"
 
4
 *
 
5
 * Comments:            See "readme.txt" for copyright and license information.
 
6
 *
 
7
 */
 
8
 
 
9
#ifndef __PGTYPES_H__
 
10
#define __PGTYPES_H__
 
11
 
 
12
#include "psqlodbc.h"
 
13
 
 
14
/* the type numbers are defined by the OID's of the types' rows */
 
15
/* in table pg_type */
 
16
 
 
17
 
 
18
#ifdef NOT_USED
 
19
#define PG_TYPE_LO                              ????    /* waiting for permanent type */
 
20
#endif
 
21
 
 
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_XML                     142
 
40
#define PG_TYPE_XMLARRAY                143
 
41
#define PG_TYPE_CHAR2                   409
 
42
#define PG_TYPE_CHAR4                   410
 
43
#define PG_TYPE_CHAR8                   411
 
44
#define PG_TYPE_POINT                   600
 
45
#define PG_TYPE_LSEG                    601
 
46
#define PG_TYPE_PATH                    602
 
47
#define PG_TYPE_BOX                             603
 
48
#define PG_TYPE_POLYGON                 604
 
49
#define PG_TYPE_FILENAME                605
 
50
#define PG_TYPE_CIDR                    650
 
51
#define PG_TYPE_FLOAT4                  700
 
52
#define PG_TYPE_FLOAT8                  701
 
53
#define PG_TYPE_ABSTIME                 702
 
54
#define PG_TYPE_RELTIME                 703
 
55
#define PG_TYPE_TINTERVAL               704
 
56
#define PG_TYPE_UNKNOWN                 705
 
57
#define PG_TYPE_MONEY                   790
 
58
#define PG_TYPE_OIDINT2                 810
 
59
#define PG_TYPE_MACADDR                 829
 
60
#define PG_TYPE_INET                    869
 
61
#define PG_TYPE_OIDINT4                 910
 
62
#define PG_TYPE_OIDNAME                 911
 
63
#define PG_TYPE_TEXTARRAY               1009
 
64
#define PG_TYPE_BPCHARARRAY             1014
 
65
#define PG_TYPE_VARCHARARRAY            1015
 
66
#define PG_TYPE_BPCHAR                  1042
 
67
#define PG_TYPE_VARCHAR                 1043
 
68
#define PG_TYPE_DATE                    1082
 
69
#define PG_TYPE_TIME                    1083
 
70
#define PG_TYPE_TIMESTAMP_NO_TMZONE     1114            /* since 7.2 */
 
71
#define PG_TYPE_DATETIME                1184
 
72
#define PG_TYPE_INTERVAL                1186
 
73
#define PG_TYPE_TIME_WITH_TMZONE        1266            /* since 7.1 */
 
74
#define PG_TYPE_TIMESTAMP               1296    /* deprecated since 7.0 */
 
75
#define PG_TYPE_BIT                     1560
 
76
#define PG_TYPE_NUMERIC                 1700
 
77
#define PG_TYPE_REFCURSOR               1790
 
78
#define PG_TYPE_RECORD                  2249
 
79
#define PG_TYPE_VOID                    2278
 
80
#define PG_TYPE_UUID                    2950
 
81
#define INTERNAL_ASIS_TYPE              (-9999)
 
82
 
 
83
#define TYPE_MAY_BE_ARRAY(type) ((type) == PG_TYPE_XMLARRAY || ((type) >= 1000 && (type) <= 1041)) 
 
84
/* extern Int4 pgtypes_defined[]; */
 
85
extern SQLSMALLINT sqlTypes[];
 
86
 
 
87
/*      Defines for pgtype_precision */
 
88
#define PG_STATIC                               (-1)
 
89
#define PG_UNSPECIFIED                          (-1)
 
90
#define PG_WIDTH_OF_BOOLS_AS_CHAR               5
 
91
 
 
92
#if (ODBCVER >= 0x0300)
 
93
/* 
 
94
 *      SQL_INTERVAL support is disabled because I found
 
95
 *      some applications which are unhappy with it.
 
96
 *
 
97
#define PG_INTERVAL_AS_SQL_INTERVAL
 
98
 */
 
99
#endif /* ODBCVER */
 
100
 
 
101
OID             pg_true_type(const ConnectionClass *, OID, OID);
 
102
OID             sqltype_to_pgtype(const ConnectionClass *conn, SQLSMALLINT fSqlType);
 
103
 
 
104
SQLSMALLINT     pgtype_to_concise_type(const StatementClass *stmt, OID type, int col);
 
105
SQLSMALLINT     pgtype_to_sqldesctype(const StatementClass *stmt, OID type, int col);
 
106
SQLSMALLINT     pgtype_to_datetime_sub(const StatementClass *stmt, OID type, int col);
 
107
SQLSMALLINT     pgtype_to_ctype(const StatementClass *stmt, OID type, int col);
 
108
const char      *pgtype_to_name(const StatementClass *stmt, OID type, int col, BOOL auto_increment);
 
109
 
 
110
SQLSMALLINT     pgtype_attr_to_concise_type(const ConnectionClass *conn, OID type, int typmod, int adtsize_or_longestlen);
 
111
SQLSMALLINT     pgtype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int typmod);
 
112
SQLSMALLINT     pgtype_attr_to_datetime_sub(const ConnectionClass *conn, OID type, int typmod);
 
113
SQLSMALLINT     pgtype_attr_to_ctype(const ConnectionClass *conn, OID type, int typmod);
 
114
const char      *pgtype_attr_to_name(const ConnectionClass *conn, OID type, int typmod, BOOL auto_increment);
 
115
Int4            pgtype_attr_column_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longest, int handle_unknown_size_as);
 
116
Int4            pgtype_attr_buffer_length(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as);
 
117
Int4            pgtype_attr_display_size(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as);
 
118
Int2            pgtype_attr_decimal_digits(const ConnectionClass *conn, OID type, int atttypmod, int adtsize_or_longestlen, int handle_unknown_size_as);
 
119
Int4            pgtype_attr_transfer_octet_length(const ConnectionClass *conn, OID type, int atttypmod, int handle_unknown_size_as);
 
120
 
 
121
/*      These functions can use static numbers or result sets(col parameter) */
 
122
Int4            pgtype_column_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* corresponds to "precision" in ODBC 2.x */
 
123
SQLSMALLINT     pgtype_precision(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as); /* "precsion in ODBC 3.x */
 
124
/* the following size/length are of Int4 due to PG restriction */ 
 
125
Int4            pgtype_display_size(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
 
126
Int4            pgtype_buffer_length(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
 
127
Int4            pgtype_desclength(const StatementClass *stmt, OID type, int col, int handle_unknown_size_as);
 
128
// Int4         pgtype_transfer_octet_length(const ConnectionClass *conn, OID type, int column_size);
 
129
 
 
130
SQLSMALLINT     pgtype_decimal_digits(const StatementClass *stmt, OID type, int col); /* corresponds to "scale" in ODBC 2.x */
 
131
SQLSMALLINT     pgtype_min_decimal_digits(const ConnectionClass *conn, OID type); /* corresponds to "min_scale" in ODBC 2.x */
 
132
SQLSMALLINT     pgtype_max_decimal_digits(const ConnectionClass *conn, OID type); /* corresponds to "max_scale" in ODBC 2.x */
 
133
SQLSMALLINT     pgtype_scale(const StatementClass *stmt, OID type, int col); /* ODBC 3.x " */
 
134
Int2            pgtype_radix(const ConnectionClass *conn, OID type);
 
135
Int2            pgtype_nullable(const ConnectionClass *conn, OID type);
 
136
Int2            pgtype_auto_increment(const ConnectionClass *conn, OID type);
 
137
Int2            pgtype_case_sensitive(const ConnectionClass *conn, OID type);
 
138
Int2            pgtype_money(const ConnectionClass *conn, OID type);
 
139
Int2            pgtype_searchable(const ConnectionClass *conn, OID type);
 
140
Int2            pgtype_unsigned(const ConnectionClass *conn, OID type);
 
141
const char      *pgtype_literal_prefix(const ConnectionClass *conn, OID type);
 
142
const char      *pgtype_literal_suffix(const ConnectionClass *conn, OID type);
 
143
const char      *pgtype_create_params(const ConnectionClass *conn, OID type);
 
144
 
 
145
SQLSMALLINT     sqltype_to_default_ctype(const ConnectionClass *stmt, SQLSMALLINT sqltype);
 
146
Int4            ctype_length(SQLSMALLINT ctype);
 
147
 
 
148
#define USE_ZONE        FALSE
 
149
#endif