]> granicus.if.org Git - postgresql/blob - src/interfaces/odbc/psqlodbc.h
98fd47205f9cd96c470fd92373369d0933c9ae68
[postgresql] / src / interfaces / odbc / psqlodbc.h
1 /* File:                        psqlodbc.h
2  *
3  * Description:         This file contains defines and declarations that are related to
4  *                                      the entire driver.
5  *
6  * Comments:            See "notice.txt" for copyright and license information.
7  *
8  * $Id: psqlodbc.h,v 1.48 2001/09/08 16:20:16 inoue Exp $
9  *
10  */
11
12 #ifndef __PSQLODBC_H__
13 #define __PSQLODBC_H__
14
15 #ifdef HAVE_CONFIG_H
16 #include "pg_config.h"
17 #endif
18
19 #include <stdio.h>                              /* for FILE* pointers: see GLOBAL_VALUES */
20
21 #ifndef WIN32
22 #define Int4 long int
23 #define UInt4 unsigned int
24 #define Int2 short
25 #define UInt2 unsigned short
26 typedef float SFLOAT;
27 typedef double SDOUBLE;
28
29 #else
30 #define Int4 int
31 #define UInt4 unsigned int
32 #define Int2 short
33 #define UInt2 unsigned short
34 #endif
35
36 typedef UInt4 Oid;
37
38 /* Driver stuff */
39 #define ODBCVER                                         0x0250
40 #define DRIVER_ODBC_VER                         "02.50"
41
42 #define DRIVERNAME                                      "PostgreSQL ODBC"
43 #define DBMS_NAME                                       "PostgreSQL"
44
45 #define POSTGRESDRIVERVERSION           "07.01.0007"
46
47 #ifdef WIN32
48 #define DRIVER_FILE_NAME                        "PSQLODBC.DLL"
49 #else
50 #define DRIVER_FILE_NAME                        "libpsqlodbc.so"
51 #endif
52
53 /* Limits */
54 #ifdef WIN32
55 #define BLCKSZ                                          4096
56 #endif
57
58 #define MAX_MESSAGE_LEN                         65536           /* This puts a limit on
59                                                                                                  * query size but I don't */
60  /* see an easy way round this - DJP 24-1-2001 */
61 #define MAX_CONNECT_STRING                      4096
62 #define ERROR_MSG_LENGTH                        4096
63 #define FETCH_MAX                                       100 /* default number of rows to cache
64                                                                                  * for declare/fetch */
65 #define TUPLE_MALLOC_INC                        100
66 #define SOCK_BUFFER_SIZE                        4096            /* default socket buffer
67                                                                                                  * size */
68 #define MAX_CONNECTIONS                         128 /* conns per environment
69                                                                                  * (arbitrary)  */
70 #define MAX_FIELDS                                      512
71 #define BYTELEN                                         8
72 #define VARHDRSZ                                        sizeof(Int4)
73
74 #define MAX_TABLE_LEN                           32
75 #define MAX_COLUMN_LEN                          32
76 #define MAX_CURSOR_LEN                          32
77
78 /*      Registry length limits */
79 #define LARGE_REGISTRY_LEN                      4096            /* used for special cases */
80 #define MEDIUM_REGISTRY_LEN                     256 /* normal size for
81                                                                                  * user,database,etc. */
82 #define SMALL_REGISTRY_LEN                      10      /* for 1/0 settings */
83
84
85 /*      These prefixes denote system tables */
86 #define POSTGRES_SYS_PREFIX                     "pg_"
87 #define KEYS_TABLE                                      "dd_fkey"
88
89 /*      Info limits */
90 #define MAX_INFO_STRING                         128
91 #define MAX_KEYPARTS                            20
92 #define MAX_KEYLEN                                      512 /* max key of the form
93                                                                                  * "date+outlet+invoice" */
94 #define MAX_ROW_SIZE                            0       /* Unlimited rowsize with the
95                                                                                  * Tuple Toaster */
96 #define MAX_STATEMENT_LEN                       0       /* Unlimited statement size with
97                                                                                  * 7.0 */
98
99 /* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
100 /* Now that's 0, lets use this instead. DJP 24-1-2001 */
101 #define STD_STATEMENT_LEN                       MAX_MESSAGE_LEN
102
103 #define PG62                                            "6.2"           /* "Protocol" key setting
104                                                                                                  * to force Postgres 6.2 */
105 #define PG63                                            "6.3"           /* "Protocol" key setting
106                                                                                                  * to force postgres 6.3 */
107 #define PG64                                            "6.4"
108
109 typedef struct ConnectionClass_ ConnectionClass;
110 typedef struct StatementClass_ StatementClass;
111 typedef struct QResultClass_ QResultClass;
112 typedef struct SocketClass_ SocketClass;
113 typedef struct BindInfoClass_ BindInfoClass;
114 typedef struct ParameterInfoClass_ ParameterInfoClass;
115 typedef struct ColumnInfoClass_ ColumnInfoClass;
116 typedef struct TupleListClass_ TupleListClass;
117 typedef struct EnvironmentClass_ EnvironmentClass;
118 typedef struct TupleNode_ TupleNode;
119 typedef struct TupleField_ TupleField;
120
121 typedef struct col_info COL_INFO;
122 typedef struct lo_arg LO_ARG;
123
124 typedef struct GlobalValues_
125 {
126         int                     fetch_max;
127         int                     socket_buffersize;
128         int                     unknown_sizes;
129         int                     max_varchar_size;
130         int                     max_longvarchar_size;
131         char            debug;
132         char            commlog;
133         char            disable_optimizer;
134         char            ksqo;
135         char            unique_index;
136         char            onlyread;               /* readonly is reserved on Digital C++
137                                                                  * compiler */
138         char            use_declarefetch;
139         char            text_as_longvarchar;
140         char            unknowns_as_longvarchar;
141         char            bools_as_char;
142         char            lie;
143         char            parse;
144         char            cancel_as_freestmt;
145         char            extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
146         char            conn_settings[LARGE_REGISTRY_LEN];
147         char            protocol[SMALL_REGISTRY_LEN];
148 } GLOBAL_VALUES;
149
150 typedef struct StatementOptions_
151 {
152         int                     maxRows;
153         int                     maxLength;
154         int                     rowset_size;
155         int                     keyset_size;
156         int                     cursor_type;
157         int                     scroll_concurrency;
158         int                     retrieve_data;
159         int                     bind_size;              /* size of each structure if using Row
160                                                                  * Binding */
161         int                     use_bookmarks;
162         UInt4                   *rowsFetched;
163         UInt2                   *rowStatusArray;
164         void                    *bookmark_ptr;
165 } StatementOptions;
166
167 /*      Used to pass extra query info to send_query */
168 typedef struct QueryInfo_
169 {
170         int                     row_size;
171         QResultClass *result_in;
172         char       *cursor;
173 } QueryInfo;
174
175 void logs_on_off(int cnopen, int, int);
176
177 #define PG_TYPE_LO                                      (-999)          /* hack until permanent
178                                                                                                  * type available */
179 #define PG_TYPE_LO_NAME                         "lo"
180 #define OID_ATTNUM                                      (-2)            /* the attnum in pg_index
181                                                                                                  * of the oid */
182
183 /* sizes */
184 #define TEXT_FIELD_SIZE                         8190            /* size of text fields
185                                                                                                  * (not including null
186                                                                                                  * term) */
187 #define NAME_FIELD_SIZE                         32      /* size of name fields */
188 #define MAX_VARCHAR_SIZE                        254 /* maximum size of a varchar (not
189                                                                                  * including null term) */
190
191 #define PG_NUMERIC_MAX_PRECISION        1000
192 #define PG_NUMERIC_MAX_SCALE            1000
193
194 #define INFO_INQUIRY_LEN                8192 /* this seems sufficiently big for
195 queries used in info.c inoue 2001/05/17 */
196
197 #include "misc.h"
198
199 #endif