Commit 12ceb111 authored by Bruce Momjian's avatar Bruce Momjian

ODBC source code cleanup. Mostly alignment of #define constants.

parent ff713018
/* Module: bind.c /* Module: bind.c
* *
* Description: This module contains routines related to binding * Description: This module contains routines related to binding
......
/* File: bind.h /* File: bind.h
* *
* Description: See "bind.c" * Description: See "bind.c"
......
/* Module: columninfo.c /* Module: columninfo.c
* *
* Description: This module contains routines related to * Description: This module contains routines related to
......
/* File: columninfo.h /* File: columninfo.h
* *
* Description: See "columninfo.c" * Description: See "columninfo.c"
...@@ -40,5 +39,4 @@ void CI_set_num_fields(ColumnInfoClass *self, int new_num_fields); ...@@ -40,5 +39,4 @@ void CI_set_num_fields(ColumnInfoClass *self, int new_num_fields);
void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
Oid new_adtid, Int2 new_adtsize, Int4 atttypmod); Oid new_adtid, Int2 new_adtsize, Int4 atttypmod);
#endif #endif
/* Module: connection.c /* Module: connection.c
* *
* Description: This module contains routines related to * Description: This module contains routines related to
......
/* File: connection.h /* File: connection.h
* *
* Description: See "connection.c" * Description: See "connection.c"
...@@ -38,41 +37,41 @@ typedef enum ...@@ -38,41 +37,41 @@ typedef enum
} CONN_Status; } CONN_Status;
/* These errors have general sql error state */ /* These errors have general sql error state */
#define CONNECTION_SERVER_NOT_REACHED 101 #define CONNECTION_SERVER_NOT_REACHED 101
#define CONNECTION_MSG_TOO_LONG 103 #define CONNECTION_MSG_TOO_LONG 103
#define CONNECTION_COULD_NOT_SEND 104 #define CONNECTION_COULD_NOT_SEND 104
#define CONNECTION_NO_SUCH_DATABASE 105 #define CONNECTION_NO_SUCH_DATABASE 105
#define CONNECTION_BACKEND_CRAZY 106 #define CONNECTION_BACKEND_CRAZY 106
#define CONNECTION_NO_RESPONSE 107 #define CONNECTION_NO_RESPONSE 107
#define CONNECTION_SERVER_REPORTED_ERROR 108 #define CONNECTION_SERVER_REPORTED_ERROR 108
#define CONNECTION_COULD_NOT_RECEIVE 109 #define CONNECTION_COULD_NOT_RECEIVE 109
#define CONNECTION_SERVER_REPORTED_WARNING 110 #define CONNECTION_SERVER_REPORTED_WARNING 110
#define CONNECTION_NEED_PASSWORD 112 #define CONNECTION_NEED_PASSWORD 112
/* These errors correspond to specific SQL states */ /* These errors correspond to specific SQL states */
#define CONN_INIREAD_ERROR 201 #define CONN_INIREAD_ERROR 201
#define CONN_OPENDB_ERROR 202 #define CONN_OPENDB_ERROR 202
#define CONN_STMT_ALLOC_ERROR 203 #define CONN_STMT_ALLOC_ERROR 203
#define CONN_IN_USE 204 #define CONN_IN_USE 204
#define CONN_UNSUPPORTED_OPTION 205 #define CONN_UNSUPPORTED_OPTION 205
/* Used by SetConnectoption to indicate unsupported options */ /* Used by SetConnectoption to indicate unsupported options */
#define CONN_INVALID_ARGUMENT_NO 206 #define CONN_INVALID_ARGUMENT_NO 206
/* SetConnectOption: corresponds to ODBC--"S1009" */ /* SetConnectOption: corresponds to ODBC--"S1009" */
#define CONN_TRANSACT_IN_PROGRES 207 #define CONN_TRANSACT_IN_PROGRES 207
#define CONN_NO_MEMORY_ERROR 208 #define CONN_NO_MEMORY_ERROR 208
#define CONN_NOT_IMPLEMENTED_ERROR 209 #define CONN_NOT_IMPLEMENTED_ERROR 209
#define CONN_INVALID_AUTHENTICATION 210 #define CONN_INVALID_AUTHENTICATION 210
#define CONN_AUTH_TYPE_UNSUPPORTED 211 #define CONN_AUTH_TYPE_UNSUPPORTED 211
#define CONN_UNABLE_TO_LOAD_DLL 212 #define CONN_UNABLE_TO_LOAD_DLL 212
#define CONN_OPTION_VALUE_CHANGED 213 #define CONN_OPTION_VALUE_CHANGED 213
#define CONN_VALUE_OUT_OF_RANGE 214 #define CONN_VALUE_OUT_OF_RANGE 214
#define CONN_TRUNCATED 215 #define CONN_TRUNCATED 215
/* Conn_status defines */ /* Conn_status defines */
#define CONN_IN_AUTOCOMMIT 0x01 #define CONN_IN_AUTOCOMMIT 0x01
#define CONN_IN_TRANSACTION 0x02 #define CONN_IN_TRANSACTION 0x02
/* AutoCommit functions */ /* AutoCommit functions */
#define CC_set_autocommit_off(x) (x->transact_status &= ~CONN_IN_AUTOCOMMIT) #define CC_set_autocommit_off(x) (x->transact_status &= ~CONN_IN_AUTOCOMMIT)
...@@ -86,31 +85,31 @@ typedef enum ...@@ -86,31 +85,31 @@ typedef enum
/* Authentication types */ /* Authentication types */
#define AUTH_REQ_OK 0 #define AUTH_REQ_OK 0
#define AUTH_REQ_KRB4 1 #define AUTH_REQ_KRB4 1
#define AUTH_REQ_KRB5 2 #define AUTH_REQ_KRB5 2
#define AUTH_REQ_PASSWORD 3 #define AUTH_REQ_PASSWORD 3
#define AUTH_REQ_CRYPT 4 #define AUTH_REQ_CRYPT 4
/* Startup Packet sizes */ /* Startup Packet sizes */
#define SM_DATABASE 64 #define SM_DATABASE 64
#define SM_USER 32 #define SM_USER 32
#define SM_OPTIONS 64 #define SM_OPTIONS 64
#define SM_UNUSED 64 #define SM_UNUSED 64
#define SM_TTY 64 #define SM_TTY 64
/* Old 6.2 protocol defines */ /* Old 6.2 protocol defines */
#define NO_AUTHENTICATION 7 #define NO_AUTHENTICATION 7
#define PATH_SIZE 64 #define PATH_SIZE 64
#define ARGV_SIZE 64 #define ARGV_SIZE 64
#define NAMEDATALEN 16 #define NAMEDATALEN 16
typedef unsigned int ProtocolVersion; typedef unsigned int ProtocolVersion;
#define PG_PROTOCOL(major, minor) (((major) << 16) | (minor)) #define PG_PROTOCOL(major, minor) (((major) << 16) | (minor))
#define PG_PROTOCOL_LATEST PG_PROTOCOL(2, 0) #define PG_PROTOCOL_LATEST PG_PROTOCOL(2, 0)
#define PG_PROTOCOL_63 PG_PROTOCOL(1, 0) #define PG_PROTOCOL_63 PG_PROTOCOL(1, 0)
#define PG_PROTOCOL_62 PG_PROTOCOL(0, 0) #define PG_PROTOCOL_62 PG_PROTOCOL(0, 0)
/* This startup packet is to support latest Postgres protocol (6.4, 6.3) */ /* This startup packet is to support latest Postgres protocol (6.4, 6.3) */
typedef struct _StartupPacket typedef struct _StartupPacket
...@@ -275,12 +274,12 @@ struct ConnectionClass_ ...@@ -275,12 +274,12 @@ struct ConnectionClass_
/* Accessor functions */ /* Accessor functions */
#define CC_get_socket(x) (x->sock) #define CC_get_socket(x) (x->sock)
#define CC_get_database(x) (x->connInfo.database) #define CC_get_database(x) (x->connInfo.database)
#define CC_get_server(x) (x->connInfo.server) #define CC_get_server(x) (x->connInfo.server)
#define CC_get_DSN(x) (x->connInfo.dsn) #define CC_get_DSN(x) (x->connInfo.dsn)
#define CC_get_username(x) (x->connInfo.username) #define CC_get_username(x) (x->connInfo.username)
#define CC_is_onlyread(x) (x->connInfo.onlyread[0] == '1') #define CC_is_onlyread(x) (x->connInfo.onlyread[0] == '1')
/* for CC_DSN_info */ /* for CC_DSN_info */
......
/* Module: convert.c /* Module: convert.c
* *
* Description: This module contains routines related to * Description: This module contains routines related to
......
/* File: convert.h /* File: convert.h
* *
* Description: See "convert.c" * Description: See "convert.c"
...@@ -13,12 +12,12 @@ ...@@ -13,12 +12,12 @@
#include "psqlodbc.h" #include "psqlodbc.h"
/* copy_and_convert results */ /* copy_and_convert results */
#define COPY_OK 0 #define COPY_OK 0
#define COPY_UNSUPPORTED_TYPE 1 #define COPY_UNSUPPORTED_TYPE 1
#define COPY_UNSUPPORTED_CONVERSION 2 #define COPY_UNSUPPORTED_CONVERSION 2
#define COPY_RESULT_TRUNCATED 3 #define COPY_RESULT_TRUNCATED 3
#define COPY_GENERAL_ERROR 4 #define COPY_GENERAL_ERROR 4
#define COPY_NO_DATA_FOUND 5 #define COPY_NO_DATA_FOUND 5
typedef struct typedef struct
{ {
......
/* Module: dlg_specific.c /* Module: dlg_specific.c
* *
* Description: This module contains any specific code for handling * Description: This module contains any specific code for handling
......
/* File: dlg_specific.h /* File: dlg_specific.h
* *
* Description: See "dlg_specific.c" * Description: See "dlg_specific.c"
...@@ -25,73 +24,81 @@ ...@@ -25,73 +24,81 @@
#endif #endif
/* Unknown data type sizes */ /* Unknown data type sizes */
#define UNKNOWNS_AS_MAX 0 #define UNKNOWNS_AS_MAX 0
#define UNKNOWNS_AS_DONTKNOW 1 #define UNKNOWNS_AS_DONTKNOW 1
#define UNKNOWNS_AS_LONGEST 2 #define UNKNOWNS_AS_LONGEST 2
/* INI File Stuff */ /* INI File Stuff */
#ifndef WIN32 #ifndef WIN32
#define ODBC_INI ".odbc.ini" #define ODBC_INI ".odbc.ini"
#ifdef ODBCINSTDIR #ifdef ODBCINSTDIR
#define ODBCINST_INI ODBCINSTDIR "/odbcinst.ini" #define ODBCINST_INI ODBCINSTDIR "/odbcinst.ini"
#else #else
#define ODBCINST_INI "/etc/odbcinst.ini" #define ODBCINST_INI "/etc/odbcinst.ini"
#endif #endif
#else /* WIN32 */ #else /* WIN32 */
#define ODBC_INI "ODBC.INI" /* ODBC initialization file */ #define ODBC_INI "ODBC.INI" /* ODBC initialization
#define ODBCINST_INI "ODBCINST.INI" /* ODBC Installation file */ * file */
#define ODBCINST_INI "ODBCINST.INI" /* ODBC Installation
* file */
#endif /* WIN32 */ #endif /* WIN32 */
#define INI_DSN DBMS_NAME /* Name of default Datasource in #define INI_DSN DBMS_NAME /* Name of default
* ini file (not used?) */ * Datasource in ini
#define INI_KDESC "Description" /* Data source description */ * file (not used?) */
#define INI_SERVER "Servername" /* Name of Server running the #define INI_KDESC "Description" /* Data source
* Postgres service */ * description */
#define INI_PORT "Port"/* Port on which the Postmaster is #define INI_SERVER "Servername" /* Name of Server
* listening */ * running the Postgres
#define INI_DATABASE "Database" /* Database Name */ * service */
#define INI_USER "Username" /* Default User Name */ #define INI_PORT "Port" /* Port on which the
#define INI_PASSWORD "Password" /* Default Password */ * Postmaster is listening */
#define INI_DEBUG "Debug" /* Debug flag */ #define INI_DATABASE "Database" /* Database Name */
#define INI_FETCH "Fetch" /* Fetch Max Count */ #define INI_USER "Username" /* Default User Name */
#define INI_SOCKET "Socket" /* Socket buffer size */ #define INI_PASSWORD "Password" /* Default Password */
#define INI_READONLY "ReadOnly" /* Database is read only */ #define INI_DEBUG "Debug" /* Debug flag */
#define INI_COMMLOG "CommLog" /* Communication to backend #define INI_FETCH "Fetch" /* Fetch Max Count */
* logging */ #define INI_SOCKET "Socket" /* Socket buffer size */
#define INI_PROTOCOL "Protocol" /* What protocol (6.2) */ #define INI_READONLY "ReadOnly" /* Database is read only */
#define INI_OPTIMIZER "Optimizer" /* Use backend genetic optimizer */ #define INI_COMMLOG "CommLog" /* Communication to
#define INI_KSQO "Ksqo"/* Keyset query optimization */ * backend logging */
#define INI_CONNSETTINGS "ConnSettings" /* Anything to send to #define INI_PROTOCOL "Protocol" /* What protocol (6.2) */
* backend on successful #define INI_OPTIMIZER "Optimizer" /* Use backend genetic
* connection */ * optimizer */
#define INI_UNIQUEINDEX "UniqueIndex" /* Recognize unique indexes */ #define INI_KSQO "Ksqo" /* Keyset query
#define INI_UNKNOWNSIZES "UnknownSizes" /* How to handle unknown * optimization */
* result set sizes */ #define INI_CONNSETTINGS "ConnSettings" /* Anything to send to
* backend on successful
#define INI_CANCELASFREESTMT "CancelAsFreeStmt" * connection */
#define INI_UNIQUEINDEX "UniqueIndex" /* Recognize unique
#define INI_USEDECLAREFETCH "UseDeclareFetch" /* Use Declare/Fetch * indexes */
* cursors */ #define INI_UNKNOWNSIZES "UnknownSizes" /* How to handle unknown
* result set sizes */
#define INI_CANCELASFREESTMT "CancelAsFreeStmt"
#define INI_USEDECLAREFETCH "UseDeclareFetch" /* Use Declare/Fetch
* cursors */
/* More ini stuff */ /* More ini stuff */
#define INI_TEXTASLONGVARCHAR "TextAsLongVarchar" #define INI_TEXTASLONGVARCHAR "TextAsLongVarchar"
#define INI_UNKNOWNSASLONGVARCHAR "UnknownsAsLongVarchar" #define INI_UNKNOWNSASLONGVARCHAR "UnknownsAsLongVarchar"
#define INI_BOOLSASCHAR "BoolsAsChar" #define INI_BOOLSASCHAR "BoolsAsChar"
#define INI_MAXVARCHARSIZE "MaxVarcharSize" #define INI_MAXVARCHARSIZE "MaxVarcharSize"
#define INI_MAXLONGVARCHARSIZE "MaxLongVarcharSize" #define INI_MAXLONGVARCHARSIZE "MaxLongVarcharSize"
#define INI_FAKEOIDINDEX "FakeOidIndex" #define INI_FAKEOIDINDEX "FakeOidIndex"
#define INI_SHOWOIDCOLUMN "ShowOidColumn" #define INI_SHOWOIDCOLUMN "ShowOidColumn"
#define INI_ROWVERSIONING "RowVersioning" #define INI_ROWVERSIONING "RowVersioning"
#define INI_SHOWSYSTEMTABLES "ShowSystemTables" #define INI_SHOWSYSTEMTABLES "ShowSystemTables"
#define INI_LIE "Lie" #define INI_LIE "Lie"
#define INI_PARSE "Parse" #define INI_PARSE "Parse"
#define INI_EXTRASYSTABLEPREFIXES "ExtraSysTablePrefixes" #define INI_EXTRASYSTABLEPREFIXES "ExtraSysTablePrefixes"
#define INI_TRANSLATIONNAME "TranslationName" #define INI_TRANSLATIONNAME "TranslationName"
#define INI_TRANSLATIONDLL "TranslationDLL" #define INI_TRANSLATIONDLL "TranslationDLL"
#define INI_TRANSLATIONOPTION "TranslationOption" #define INI_TRANSLATIONOPTION "TranslationOption"
/* Connection Defaults */ /* Connection Defaults */
......
/* Module: drvconn.c /* Module: drvconn.c
* *
* Description: This module contains only routines related to * Description: This module contains only routines related to
......
/* Module: environ.c /* Module: environ.c
* *
* Description: This module contains routines related to * Description: This module contains routines related to
......
/* File: environ.h /* File: environ.h
* *
* Description: See "environ.c" * Description: See "environ.c"
......
/* Module: execute.c /* Module: execute.c
* *
* Description: This module contains routines related to * Description: This module contains routines related to
......
/* GetPrivateProfileString() -- approximate implementation of */ /* GetPrivateProfileString()
/* Windows NT System Services version of GetPrivateProfileString() */ *
/* probably doesn't handle the NULL key for section name or value key */ * approximate implementation of
/* correctly also, doesn't provide Microsoft backwards compatability */ * Windows NT System Services version of GetPrivateProfileString()
/* wrt TAB characters in the value string -- Microsoft terminates value */ * probably doesn't handle the NULL key for section name or value key
/* at the first TAB, but I couldn't discover what the behavior should */ * correctly also, doesn't provide Microsoft backwards compatability
/* be regarding TABS in quoted strings so, I treat tabs like any other */ * wrt TAB characters in the value string
/* characters -- NO comments following value string separated by a TAB */ *
/* are allowed (that is an anachronism anyway) */ * Microsoft terminates value
/* Added code to search for ODBC_INI file in users home directory on */ * at the first TAB, but I couldn't discover what the behavior should
/* Unix */ * be regarding TABS in quoted strings so, I treat tabs like any other
* characters
*
* NO comments following value string separated by a TAB
* are allowed (that is an anachronism anyway)
* Added code to search for ODBC_INI file in users home directory on
* Unix
*/
#ifndef WIN32 #ifndef WIN32
......
/* GetPrivateProfileString */ /* GetPrivateProfileString
/* for UNIX use */ * for UNIX use
*/
#ifndef GPPS_H #ifndef GPPS_H
#define GPPS_H #define GPPS_H
......
/* Module: info.c /* Module: info.c
* *
* Description: This module contains routines related to * Description: This module contains routines related to
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#define MEM_ALLOC(size) (malloc((size_t)(size))) #define MEM_ALLOC(size) (malloc((size_t)(size)))
#define MEM_FREE(ptr) {if(ptr) free(ptr);} #define MEM_FREE(ptr) {if(ptr) free(ptr);}
#define STRCPY(t, s) (strcpy((char*)(t), (char*)(s))) #define STRCPY(t, s) (strcpy((char*)(t), (char*)(s)))
#define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n))) #define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n)))
#define STRCAT(t, s) (strcat((char*)(t), (char*)(s))) #define STRCAT(t, s) (strcat((char*)(t), (char*)(s)))
#define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n))) #define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n)))
#define STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0) #define STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0)
#define STRLEN(str) ((str)? strlen((char*)(str)):0) #define STRLEN(str) ((str)? strlen((char*)(str)):0)
#define EXPORT #define EXPORT
#define CALLBACK #define CALLBACK
...@@ -38,29 +38,29 @@ typedef int BOOL; ...@@ -38,29 +38,29 @@ typedef int BOOL;
#include <windowsx.h> #include <windowsx.h>
#ifdef _MSVC_ #ifdef _MSVC_
#define MEM_ALLOC(size) (fmalloc((size_t)(size))) #define MEM_ALLOC(size) (fmalloc((size_t)(size)))
#define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0)) #define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0))
#define STRCPY(t, s) (fstrcpy((char FAR*)(t), (char FAR*)(s))) #define STRCPY(t, s) (fstrcpy((char FAR*)(t), (char FAR*)(s)))
#define STRNCPY(t,s,n) (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) #define STRNCPY(t,s,n) (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
#define STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0) #define STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0)
#define STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) #define STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
#endif #endif
#ifdef _BORLAND_ #ifdef _BORLAND_
#define MEM_ALLOC(size) (farmalloc((unsigned long)(size)) #define MEM_ALLOC(size) (farmalloc((unsigned long)(size))
#define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0) #define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0)
#define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s))) #define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s)))
#define STRNCPY(t,s,n) (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) #define STRNCPY(t,s,n) (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
#define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0) #define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0)
#define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) #define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
#endif #endif
#endif /* WIN32 */ #endif /* WIN32 */
#define SYSERR (-1) #define SYSERR (-1)
#ifndef NULL #ifndef NULL
#define NULL ((void FAR*)0UL) #define NULL ((void FAR*)0UL)
#endif #endif
#endif #endif
/* Modified isql.h file from iodbc. This file should be placed in the /*
* include path to be used to create ODBC compliant applications. * Modified isql.h file from iodbc. This file should be placed in the
*/ * include path to be used to create ODBC compliant applications.
*/
#ifndef _INTRINSIC_SQL_H #ifndef _INTRINSIC_SQL_H
#define _INTRINSIC_SQL_H #define _INTRINSIC_SQL_H
...@@ -24,106 +26,106 @@ typedef signed short RETCODE; ...@@ -24,106 +26,106 @@ typedef signed short RETCODE;
#define SQL_API EXPORT CALLBACK #define SQL_API EXPORT CALLBACK
#endif #endif
#define ODBCVER 0x0250 #define ODBCVER 0x0250
#define SQL_MAX_MESSAGE_LENGTH 512 #define SQL_MAX_MESSAGE_LENGTH 512
#define SQL_MAX_DSN_LENGTH 32 #define SQL_MAX_DSN_LENGTH 32
/* return code */ /* return code */
#define SQL_INVALID_HANDLE (-2) #define SQL_INVALID_HANDLE (-2)
#define SQL_ERROR (-1) #define SQL_ERROR (-1)
#define SQL_SUCCESS 0 #define SQL_SUCCESS 0
#define SQL_SUCCESS_WITH_INFO 1 #define SQL_SUCCESS_WITH_INFO 1
#define SQL_NO_DATA_FOUND 100 #define SQL_NO_DATA_FOUND 100
/* standard SQL datatypes (agree with ANSI type numbering) */ /* standard SQL datatypes (agree with ANSI type numbering) */
#define SQL_CHAR 1 #define SQL_CHAR 1
#define SQL_NUMERIC 2 #define SQL_NUMERIC 2
#define SQL_DECIMAL 3 #define SQL_DECIMAL 3
#define SQL_INTEGER 4 #define SQL_INTEGER 4
#define SQL_SMALLINT 5 #define SQL_SMALLINT 5
#define SQL_FLOAT 6 #define SQL_FLOAT 6
#define SQL_REAL 7 #define SQL_REAL 7
#define SQL_DOUBLE 8 #define SQL_DOUBLE 8
#define SQL_VARCHAR 12 #define SQL_VARCHAR 12
#define SQL_TYPE_MIN SQL_CHAR #define SQL_TYPE_MIN SQL_CHAR
#define SQL_TYPE_NULL 0 #define SQL_TYPE_NULL 0
#define SQL_TYPE_MAX SQL_VARCHAR #define SQL_TYPE_MAX SQL_VARCHAR
/* C to SQL datatype mapping */ /* C to SQL datatype mapping */
#define SQL_C_CHAR SQL_CHAR #define SQL_C_CHAR SQL_CHAR
#define SQL_C_LONG SQL_INTEGER #define SQL_C_LONG SQL_INTEGER
#define SQL_C_SHORT SQL_SMALLINT #define SQL_C_SHORT SQL_SMALLINT
#define SQL_C_FLOAT SQL_REAL #define SQL_C_FLOAT SQL_REAL
#define SQL_C_DOUBLE SQL_DOUBLE #define SQL_C_DOUBLE SQL_DOUBLE
#define SQL_C_DEFAULT 99 #define SQL_C_DEFAULT 99
#define SQL_NO_NULLS 0 #define SQL_NO_NULLS 0
#define SQL_NULLABLE 1 #define SQL_NULLABLE 1
#define SQL_NULLABLE_UNKNOWN 2 #define SQL_NULLABLE_UNKNOWN 2
/* some special length values */ /* some special length values */
#define SQL_NULL_DATA (-1) #define SQL_NULL_DATA (-1)
#define SQL_DATA_AT_EXEC (-2) #define SQL_DATA_AT_EXEC (-2)
#define SQL_NTS (-3) #define SQL_NTS (-3)
/* SQLFreeStmt flag values */ /* SQLFreeStmt flag values */
#define SQL_CLOSE 0 #define SQL_CLOSE 0
#define SQL_DROP 1 #define SQL_DROP 1
#define SQL_UNBIND 2 #define SQL_UNBIND 2
#define SQL_RESET_PARAMS 3 #define SQL_RESET_PARAMS 3
/* SQLTransact flag values */ /* SQLTransact flag values */
#define SQL_COMMIT 0 #define SQL_COMMIT 0
#define SQL_ROLLBACK 1 #define SQL_ROLLBACK 1
/* SQLColAttributes flag values */ /* SQLColAttributes flag values */
#define SQL_COLUMN_COUNT 0 #define SQL_COLUMN_COUNT 0
#define SQL_COLUMN_LABEL 18 #define SQL_COLUMN_LABEL 18
#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL #define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
#define SQL_COLUMN_DRIVER_START 1000 #define SQL_COLUMN_DRIVER_START 1000
#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT #define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
/* Null handles */ /* Null handles */
#define SQL_NULL_HENV 0 #define SQL_NULL_HENV 0
#define SQL_NULL_HDBC 0 #define SQL_NULL_HDBC 0
#define SQL_NULL_HSTMT 0 #define SQL_NULL_HSTMT 0
/* All code below has been added to the original isql.h coming from iodbc */ /* All code below has been added to the original isql.h coming from iodbc */
typedef unsigned char BYTE; typedef unsigned char BYTE;
/* More SQLColAttributes flag values */ /* More SQLColAttributes flag values */
#define SQL_COLUMN_NAME 1 #define SQL_COLUMN_NAME 1
#define SQL_COLUMN_TYPE 2 #define SQL_COLUMN_TYPE 2
#define SQL_COLUMN_LENGTH 3 #define SQL_COLUMN_LENGTH 3
#define SQL_COLUMN_PRECISION 4 #define SQL_COLUMN_PRECISION 4
#define SQL_COLUMN_SCALE 5 #define SQL_COLUMN_SCALE 5
#define SQL_COLUMN_DISPLAY_SIZE 6 #define SQL_COLUMN_DISPLAY_SIZE 6
#define SQL_COLUMN_NULLABLE 7 #define SQL_COLUMN_NULLABLE 7
#define SQL_COLUMN_UNSIGNED 8 #define SQL_COLUMN_UNSIGNED 8
#define SQL_COLUMN_MONEY 9 #define SQL_COLUMN_MONEY 9
#define SQL_COLUMN_UPDATABLE 10 #define SQL_COLUMN_UPDATABLE 10
#define SQL_COLUMN_AUTO_INCREMENT 11 #define SQL_COLUMN_AUTO_INCREMENT 11
#define SQL_COLUMN_CASE_SENSITIVE 12 #define SQL_COLUMN_CASE_SENSITIVE 12
#define SQL_COLUMN_SEARCHABLE 13 #define SQL_COLUMN_SEARCHABLE 13
#define SQL_COLUMN_TYPE_NAME 14 #define SQL_COLUMN_TYPE_NAME 14
#define SQL_COLUMN_TABLE_NAME 15 #define SQL_COLUMN_TABLE_NAME 15
#define SQL_COLUMN_OWNER_NAME 16 #define SQL_COLUMN_OWNER_NAME 16
#define SQL_COLUMN_QUALIFIER_NAME 17 #define SQL_COLUMN_QUALIFIER_NAME 17
/* SQLColAttributes Searchable flags */ /* SQLColAttributes Searchable flags */
#define SQL_UNSEARCHABLE 0 #define SQL_UNSEARCHABLE 0
#define SQL_LIKE_ONLY 1 #define SQL_LIKE_ONLY 1
#define SQL_ALL_EXCEPT_LIKE 2 #define SQL_ALL_EXCEPT_LIKE 2
#define SQL_SEARCHABLE 3 #define SQL_SEARCHABLE 3
#define SQL_PRED_SEARCHABLE SQL_SEARCHABLE #define SQL_PRED_SEARCHABLE SQL_SEARCHABLE
/* SQLColAttributes Updateable flags */ /* SQLColAttributes Updateable flags */
#define SQL_ATTR_READONLY 0 #define SQL_ATTR_READONLY 0
#define SQL_ATTR_WRITE 1 #define SQL_ATTR_WRITE 1
#define SQL_ATTR_READWRITE_UNKNOWN 2 #define SQL_ATTR_READWRITE_UNKNOWN 2
/* /*
* function prototypes previously not contained in isql.h * function prototypes previously not contained in isql.h
......
This diff is collapsed.
/* Module: lobj.c /* Module: lobj.c
* *
* Description: This module contains routines related to manipulating * Description: This module contains routines related to manipulating
......
/* File: lobj.h /* File: lobj.h
* *
* Description: See "lobj.c" * Description: See "lobj.c"
...@@ -24,17 +23,17 @@ struct lo_arg ...@@ -24,17 +23,17 @@ struct lo_arg
} u; } u;
}; };
#define LO_CREAT 957 #define LO_CREAT 957
#define LO_OPEN 952 #define LO_OPEN 952
#define LO_CLOSE 953 #define LO_CLOSE 953
#define LO_READ 954 #define LO_READ 954
#define LO_WRITE 955 #define LO_WRITE 955
#define LO_LSEEK 956 #define LO_LSEEK 956
#define LO_TELL 958 #define LO_TELL 958
#define LO_UNLINK 964 #define LO_UNLINK 964
#define INV_WRITE 0x00020000 #define INV_WRITE 0x00020000
#define INV_READ 0x00040000 #define INV_READ 0x00040000
Oid lo_creat(ConnectionClass *conn, int mode); Oid lo_creat(ConnectionClass *conn, int mode);
int lo_open(ConnectionClass *conn, int lobjId, int mode); int lo_open(ConnectionClass *conn, int lobjId, int mode);
......
/* Module: misc.c /* Module: misc.c
* *
* Description: This module contains miscellaneous routines * Description: This module contains miscellaneous routines
......
/* File: misc.h /* File: misc.h
* *
* Description: See "misc.c" * Description: See "misc.c"
...@@ -39,11 +38,11 @@ ...@@ -39,11 +38,11 @@
#ifdef MY_LOG #ifdef MY_LOG
#define MYLOGFILE "mylog_" #define MYLOGFILE "mylog_"
#ifndef WIN32 #ifndef WIN32
#define MYLOGDIR "/tmp" #define MYLOGDIR "/tmp"
#else #else
#define MYLOGDIR "c:" #define MYLOGDIR "c:"
#endif #endif
extern void mylog(char *fmt,...); extern void mylog(char *fmt,...);
...@@ -56,11 +55,11 @@ extern void mylog(char *fmt,...); ...@@ -56,11 +55,11 @@ extern void mylog(char *fmt,...);
#endif #endif
#ifdef Q_LOG #ifdef Q_LOG
#define QLOGFILE "psqlodbc_" #define QLOGFILE "psqlodbc_"
#ifndef WIN32 #ifndef WIN32
#define QLOGDIR "/tmp" #define QLOGDIR "/tmp"
#else #else
#define QLOGDIR "c:" #define QLOGDIR "c:"
#endif #endif
extern void qlog(char *fmt,...); extern void qlog(char *fmt,...);
...@@ -73,19 +72,19 @@ extern void qlog(char *fmt,...); ...@@ -73,19 +72,19 @@ extern void qlog(char *fmt,...);
#endif #endif
#ifndef WIN32 #ifndef WIN32
#define DIRSEPARATOR "/" #define DIRSEPARATOR "/"
#else #else
#define DIRSEPARATOR "\\" #define DIRSEPARATOR "\\"
#endif #endif
#ifdef WIN32 #ifdef WIN32
#define PG_BINARY O_BINARY #define PG_BINARY O_BINARY
#define PG_BINARY_R "rb" #define PG_BINARY_R "rb"
#define PG_BINARY_W "wb" #define PG_BINARY_W "wb"
#else #else
#define PG_BINARY 0 #define PG_BINARY 0
#define PG_BINARY_R "r" #define PG_BINARY_R "r"
#define PG_BINARY_W "w" #define PG_BINARY_W "w"
#endif #endif
...@@ -98,8 +97,8 @@ char *my_strcat(char *buf, char *fmt, char *s, int len); ...@@ -98,8 +97,8 @@ char *my_strcat(char *buf, char *fmt, char *s, int len);
/* defines for return value of my_strcpy */ /* defines for return value of my_strcpy */
#define STRCPY_SUCCESS 1 #define STRCPY_SUCCESS 1
#define STRCPY_FAIL 0 #define STRCPY_FAIL 0
#define STRCPY_TRUNCATED -1 #define STRCPY_TRUNCATED (-1)
#define STRCPY_NULL -2 #define STRCPY_NULL (-2)
int my_strcpy(char *dst, int dst_len, char *src, int src_len); int my_strcpy(char *dst, int dst_len, char *src, int src_len);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Create 2001-03-03 Eiji Tokuya * Create 2001-03-03 Eiji Tokuya
* *
*/ */
#include <string.h> #include <string.h>
#include "multibyte.h" #include "multibyte.h"
......
...@@ -2,32 +2,31 @@ ...@@ -2,32 +2,31 @@
* *
* Multibyte library header ( psqlODBC Only ) * Multibyte library header ( psqlODBC Only )
* *
*
*/ */
/* PostgreSQL client encoding */ /* PostgreSQL client encoding */
#define SQL_ASCII 0 /* SQL/ASCII */ #define SQL_ASCII 0 /* SQL/ASCII */
#define EUC_JP 1 /* EUC for Japanese */ #define EUC_JP 1 /* EUC for Japanese */
#define EUC_CN 2 /* EUC for Chinese */ #define EUC_CN 2 /* EUC for Chinese */
#define EUC_KR 3 /* EUC for Korean */ #define EUC_KR 3 /* EUC for Korean */
#define EUC_TW 4 /* EUC for Taiwan */ #define EUC_TW 4 /* EUC for Taiwan */
#define UNICODE 5 /* Unicode UTF-8 */ #define UNICODE 5 /* Unicode UTF-8 */
#define MULE_INTERNAL 6 /* Mule internal code */ #define MULE_INTERNAL 6 /* Mule internal code */
#define LATIN1 7 /* ISO-8859 Latin 1 */ #define LATIN1 7 /* ISO-8859 Latin 1 */
#define LATIN2 8 /* ISO-8859 Latin 2 */ #define LATIN2 8 /* ISO-8859 Latin 2 */
#define LATIN3 9 /* ISO-8859 Latin 3 */ #define LATIN3 9 /* ISO-8859 Latin 3 */
#define LATIN4 10 /* ISO-8859 Latin 4 */ #define LATIN4 10 /* ISO-8859 Latin 4 */
#define LATIN5 11 /* ISO-8859 Latin 5 */ #define LATIN5 11 /* ISO-8859 Latin 5 */
#define LATIN6 12 /* ISO-8859 Latin 6 */ #define LATIN6 12 /* ISO-8859 Latin 6 */
#define LATIN7 13 /* ISO-8859 Latin 7 */ #define LATIN7 13 /* ISO-8859 Latin 7 */
#define LATIN8 14 /* ISO-8859 Latin 8 */ #define LATIN8 14 /* ISO-8859 Latin 8 */
#define LATIN9 15 /* ISO-8859 Latin 9 */ #define LATIN9 15 /* ISO-8859 Latin 9 */
#define KOI8 16 /* KOI8-R */ #define KOI8 16 /* KOI8-R */
#define WIN 17 /* windows-1251 */ #define WIN 17 /* windows-1251 */
#define ALT 18 /* Alternativny Variant (MS-DOS CP866) */ #define ALT 18 /* Alternativny Variant (MS-DOS CP866) */
#define SJIS 32 /* Shift JIS */ #define SJIS 32 /* Shift JIS */
#define BIG5 33 /* Big5 */ #define BIG5 33 /* Big5 */
#define WIN1250 34 /* windows-1250 */ #define WIN1250 34 /* windows-1250 */
extern int multibyte_client_encoding; /* Multibyte client encoding. */ extern int multibyte_client_encoding; /* Multibyte client encoding. */
......
/* Module: options.c /* Module: options.c
* *
* Description: This module contains routines for getting/setting * Description: This module contains routines for getting/setting
......
/* Module: parse.c /* Module: parse.c
* *
* Description: This module contains routines related to parsing SQL statements. * Description: This module contains routines related to parsing SQL statements.
......
/* Module: pgtypes.c /* Module: pgtypes.c
* *
* Description: This module contains routines for getting information * Description: This module contains routines for getting information
......
/* File: pgtypes.h /* File: pgtypes.h
* *
* Description: See "pgtypes.c" * Description: See "pgtypes.c"
...@@ -17,57 +16,57 @@ ...@@ -17,57 +16,57 @@
#if 0 #if 0
#define PG_TYPE_LO ????/* waiting for permanent type */ #define PG_TYPE_LO ???? /* waiting for permanent type */
#endif #endif
#define PG_TYPE_BOOL 16 #define PG_TYPE_BOOL 16
#define PG_TYPE_BYTEA 17 #define PG_TYPE_BYTEA 17
#define PG_TYPE_CHAR 18 #define PG_TYPE_CHAR 18
#define PG_TYPE_NAME 19 #define PG_TYPE_NAME 19
#define PG_TYPE_INT8 20 #define PG_TYPE_INT8 20
#define PG_TYPE_INT2 21 #define PG_TYPE_INT2 21
#define PG_TYPE_INT2VECTOR 22 #define PG_TYPE_INT2VECTOR 22
#define PG_TYPE_INT4 23 #define PG_TYPE_INT4 23
#define PG_TYPE_REGPROC 24 #define PG_TYPE_REGPROC 24
#define PG_TYPE_TEXT 25 #define PG_TYPE_TEXT 25
#define PG_TYPE_OID 26 #define PG_TYPE_OID 26
#define PG_TYPE_TID 27 #define PG_TYPE_TID 27
#define PG_TYPE_XID 28 #define PG_TYPE_XID 28
#define PG_TYPE_CID 29 #define PG_TYPE_CID 29
#define PG_TYPE_OIDVECTOR 30 #define PG_TYPE_OIDVECTOR 30
#define PG_TYPE_SET 32 #define PG_TYPE_SET 32
#define PG_TYPE_CHAR2 409 #define PG_TYPE_CHAR2 409
#define PG_TYPE_CHAR4 410 #define PG_TYPE_CHAR4 410
#define PG_TYPE_CHAR8 411 #define PG_TYPE_CHAR8 411
#define PG_TYPE_POINT 600 #define PG_TYPE_POINT 600
#define PG_TYPE_LSEG 601 #define PG_TYPE_LSEG 601
#define PG_TYPE_PATH 602 #define PG_TYPE_PATH 602
#define PG_TYPE_BOX 603 #define PG_TYPE_BOX 603
#define PG_TYPE_POLYGON 604 #define PG_TYPE_POLYGON 604
#define PG_TYPE_FILENAME 605 #define PG_TYPE_FILENAME 605
#define PG_TYPE_FLOAT4 700 #define PG_TYPE_FLOAT4 700
#define PG_TYPE_FLOAT8 701 #define PG_TYPE_FLOAT8 701
#define PG_TYPE_ABSTIME 702 #define PG_TYPE_ABSTIME 702
#define PG_TYPE_RELTIME 703 #define PG_TYPE_RELTIME 703
#define PG_TYPE_TINTERVAL 704 #define PG_TYPE_TINTERVAL 704
#define PG_TYPE_UNKNOWN 705 #define PG_TYPE_UNKNOWN 705
#define PG_TYPE_MONEY 790 #define PG_TYPE_MONEY 790
#define PG_TYPE_OIDINT2 810 #define PG_TYPE_OIDINT2 810
#define PG_TYPE_OIDINT4 910 #define PG_TYPE_OIDINT4 910
#define PG_TYPE_OIDNAME 911 #define PG_TYPE_OIDNAME 911
#define PG_TYPE_BPCHAR 1042 #define PG_TYPE_BPCHAR 1042
#define PG_TYPE_VARCHAR 1043 #define PG_TYPE_VARCHAR 1043
#define PG_TYPE_DATE 1082 #define PG_TYPE_DATE 1082
#define PG_TYPE_TIME 1083 #define PG_TYPE_TIME 1083
#define PG_TYPE_DATETIME 1184 #define PG_TYPE_DATETIME 1184
#define PG_TYPE_TIMESTAMP 1296 #define PG_TYPE_TIMESTAMP 1296
#define PG_TYPE_NUMERIC 1700 #define PG_TYPE_NUMERIC 1700
/* extern Int4 pgtypes_defined[]; */ /* extern Int4 pgtypes_defined[]; */
extern Int2 sqlTypes[]; extern Int2 sqlTypes[];
/* Defines for pgtype_precision */ /* Defines for pgtype_precision */
#define PG_STATIC -1 #define PG_STATIC (-1)
Int4 sqltype_to_pgtype(Int2 fSqlType); Int4 sqltype_to_pgtype(Int2 fSqlType);
......
/* Module: psqlodbc.c /* Module: psqlodbc.c
* *
* Description: This module contains the main entry point (DllMain) for the library. * Description: This module contains the main entry point (DllMain) for the library.
......
/* File: psqlodbc.h /* File: psqlodbc.h
* *
* Description: This file contains defines and declarations that are related to * Description: This file contains defines and declarations that are related to
...@@ -6,7 +5,8 @@ ...@@ -6,7 +5,8 @@
* *
* Comments: See "notice.txt" for copyright and license information. * Comments: See "notice.txt" for copyright and license information.
* *
* $Id: psqlodbc.h,v 1.40 2001/03/22 04:01:35 momjian Exp $ * $Id: psqlodbc.h,v 1.41 2001/03/27 04:00:54 momjian Exp $
*
*/ */
#ifndef __PSQLODBC_H__ #ifndef __PSQLODBC_H__
...@@ -36,18 +36,18 @@ typedef double SDOUBLE; ...@@ -36,18 +36,18 @@ typedef double SDOUBLE;
typedef UInt4 Oid; typedef UInt4 Oid;
/* Driver stuff */ /* Driver stuff */
#define ODBCVER 0x0250 #define ODBCVER 0x0250
#define DRIVER_ODBC_VER "02.50" #define DRIVER_ODBC_VER "02.50"
#define DRIVERNAME "PostgreSQL ODBC" #define DRIVERNAME "PostgreSQL ODBC"
#define DBMS_NAME "PostgreSQL" #define DBMS_NAME "PostgreSQL"
#define POSTGRESDRIVERVERSION "07.01.0004" #define POSTGRESDRIVERVERSION "07.01.0004"
#ifdef WIN32 #ifdef WIN32
#define DRIVER_FILE_NAME "PSQLODBC.DLL" #define DRIVER_FILE_NAME "PSQLODBC.DLL"
#else #else
#define DRIVER_FILE_NAME "libpsqlodbc.so" #define DRIVER_FILE_NAME "libpsqlodbc.so"
#endif #endif
/* Limits */ /* Limits */
...@@ -83,27 +83,28 @@ typedef UInt4 Oid; ...@@ -83,27 +83,28 @@ typedef UInt4 Oid;
/* These prefixes denote system tables */ /* These prefixes denote system tables */
#define POSTGRES_SYS_PREFIX "pg_" #define POSTGRES_SYS_PREFIX "pg_"
#define KEYS_TABLE "dd_fkey" #define KEYS_TABLE "dd_fkey"
/* Info limits */ /* Info limits */
#define MAX_INFO_STRING 128 #define MAX_INFO_STRING 128
#define MAX_KEYPARTS 20 #define MAX_KEYPARTS 20
#define MAX_KEYLEN 512 /* max key of the form #define MAX_KEYLEN 512 /* max key of the form
* "date+outlet+invoice" */ * "date+outlet+invoice" */
#define MAX_ROW_SIZE 0 /* Unlimited rowsize with the Tuple #define MAX_ROW_SIZE 0 /* Unlimited rowsize with the
* Toaster */ * Tuple Toaster */
#define MAX_STATEMENT_LEN 0 /* Unlimited statement size with 7.0 */ #define MAX_STATEMENT_LEN 0 /* Unlimited statement size with
* 7.0 */
/* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */ /* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
/* Now that's 0, lets use this instead. DJP 24-1-2001 */ /* Now that's 0, lets use this instead. DJP 24-1-2001 */
#define STD_STATEMENT_LEN MAX_MESSAGE_LEN #define STD_STATEMENT_LEN MAX_MESSAGE_LEN
#define PG62 "6.2" /* "Protocol" key setting to force #define PG62 "6.2" /* "Protocol" key setting
* Postgres 6.2 */ * to force Postgres 6.2 */
#define PG63 "6.3" /* "Protocol" key setting to force #define PG63 "6.3" /* "Protocol" key setting
* postgres 6.3 */ * to force postgres 6.3 */
#define PG64 "6.4" #define PG64 "6.4"
typedef struct ConnectionClass_ ConnectionClass; typedef struct ConnectionClass_ ConnectionClass;
typedef struct StatementClass_ StatementClass; typedef struct StatementClass_ StatementClass;
...@@ -173,17 +174,18 @@ typedef struct QueryInfo_ ...@@ -173,17 +174,18 @@ typedef struct QueryInfo_
} QueryInfo; } QueryInfo;
#define PG_TYPE_LO -999 /* hack until permanent type #define PG_TYPE_LO (-999) /* hack until permanent
* available */ * type available */
#define PG_TYPE_LO_NAME "lo" #define PG_TYPE_LO_NAME "lo"
#define OID_ATTNUM -2 /* the attnum in pg_index of the #define OID_ATTNUM (-2) /* the attnum in pg_index
* oid */ * of the oid */
/* sizes */ /* sizes */
#define TEXT_FIELD_SIZE 8190 /* size of text fields (not #define TEXT_FIELD_SIZE 8190 /* size of text fields
* including null term) */ * (not including null
#define NAME_FIELD_SIZE 32 /* size of name fields */ * term) */
#define MAX_VARCHAR_SIZE 254 /* maximum size of a varchar (not #define NAME_FIELD_SIZE 32 /* size of name fields */
#define MAX_VARCHAR_SIZE 254 /* maximum size of a varchar (not
* including null term) */ * including null term) */
#define PG_NUMERIC_MAX_PRECISION 1000 #define PG_NUMERIC_MAX_PRECISION 1000
......
/* Module: qresult.c /* Module: qresult.c
* *
* Description: This module contains functions related to * Description: This module contains functions related to
......
/* File: qresult.h /* File: qresult.h
* *
* Description: See "qresult.c" * Description: See "qresult.c"
...@@ -72,7 +71,7 @@ struct QResultClass_ ...@@ -72,7 +71,7 @@ struct QResultClass_
char aborted; /* was aborted? */ char aborted; /* was aborted? */
}; };
#define QR_get_fields(self) (self->fields) #define QR_get_fields(self) (self->fields)
/* These functions are for retrieving data from the qresult */ /* These functions are for retrieving data from the qresult */
...@@ -94,20 +93,20 @@ struct QResultClass_ ...@@ -94,20 +93,20 @@ struct QResultClass_
#define QR_set_field_info(self, field_num, name, adtid, adtsize) (CI_set_field_info(self->fields, field_num, name, adtid, adtsize, -1)) #define QR_set_field_info(self, field_num, name, adtid, adtsize) (CI_set_field_info(self->fields, field_num, name, adtid, adtsize, -1))
/* status macros */ /* status macros */
#define QR_command_successful(self) ( !(self->status == PGRES_BAD_RESPONSE || self->status == PGRES_NONFATAL_ERROR || self->status == PGRES_FATAL_ERROR)) #define QR_command_successful(self) ( !(self->status == PGRES_BAD_RESPONSE || self->status == PGRES_NONFATAL_ERROR || self->status == PGRES_FATAL_ERROR))
#define QR_command_nonfatal(self) ( self->status == PGRES_NONFATAL_ERROR) #define QR_command_nonfatal(self) ( self->status == PGRES_NONFATAL_ERROR)
#define QR_end_tuples(self) ( self->status == PGRES_END_TUPLES) #define QR_end_tuples(self) ( self->status == PGRES_END_TUPLES)
#define QR_set_status(self, condition) ( self->status = condition ) #define QR_set_status(self, condition) ( self->status = condition )
#define QR_set_message(self, message_) ( self->message = message_) #define QR_set_message(self, message_) ( self->message = message_)
#define QR_set_aborted(self, aborted_) ( self->aborted = aborted_) #define QR_set_aborted(self, aborted_) ( self->aborted = aborted_)
#define QR_get_message(self) (self->message) #define QR_get_message(self) (self->message)
#define QR_get_command(self) (self->command) #define QR_get_command(self) (self->command)
#define QR_get_notice(self) (self->notice) #define QR_get_notice(self) (self->notice)
#define QR_get_status(self) (self->status) #define QR_get_status(self) (self->status)
#define QR_get_aborted(self) (self->aborted) #define QR_get_aborted(self) (self->aborted)
#define QR_aborted(self) (!self || self->aborted) #define QR_aborted(self) (!self || self->aborted)
/* Core Functions */ /* Core Functions */
QResultClass *QR_Constructor(void); QResultClass *QR_Constructor(void);
......
/* Module: results.c /* Module: results.c
* *
* Description: This module contains functions related to * Description: This module contains functions related to
......
/* Module: setup.c /* Module: setup.c
* *
* Description: This module contains the setup functions for * Description: This module contains the setup functions for
...@@ -11,7 +10,7 @@ ...@@ -11,7 +10,7 @@
* *
* Comments: See "notice.txt" for copyright and license information. * Comments: See "notice.txt" for copyright and license information.
* *
*************************************************************************************/ */
#include "psqlodbc.h" #include "psqlodbc.h"
#include "connection.h" #include "connection.h"
......
/* Module: socket.c /* Module: socket.c
* *
* Description: This module contains functions for low level socket * Description: This module contains functions for low level socket
......
/* File: socket.h /* File: socket.h
* *
* Description: See "socket.c" * Description: See "socket.c"
...@@ -41,16 +40,16 @@ typedef unsigned int in_addr_t; ...@@ -41,16 +40,16 @@ typedef unsigned int in_addr_t;
#include "psqlodbc.h" #include "psqlodbc.h"
#define SOCKET_ALREADY_CONNECTED 1 #define SOCKET_ALREADY_CONNECTED 1
#define SOCKET_HOST_NOT_FOUND 2 #define SOCKET_HOST_NOT_FOUND 2
#define SOCKET_COULD_NOT_CREATE_SOCKET 3 #define SOCKET_COULD_NOT_CREATE_SOCKET 3
#define SOCKET_COULD_NOT_CONNECT 4 #define SOCKET_COULD_NOT_CONNECT 4
#define SOCKET_READ_ERROR 5 #define SOCKET_READ_ERROR 5
#define SOCKET_WRITE_ERROR 6 #define SOCKET_WRITE_ERROR 6
#define SOCKET_NULLPOINTER_PARAMETER 7 #define SOCKET_NULLPOINTER_PARAMETER 7
#define SOCKET_PUT_INT_WRONG_LENGTH 8 #define SOCKET_PUT_INT_WRONG_LENGTH 8
#define SOCKET_GET_INT_WRONG_LENGTH 9 #define SOCKET_GET_INT_WRONG_LENGTH 9
#define SOCKET_CLOSED 10 #define SOCKET_CLOSED 10
struct SocketClass_ struct SocketClass_
......
/* Module: statement.c /* Module: statement.c
* *
* Description: This module contains functions related to creating * Description: This module contains functions related to creating
......
/* File: statement.h /* File: statement.h
* *
* Description: See "statement.c" * Description: See "statement.c"
...@@ -50,38 +49,40 @@ typedef enum ...@@ -50,38 +49,40 @@ typedef enum
STMT_EXECUTING /* statement execution is still going on */ STMT_EXECUTING /* statement execution is still going on */
} STMT_Status; } STMT_Status;
#define STMT_TRUNCATED -2 #define STMT_TRUNCATED (-2)
#define STMT_INFO_ONLY -1 /* not an error message, just a #define STMT_INFO_ONLY (-1) /* not an error message,
* notification to be returned by SQLError */ * just a notification
#define STMT_OK 0 /* will be interpreted as "no error * to be returned by
* pending" */ * SQLError */
#define STMT_EXEC_ERROR 1 #define STMT_OK 0 /* will be interpreted
#define STMT_STATUS_ERROR 2 * as "no error pending" */
#define STMT_SEQUENCE_ERROR 3 #define STMT_EXEC_ERROR 1
#define STMT_NO_MEMORY_ERROR 4 #define STMT_STATUS_ERROR 2
#define STMT_COLNUM_ERROR 5 #define STMT_SEQUENCE_ERROR 3
#define STMT_NO_STMTSTRING 6 #define STMT_NO_MEMORY_ERROR 4
#define STMT_ERROR_TAKEN_FROM_BACKEND 7 #define STMT_COLNUM_ERROR 5
#define STMT_INTERNAL_ERROR 8 #define STMT_NO_STMTSTRING 6
#define STMT_STILL_EXECUTING 9 #define STMT_ERROR_TAKEN_FROM_BACKEND 7
#define STMT_NOT_IMPLEMENTED_ERROR 10 #define STMT_INTERNAL_ERROR 8
#define STMT_BAD_PARAMETER_NUMBER_ERROR 11 #define STMT_STILL_EXECUTING 9
#define STMT_OPTION_OUT_OF_RANGE_ERROR 12 #define STMT_NOT_IMPLEMENTED_ERROR 10
#define STMT_INVALID_COLUMN_NUMBER_ERROR 13 #define STMT_BAD_PARAMETER_NUMBER_ERROR 11
#define STMT_RESTRICTED_DATA_TYPE_ERROR 14 #define STMT_OPTION_OUT_OF_RANGE_ERROR 12
#define STMT_INVALID_CURSOR_STATE_ERROR 15 #define STMT_INVALID_COLUMN_NUMBER_ERROR 13
#define STMT_OPTION_VALUE_CHANGED 16 #define STMT_RESTRICTED_DATA_TYPE_ERROR 14
#define STMT_CREATE_TABLE_ERROR 17 #define STMT_INVALID_CURSOR_STATE_ERROR 15
#define STMT_NO_CURSOR_NAME 18 #define STMT_OPTION_VALUE_CHANGED 16
#define STMT_INVALID_CURSOR_NAME 19 #define STMT_CREATE_TABLE_ERROR 17
#define STMT_INVALID_ARGUMENT_NO 20 #define STMT_NO_CURSOR_NAME 18
#define STMT_ROW_OUT_OF_RANGE 21 #define STMT_INVALID_CURSOR_NAME 19
#define STMT_OPERATION_CANCELLED 22 #define STMT_INVALID_ARGUMENT_NO 20
#define STMT_INVALID_CURSOR_POSITION 23 #define STMT_ROW_OUT_OF_RANGE 21
#define STMT_VALUE_OUT_OF_RANGE 24 #define STMT_OPERATION_CANCELLED 22
#define STMT_OPERATION_INVALID 25 #define STMT_INVALID_CURSOR_POSITION 23
#define STMT_PROGRAM_TYPE_OUT_OF_RANGE 26 #define STMT_VALUE_OUT_OF_RANGE 24
#define STMT_BAD_ERROR 27 #define STMT_OPERATION_INVALID 25
#define STMT_PROGRAM_TYPE_OUT_OF_RANGE 26
#define STMT_BAD_ERROR 27
/* statement types */ /* statement types */
enum enum
......
/* Module: tuple.c /* Module: tuple.c
* *
* Description: This module contains functions for setting the data for individual * Description: This module contains functions for setting the data for individual
......
/* File: tuple.h /* File: tuple.h
* *
* Description: See "tuple.c" * Description: See "tuple.c"
......
/* Module: tuplelist.c /* Module: tuplelist.c
* *
* Description: This module contains functions for creating a manual result set * Description: This module contains functions for creating a manual result set
......
/* File: tuplelist.h /* File: tuplelist.h
* *
* Description: See "tuplelist.c" * Description: See "tuplelist.c"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment