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