psqlodbc.h 4.87 KB
Newer Older
1

2
/* File:			psqlodbc.h
3
 *
4 5
 * Description:		This file contains defines and declarations that are related to
 *					the entire driver.
6
 *
7
 * Comments:		See "notice.txt" for copyright and license information.
8
 *
Bruce Momjian's avatar
Bruce Momjian committed
9
 * $Id: psqlodbc.h,v 1.34 2001/02/11 05:13:51 momjian Exp $
10
 */
11 12 13 14

#ifndef __PSQLODBC_H__
#define __PSQLODBC_H__

Byron Nikolaidis's avatar
Byron Nikolaidis committed
15
#ifdef HAVE_CONFIG_H
16
#include "config.h"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
17 18
#endif

19
#include <stdio.h>				/* for FILE* pointers: see GLOBAL_VALUES */
20 21

#ifndef WIN32
Byron Nikolaidis's avatar
Byron Nikolaidis committed
22 23 24 25 26 27
#define Int4 long int
#define UInt4 unsigned int
#define Int2 short
#define UInt2 unsigned short
typedef float SFLOAT;
typedef double SDOUBLE;
28

Byron Nikolaidis's avatar
Byron Nikolaidis committed
29
#else
30 31 32 33
#define Int4 int
#define UInt4 unsigned int
#define Int2 short
#define UInt2 unsigned short
Byron Nikolaidis's avatar
Byron Nikolaidis committed
34
#endif
35 36 37

typedef UInt4 Oid;

38
/* Driver stuff */
39 40
#define ODBCVER				0x0250
#define DRIVER_ODBC_VER		"02.50"
41

42 43
#define DRIVERNAME			   "PostgreSQL ODBC"
#define DBMS_NAME			   "PostgreSQL"
44

45
#define POSTGRESDRIVERVERSION  "07.01.0003"
46 47 48 49 50 51

#ifdef WIN32
#define DRIVER_FILE_NAME		"PSQLODBC.DLL"
#else
#define DRIVER_FILE_NAME		"libpsqlodbc.so"
#endif
52 53

/* Limits */
54
#ifdef WIN32
55
#define BLCKSZ						4096
56 57
#endif

58 59 60
#define MAX_MESSAGE_LEN				65536		/* This puts a limit on
												 * query size but I don't */
 /* see an easy way round this - DJP 24-1-2001 */
61
#define MAX_CONNECT_STRING			4096
62
#define ERROR_MSG_LENGTH			4096
63 64
#define FETCH_MAX					100 /* default number of rows to cache
										 * for declare/fetch */
65
#define TUPLE_MALLOC_INC			100
66 67 68 69
#define SOCK_BUFFER_SIZE			4096		/* default socket buffer
												 * size */
#define MAX_CONNECTIONS				128 /* conns per environment
										 * (arbitrary)	*/
70 71 72 73
#define MAX_FIELDS					512
#define BYTELEN						8
#define VARHDRSZ					sizeof(Int4)

Byron Nikolaidis's avatar
Byron Nikolaidis committed
74 75 76 77
#define MAX_TABLE_LEN				32
#define MAX_COLUMN_LEN				32
#define MAX_CURSOR_LEN				32

78
/*	Registry length limits */
79 80 81 82
#define LARGE_REGISTRY_LEN			4096		/* used for special cases */
#define MEDIUM_REGISTRY_LEN			256 /* normal size for
										 * user,database,etc. */
#define SMALL_REGISTRY_LEN			10	/* for 1/0 settings */
83 84 85


/*	These prefixes denote system tables */
86
#define POSTGRES_SYS_PREFIX "pg_"
87 88 89 90 91
#define KEYS_TABLE			"dd_fkey"

/*	Info limits */
#define MAX_INFO_STRING		128
#define MAX_KEYPARTS		20
92 93 94 95 96
#define MAX_KEYLEN			512 /* max key of the form
								 * "date+outlet+invoice" */
#define MAX_ROW_SIZE		0	/* Unlimited rowsize with the Tuple
								 * Toaster */
#define MAX_STATEMENT_LEN	0	/* Unlimited statement size with 7.0 */
97

98 99 100
/* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
/* Now that's 0, lets use this instead. DJP 24-1-2001 */
#define STD_STATEMENT_LEN	MAX_MESSAGE_LEN
101

Byron Nikolaidis's avatar
Byron Nikolaidis committed
102
#define PG64	"6.4"
103 104 105 106 107 108 109 110 111 112 113 114

typedef struct ConnectionClass_ ConnectionClass;
typedef struct StatementClass_ StatementClass;
typedef struct QResultClass_ QResultClass;
typedef struct SocketClass_ SocketClass;
typedef struct BindInfoClass_ BindInfoClass;
typedef struct ParameterInfoClass_ ParameterInfoClass;
typedef struct ColumnInfoClass_ ColumnInfoClass;
typedef struct TupleListClass_ TupleListClass;
typedef struct EnvironmentClass_ EnvironmentClass;
typedef struct TupleNode_ TupleNode;
typedef struct TupleField_ TupleField;
115

Byron Nikolaidis's avatar
Byron Nikolaidis committed
116
typedef struct col_info COL_INFO;
117 118 119 120
typedef struct lo_arg LO_ARG;

typedef struct GlobalValues_
{
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
	int			fetch_max;
	int			socket_buffersize;
	int			unknown_sizes;
	int			max_varchar_size;
	int			max_longvarchar_size;
	char		debug;
	char		commlog;
	char		disable_optimizer;
	char		ksqo;
	char		unique_index;
	char		onlyread;		/* readonly is reserved on Digital C++
								 * compiler */
	char		use_declarefetch;
	char		text_as_longvarchar;
	char		unknowns_as_longvarchar;
	char		bools_as_char;
	char		lie;
	char		parse;
	char		cancel_as_freestmt;
	char		extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
	char		conn_settings[LARGE_REGISTRY_LEN];

	/*
	 * Protocol is not used anymore, but kept in case it is useful in the
	 * future.	bjm 2001-02-10
	 */
	char		protocol[SMALL_REGISTRY_LEN];
	FILE	   *mylogFP;
	FILE	   *qlogFP;
Bruce Momjian's avatar
Bruce Momjian committed
150
} GLOBAL_VALUES;
151 152 153 154 155 156 157 158 159 160 161 162 163

typedef struct StatementOptions_
{
	int			maxRows;
	int			maxLength;
	int			rowset_size;
	int			keyset_size;
	int			cursor_type;
	int			scroll_concurrency;
	int			retrieve_data;
	int			bind_size;		/* size of each structure if using Row
								 * Binding */
	int			use_bookmarks;
Bruce Momjian's avatar
Bruce Momjian committed
164
} StatementOptions;
165 166

/*	Used to pass extra query info to send_query */
167 168 169 170 171
typedef struct QueryInfo_
{
	int			row_size;
	QResultClass *result_in;
	char	   *cursor;
Bruce Momjian's avatar
Bruce Momjian committed
172
} QueryInfo;
173

174

175 176
#define PG_TYPE_LO				-999	/* hack until permanent type
										 * available */
177
#define PG_TYPE_LO_NAME			"lo"
178 179
#define OID_ATTNUM				-2		/* the attnum in pg_index of the
										 * oid */
180

181
/* sizes */
182 183
#define TEXT_FIELD_SIZE			8190	/* size of text fields (not
										 * including null term) */
184
#define NAME_FIELD_SIZE			32		/* size of name fields */
185 186
#define MAX_VARCHAR_SIZE		254		/* maximum size of a varchar (not
										 * including null term) */
187

188 189
#define PG_NUMERIC_MAX_PRECISION	1000
#define PG_NUMERIC_MAX_SCALE		1000
190 191 192 193

#include "misc.h"

#endif