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.48 2001/09/08 16:20:16 inoue Exp $
12 #ifndef __PSQLODBC_H__
13 #define __PSQLODBC_H__
16 #include "pg_config.h"
19 #include <stdio.h> /* for FILE* pointers: see GLOBAL_VALUES */
23 #define UInt4 unsigned int
25 #define UInt2 unsigned short
27 typedef double SDOUBLE;
31 #define UInt4 unsigned int
33 #define UInt2 unsigned short
39 #define ODBCVER 0x0250
40 #define DRIVER_ODBC_VER "02.50"
42 #define DRIVERNAME "PostgreSQL ODBC"
43 #define DBMS_NAME "PostgreSQL"
45 #define POSTGRESDRIVERVERSION "07.01.0007"
48 #define DRIVER_FILE_NAME "PSQLODBC.DLL"
50 #define DRIVER_FILE_NAME "libpsqlodbc.so"
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
68 #define MAX_CONNECTIONS 128 /* conns per environment
70 #define MAX_FIELDS 512
72 #define VARHDRSZ sizeof(Int4)
74 #define MAX_TABLE_LEN 32
75 #define MAX_COLUMN_LEN 32
76 #define MAX_CURSOR_LEN 32
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 */
85 /* These prefixes denote system tables */
86 #define POSTGRES_SYS_PREFIX "pg_"
87 #define KEYS_TABLE "dd_fkey"
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
96 #define MAX_STATEMENT_LEN 0 /* Unlimited statement size with
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
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 */
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;
121 typedef struct col_info COL_INFO;
122 typedef struct lo_arg LO_ARG;
124 typedef struct GlobalValues_
127 int socket_buffersize;
129 int max_varchar_size;
130 int max_longvarchar_size;
133 char disable_optimizer;
136 char onlyread; /* readonly is reserved on Digital C++
138 char use_declarefetch;
139 char text_as_longvarchar;
140 char unknowns_as_longvarchar;
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];
150 typedef struct StatementOptions_
157 int scroll_concurrency;
159 int bind_size; /* size of each structure if using Row
163 UInt2 *rowStatusArray;
167 /* Used to pass extra query info to send_query */
168 typedef struct QueryInfo_
171 QResultClass *result_in;
175 void logs_on_off(int cnopen, int, int);
177 #define PG_TYPE_LO (-999) /* hack until permanent
179 #define PG_TYPE_LO_NAME "lo"
180 #define OID_ATTNUM (-2) /* the attnum in pg_index
184 #define TEXT_FIELD_SIZE 8190 /* size of text fields
185 * (not including null
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) */
191 #define PG_NUMERIC_MAX_PRECISION 1000
192 #define PG_NUMERIC_MAX_SCALE 1000
194 #define INFO_INQUIRY_LEN 8192 /* this seems sufficiently big for
195 queries used in info.c inoue 2001/05/17 */