3 * Description: This file contains defines and declarations that are related to
6 * Comments: See "notice.txt" for copyright and license information.
8 * $Id: psqlodbc.h,v 1.53 2001/10/28 06:26:14 momjian Exp $
12 #ifndef __PSQLODBC_H__
13 #define __PSQLODBC_H__
16 #include "pg_config.h"
21 #include <stdio.h> /* for FILE* pointers: see GLOBAL_VALUES */
23 /* Must come before sql.h */
25 #define ODBCVER ODBCVER_REP
27 #define ODBCVER 0x0250
28 #endif /* ODBCVER_REP */
31 #if defined(WIN32) || defined(WITH_UNIXODBC) || defined(WITH_IODBC)
42 #elif defined(WITH_UNIXODBC)
44 #elif defined(WITH_IODBC)
45 #include <iodbcinst.h>
52 #define UInt4 unsigned int
54 #define UInt2 unsigned short
56 #if !defined(WITH_UNIXODBC) && !defined(WITH_IODBC)
58 typedef double SDOUBLE;
67 #define UInt4 unsigned int
69 #define UInt2 unsigned short
75 #define stricmp strcasecmp
76 #define strnicmp strncasecmp
80 #define DRIVER_ODBC_VER "02.50"
82 #define DRIVERNAME "PostgreSQL ODBC"
83 #define DBMS_NAME "PostgreSQL"
85 #define POSTGRESDRIVERVERSION "07.01.0008"
88 #define DRIVER_FILE_NAME "PSQLODBC.DLL"
90 #define DRIVER_FILE_NAME "libpsqlodbc.so"
98 #define MAX_MESSAGE_LEN 65536 /* This puts a limit on
99 * query size but I don't */
100 /* see an easy way round this - DJP 24-1-2001 */
101 #define MAX_CONNECT_STRING 4096
102 #define ERROR_MSG_LENGTH 4096
103 #define FETCH_MAX 100 /* default number of rows to cache
104 * for declare/fetch */
105 #define TUPLE_MALLOC_INC 100
106 #define SOCK_BUFFER_SIZE 4096 /* default socket buffer
108 #define MAX_CONNECTIONS 128 /* conns per environment
110 #define MAX_FIELDS 512
112 #define VARHDRSZ sizeof(Int4)
114 #define MAX_TABLE_LEN 32
115 #define MAX_COLUMN_LEN 32
116 #define MAX_CURSOR_LEN 32
118 /* Registry length limits */
119 #define LARGE_REGISTRY_LEN 4096 /* used for special cases */
120 #define MEDIUM_REGISTRY_LEN 256 /* normal size for
121 * user,database,etc. */
122 #define SMALL_REGISTRY_LEN 10 /* for 1/0 settings */
125 /* These prefixes denote system tables */
126 #define POSTGRES_SYS_PREFIX "pg_"
127 #define KEYS_TABLE "dd_fkey"
130 #define MAX_INFO_STRING 128
131 #define MAX_KEYPARTS 20
132 #define MAX_KEYLEN 512 /* max key of the form
133 * "date+outlet+invoice" */
134 #define MAX_ROW_SIZE 0 /* Unlimited rowsize with the
136 #define MAX_STATEMENT_LEN 0 /* Unlimited statement size with
139 /* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
140 /* Now that's 0, lets use this instead. DJP 24-1-2001 */
141 #define STD_STATEMENT_LEN MAX_MESSAGE_LEN
143 #define PG62 "6.2" /* "Protocol" key setting
144 * to force Postgres 6.2 */
145 #define PG63 "6.3" /* "Protocol" key setting
146 * to force postgres 6.3 */
149 typedef struct ConnectionClass_ ConnectionClass;
150 typedef struct StatementClass_ StatementClass;
151 typedef struct QResultClass_ QResultClass;
152 typedef struct SocketClass_ SocketClass;
153 typedef struct BindInfoClass_ BindInfoClass;
154 typedef struct ParameterInfoClass_ ParameterInfoClass;
155 typedef struct ColumnInfoClass_ ColumnInfoClass;
156 typedef struct TupleListClass_ TupleListClass;
157 typedef struct EnvironmentClass_ EnvironmentClass;
158 typedef struct TupleNode_ TupleNode;
159 typedef struct TupleField_ TupleField;
161 typedef struct col_info COL_INFO;
162 typedef struct lo_arg LO_ARG;
164 typedef struct GlobalValues_
167 int socket_buffersize;
169 int max_varchar_size;
170 int max_longvarchar_size;
173 char disable_optimizer;
176 char onlyread; /* readonly is reserved on Digital C++
178 char use_declarefetch;
179 char text_as_longvarchar;
180 char unknowns_as_longvarchar;
184 char cancel_as_freestmt;
185 char extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
186 char conn_settings[LARGE_REGISTRY_LEN];
187 char protocol[SMALL_REGISTRY_LEN];
190 typedef struct StatementOptions_
197 int scroll_concurrency;
199 int bind_size; /* size of each structure if using Row
203 UInt2 *rowStatusArray;
207 /* Used to pass extra query info to send_query */
208 typedef struct QueryInfo_
211 QResultClass *result_in;
215 void logs_on_off(int cnopen, int, int);
217 #define PG_TYPE_LO (-999) /* hack until permanent
219 #define PG_TYPE_LO_NAME "lo"
220 #define OID_ATTNUM (-2) /* the attnum in pg_index
224 #define TEXT_FIELD_SIZE 8190 /* size of text fields
225 * (not including null
227 #define NAME_FIELD_SIZE 32 /* size of name fields */
228 #define MAX_VARCHAR_SIZE 254 /* maximum size of a varchar (not
229 * including null term) */
231 #define PG_NUMERIC_MAX_PRECISION 1000
232 #define PG_NUMERIC_MAX_SCALE 1000
234 #define INFO_INQUIRY_LEN 8192 /* this seems sufficiently big for
235 * queries used in info.c inoue
240 #ifdef _MEMORY_DEBUG_
241 void *debug_alloc(size_t);
242 void *debug_realloc(void *, size_t);
243 char *debug_strdup(const char *);
244 void debug_free(void *);
245 void debug_memory_check(void);
247 #define malloc debug_alloc
248 #define realloc debug_realloc
249 #define strdup debug_strdup
250 #define free debug_free
251 #endif /* _MEMORY_DEBUG_ */