1998-06-03 22:33:45 +02:00
|
|
|
|
|
|
|
/* File: psqlodbc.h
|
|
|
|
*
|
|
|
|
* Description: This file contains defines and declarations that are related to
|
|
|
|
* the entire driver.
|
|
|
|
*
|
|
|
|
* Comments: See "notice.txt" for copyright and license information.
|
|
|
|
*
|
|
|
|
*/
|
1998-04-13 17:02:05 +02:00
|
|
|
|
|
|
|
#ifndef __PSQLODBC_H__
|
|
|
|
#define __PSQLODBC_H__
|
|
|
|
|
1998-07-23 01:47:48 +02:00
|
|
|
#ifdef HAVE_CONFIG_H
|
1998-10-06 07:58:41 +02:00
|
|
|
#include "config.h"
|
1998-07-23 01:47:48 +02:00
|
|
|
#endif
|
|
|
|
|
1998-10-06 07:58:41 +02:00
|
|
|
#include <stdio.h> /* for FILE* pointers: see GLOBAL_VALUES */
|
|
|
|
|
|
|
|
#ifndef WIN32
|
1998-07-23 01:47:48 +02:00
|
|
|
#define Int4 long int
|
|
|
|
#define UInt4 unsigned int
|
|
|
|
#define Int2 short
|
|
|
|
#define UInt2 unsigned short
|
|
|
|
typedef float SFLOAT;
|
|
|
|
typedef double SDOUBLE;
|
|
|
|
#else
|
1998-04-13 17:02:05 +02:00
|
|
|
#define Int4 int
|
|
|
|
#define UInt4 unsigned int
|
|
|
|
#define Int2 short
|
|
|
|
#define UInt2 unsigned short
|
1998-07-23 01:47:48 +02:00
|
|
|
#endif
|
1998-04-13 17:02:05 +02:00
|
|
|
|
|
|
|
typedef UInt4 Oid;
|
|
|
|
|
1998-12-31 01:26:06 +01:00
|
|
|
/* Driver stuff */
|
|
|
|
#define ODBCVER 0x0200
|
|
|
|
#define DRIVER_ODBC_VER "02.00"
|
|
|
|
|
|
|
|
#define DRIVERNAME "PostgreSQL ODBC"
|
|
|
|
#define DBMS_NAME "PostgreSQL"
|
2000-01-30 22:14:25 +01:00
|
|
|
|
2000-02-28 04:31:36 +01:00
|
|
|
#define DBMS_VERSION "06.40.0009 PostgreSQL 6.4/6.5"
|
|
|
|
#define POSTGRESDRIVERVERSION "06.40.0009"
|
1998-12-31 01:26:06 +01:00
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
|
|
|
|
#else
|
|
|
|
#define DRIVER_FILE_NAME "libpsqlodbc.so"
|
|
|
|
#endif
|
1998-04-13 17:02:05 +02:00
|
|
|
|
|
|
|
/* Limits */
|
2000-02-28 04:31:36 +01:00
|
|
|
#ifdef WIN32
|
|
|
|
#define BLCKSZ 4096
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 21:10:48 +02:00
|
|
|
#define MAX_QUERY_SIZE (BLCKSZ*2)
|
|
|
|
#define MAX_MESSAGE_LEN MAX_QUERY_SIZE
|
1998-06-03 22:33:45 +02:00
|
|
|
#define MAX_CONNECT_STRING 4096
|
1998-04-13 17:02:05 +02:00
|
|
|
#define ERROR_MSG_LENGTH 4096
|
|
|
|
#define FETCH_MAX 100 /* default number of rows to cache for declare/fetch */
|
1998-12-29 02:49:58 +01:00
|
|
|
#define TUPLE_MALLOC_INC 100
|
1998-06-03 22:33:45 +02:00
|
|
|
#define SOCK_BUFFER_SIZE 4096 /* default socket buffer size */
|
1998-04-13 17:02:05 +02:00
|
|
|
#define MAX_CONNECTIONS 128 /* conns per environment (arbitrary) */
|
|
|
|
#define MAX_FIELDS 512
|
|
|
|
#define BYTELEN 8
|
|
|
|
#define VARHDRSZ sizeof(Int4)
|
|
|
|
|
1998-07-23 01:47:48 +02:00
|
|
|
#define MAX_TABLE_LEN 32
|
|
|
|
#define MAX_COLUMN_LEN 32
|
|
|
|
#define MAX_CURSOR_LEN 32
|
|
|
|
|
1998-06-03 22:33:45 +02:00
|
|
|
/* Registry length limits */
|
|
|
|
#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 */
|
1998-04-13 17:02:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* These prefixes denote system tables */
|
|
|
|
#define POSTGRES_SYS_PREFIX "pg_"
|
|
|
|
#define KEYS_TABLE "dd_fkey"
|
|
|
|
|
|
|
|
/* Info limits */
|
|
|
|
#define MAX_INFO_STRING 128
|
|
|
|
#define MAX_KEYPARTS 20
|
2000-05-27 05:35:14 +02:00
|
|
|
#define MAX_KEYLEN 512 /* max key of the form "date+outlet+invoice" */
|
1998-04-13 17:02:05 +02:00
|
|
|
#define MAX_STATEMENT_LEN MAX_MESSAGE_LEN
|
|
|
|
|
1998-06-03 22:33:45 +02:00
|
|
|
|
|
|
|
#define PG62 "6.2" /* "Protocol" key setting to force Postgres 6.2 */
|
1998-11-11 22:54:01 +01:00
|
|
|
#define PG63 "6.3" /* "Protocol" key setting to force postgres 6.3 */
|
1999-01-06 21:44:08 +01:00
|
|
|
#define PG64 "6.4"
|
1998-04-13 17:02:05 +02:00
|
|
|
|
|
|
|
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;
|
1998-06-03 22:33:45 +02:00
|
|
|
|
1998-07-23 01:47:48 +02:00
|
|
|
typedef struct col_info COL_INFO;
|
1998-06-03 22:33:45 +02:00
|
|
|
typedef struct lo_arg LO_ARG;
|
|
|
|
|
|
|
|
typedef struct GlobalValues_
|
|
|
|
{
|
|
|
|
int fetch_max;
|
|
|
|
int socket_buffersize;
|
|
|
|
int unknown_sizes;
|
|
|
|
int max_varchar_size;
|
|
|
|
int max_longvarchar_size;
|
|
|
|
char debug;
|
|
|
|
char commlog;
|
|
|
|
char disable_optimizer;
|
1998-11-11 22:54:01 +01:00
|
|
|
char ksqo;
|
1998-06-03 22:33:45 +02:00
|
|
|
char unique_index;
|
1999-11-30 03:44:09 +01:00
|
|
|
char onlyread; /* readonly is reserved on Digital C++ compiler */
|
1998-06-03 22:33:45 +02:00
|
|
|
char use_declarefetch;
|
|
|
|
char text_as_longvarchar;
|
|
|
|
char unknowns_as_longvarchar;
|
|
|
|
char bools_as_char;
|
1998-06-08 18:15:12 +02:00
|
|
|
char lie;
|
1998-07-23 01:47:48 +02:00
|
|
|
char parse;
|
1998-12-29 02:49:58 +01:00
|
|
|
char cancel_as_freestmt;
|
1998-06-03 22:33:45 +02:00
|
|
|
char extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
|
|
|
|
char conn_settings[LARGE_REGISTRY_LEN];
|
1999-01-06 21:44:08 +01:00
|
|
|
char protocol[SMALL_REGISTRY_LEN];
|
|
|
|
|
1998-10-06 07:58:41 +02:00
|
|
|
FILE* mylogFP;
|
|
|
|
FILE* qlogFP;
|
1998-06-03 22:33:45 +02:00
|
|
|
} GLOBAL_VALUES;
|
|
|
|
|
1998-12-29 02:49:58 +01:00
|
|
|
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 */
|
1999-01-08 19:24:45 +01:00
|
|
|
int use_bookmarks;
|
1998-12-29 02:49:58 +01:00
|
|
|
} StatementOptions;
|
|
|
|
|
|
|
|
/* Used to pass extra query info to send_query */
|
|
|
|
typedef struct QueryInfo_ {
|
|
|
|
int row_size;
|
|
|
|
QResultClass *result_in;
|
|
|
|
char *cursor;
|
|
|
|
} QueryInfo;
|
|
|
|
|
1998-06-03 22:33:45 +02:00
|
|
|
|
|
|
|
#define PG_TYPE_LO -999 /* hack until permanent type available */
|
|
|
|
#define PG_TYPE_LO_NAME "lo"
|
|
|
|
#define OID_ATTNUM -2 /* the attnum in pg_index of the oid */
|
|
|
|
|
1998-04-13 17:02:05 +02:00
|
|
|
/* sizes */
|
1999-05-13 05:33:00 +02:00
|
|
|
#define TEXT_FIELD_SIZE 8190 /* size of text fields (not including null term) */
|
1998-06-03 22:33:45 +02:00
|
|
|
#define NAME_FIELD_SIZE 32 /* size of name fields */
|
|
|
|
#define MAX_VARCHAR_SIZE 254 /* maximum size of a varchar (not including null term) */
|
|
|
|
|
2000-01-30 22:14:25 +01:00
|
|
|
#define PG_NUMERIC_MAX_PRECISION 1000
|
|
|
|
#define PG_NUMERIC_MAX_SCALE 1000
|
1998-04-13 17:02:05 +02:00
|
|
|
|
|
|
|
#include "misc.h"
|
|
|
|
|
|
|
|
#endif
|