Commit 755a8733 authored by Bruce Momjian's avatar Bruce Momjian

Run pgindent over ODBC source. We couldn't do this years ago because we

weren't the master source.  We are now, and it really needs it.
parent 505a828a
This diff is collapsed.
...@@ -15,18 +15,24 @@ ...@@ -15,18 +15,24 @@
/* /*
* BindInfoClass -- stores information about a bound column * BindInfoClass -- stores information about a bound column
*/ */
struct BindInfoClass_ { struct BindInfoClass_
{
Int4 buflen; /* size of buffer */ Int4 buflen; /* size of buffer */
Int4 data_left; /* amount of data left to read (SQLGetData) */ Int4 data_left; /* amount of data left to read
* (SQLGetData) */
char *buffer; /* pointer to the buffer */ char *buffer; /* pointer to the buffer */
Int4 *used; /* used space in the buffer (for strings not counting the '\0') */ Int4 *used; /* used space in the buffer (for strings
Int2 returntype; /* kind of conversion to be applied when returning (SQL_C_DEFAULT, SQL_C_CHAR...) */ * not counting the '\0') */
Int2 returntype; /* kind of conversion to be applied when
* returning (SQL_C_DEFAULT,
* SQL_C_CHAR...) */
}; };
/* /*
* ParameterInfoClass -- stores information about a bound parameter * ParameterInfoClass -- stores information about a bound parameter
*/ */
struct ParameterInfoClass_ { struct ParameterInfoClass_
{
Int4 buflen; Int4 buflen;
char *buffer; char *buffer;
Int4 *used; Int4 *used;
...@@ -36,12 +42,13 @@ struct ParameterInfoClass_ { ...@@ -36,12 +42,13 @@ struct ParameterInfoClass_ {
UInt4 precision; UInt4 precision;
Int2 scale; Int2 scale;
Oid lobj_oid; Oid lobj_oid;
Int4 *EXEC_used; /* amount of data OR the oid of the large object */ Int4 *EXEC_used; /* amount of data OR the oid of the large
* object */
char *EXEC_buffer; /* the data or the FD of the large object */ char *EXEC_buffer; /* the data or the FD of the large object */
char data_at_exec; char data_at_exec;
}; };
BindInfoClass *create_empty_bindings(int num_columns); BindInfoClass *create_empty_bindings(int num_columns);
void extend_bindings(StatementClass *stmt, int num_columns); void extend_bindings(StatementClass * stmt, int num_columns);
#endif #endif
...@@ -20,11 +20,12 @@ ...@@ -20,11 +20,12 @@
ColumnInfoClass * ColumnInfoClass *
CI_Constructor() CI_Constructor()
{ {
ColumnInfoClass *rv; ColumnInfoClass *rv;
rv = (ColumnInfoClass *) malloc(sizeof(ColumnInfoClass)); rv = (ColumnInfoClass *) malloc(sizeof(ColumnInfoClass));
if (rv) { if (rv)
{
rv->num_fields = 0; rv->num_fields = 0;
rv->name = NULL; rv->name = NULL;
rv->adtid = NULL; rv->adtid = NULL;
...@@ -37,7 +38,7 @@ ColumnInfoClass *rv; ...@@ -37,7 +38,7 @@ ColumnInfoClass *rv;
} }
void void
CI_Destructor(ColumnInfoClass *self) CI_Destructor(ColumnInfoClass * self)
{ {
CI_free_memory(self); CI_free_memory(self);
...@@ -49,16 +50,16 @@ CI_Destructor(ColumnInfoClass *self) ...@@ -49,16 +50,16 @@ CI_Destructor(ColumnInfoClass *self)
If self is null, then just read, don't store. If self is null, then just read, don't store.
*/ */
char char
CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn) CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn)
{ {
Int2 lf; Int2 lf;
int new_num_fields; int new_num_fields;
Oid new_adtid; Oid new_adtid;
Int2 new_adtsize; Int2 new_adtsize;
Int4 new_atttypmod = -1; Int4 new_atttypmod = -1;
char new_field_name[MAX_MESSAGE_LEN+1]; char new_field_name[MAX_MESSAGE_LEN + 1];
SocketClass *sock; SocketClass *sock;
ConnInfo *ci; ConnInfo *ci;
sock = CC_get_socket(conn); sock = CC_get_socket(conn);
ci = &conn->connInfo; ci = &conn->connInfo;
...@@ -68,19 +69,22 @@ ConnInfo *ci; ...@@ -68,19 +69,22 @@ ConnInfo *ci;
mylog("num_fields = %d\n", new_num_fields); mylog("num_fields = %d\n", new_num_fields);
if (self) { /* according to that allocate memory */ if (self)
{ /* according to that allocate memory */
CI_set_num_fields(self, new_num_fields); CI_set_num_fields(self, new_num_fields);
} }
/* now read in the descriptions */ /* now read in the descriptions */
for(lf = 0; lf < new_num_fields; lf++) { for (lf = 0; lf < new_num_fields; lf++)
{
SOCK_get_string(sock, new_field_name, MAX_MESSAGE_LEN); SOCK_get_string(sock, new_field_name, MAX_MESSAGE_LEN);
new_adtid = (Oid) SOCK_get_int(sock, 4); new_adtid = (Oid) SOCK_get_int(sock, 4);
new_adtsize = (Int2) SOCK_get_int(sock, 2); new_adtsize = (Int2) SOCK_get_int(sock, 2);
/* If 6.4 protocol, then read the atttypmod field */ /* If 6.4 protocol, then read the atttypmod field */
if (PG_VERSION_GE(conn, 6.4)) { if (PG_VERSION_GE(conn, 6.4))
{
mylog("READING ATTTYPMOD\n"); mylog("READING ATTTYPMOD\n");
new_atttypmod = (Int4) SOCK_get_int(sock, 4); new_atttypmod = (Int4) SOCK_get_int(sock, 4);
...@@ -104,14 +108,15 @@ ConnInfo *ci; ...@@ -104,14 +108,15 @@ ConnInfo *ci;
void void
CI_free_memory(ColumnInfoClass *self) CI_free_memory(ColumnInfoClass * self)
{ {
register Int2 lf; register Int2 lf;
int num_fields = self->num_fields; int num_fields = self->num_fields;
for (lf = 0; lf < num_fields; lf++) { for (lf = 0; lf < num_fields; lf++)
if( self->name[lf]) {
free (self->name[lf]); if (self->name[lf])
free(self->name[lf]);
} }
/* Safe to call even if null */ /* Safe to call even if null */
...@@ -124,28 +129,27 @@ int num_fields = self->num_fields; ...@@ -124,28 +129,27 @@ int num_fields = self->num_fields;
} }
void void
CI_set_num_fields(ColumnInfoClass *self, int new_num_fields) CI_set_num_fields(ColumnInfoClass * self, int new_num_fields)
{ {
CI_free_memory(self); /* always safe to call */ CI_free_memory(self); /* always safe to call */
self->num_fields = new_num_fields; self->num_fields = new_num_fields;
self->name = (char **) malloc (sizeof(char *) * self->num_fields); self->name = (char **) malloc(sizeof(char *) * self->num_fields);
self->adtid = (Oid *) malloc (sizeof(Oid) * self->num_fields); self->adtid = (Oid *) malloc(sizeof(Oid) * self->num_fields);
self->adtsize = (Int2 *) malloc (sizeof(Int2) * self->num_fields); self->adtsize = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
self->display_size = (Int2 *) malloc(sizeof(Int2) * self->num_fields); self->display_size = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
self->atttypmod = (Int4 *) malloc(sizeof(Int4) * self->num_fields); self->atttypmod = (Int4 *) malloc(sizeof(Int4) * self->num_fields);
} }
void void
CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, CI_set_field_info(ColumnInfoClass * self, int field_num, char *new_name,
Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod) Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
{ {
/* check bounds */ /* check bounds */
if((field_num < 0) || (field_num >= self->num_fields)) { if ((field_num < 0) || (field_num >= self->num_fields))
return; return;
}
/* store the info */ /* store the info */
self->name[field_num] = strdup(new_name); self->name[field_num] = strdup(new_name);
...@@ -155,4 +159,3 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, ...@@ -155,4 +159,3 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
self->display_size[field_num] = 0; self->display_size[field_num] = 0;
} }
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
#include "psqlodbc.h" #include "psqlodbc.h"
struct ColumnInfoClass_ { struct ColumnInfoClass_
{
Int2 num_fields; Int2 num_fields;
char **name; /* list of type names */ char **name; /* list of type names */
Oid *adtid; /* list of type ids */ Oid *adtid; /* list of type ids */
...@@ -29,14 +30,14 @@ struct ColumnInfoClass_ { ...@@ -29,14 +30,14 @@ struct ColumnInfoClass_ {
#define CI_get_atttypmod(self, col) (self->atttypmod[col]) #define CI_get_atttypmod(self, col) (self->atttypmod[col])
ColumnInfoClass *CI_Constructor(void); ColumnInfoClass *CI_Constructor(void);
void CI_Destructor(ColumnInfoClass *self); void CI_Destructor(ColumnInfoClass * self);
void CI_free_memory(ColumnInfoClass *self); void CI_free_memory(ColumnInfoClass * self);
char CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn); char CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn);
/* functions for setting up the fields from within the program, */ /* functions for setting up the fields from within the program, */
/* without reading from a socket */ /* without reading from a socket */
void CI_set_num_fields(ColumnInfoClass *self, int new_num_fields); 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);
......
This diff is collapsed.
...@@ -27,11 +27,14 @@ ...@@ -27,11 +27,14 @@
#endif #endif
typedef enum { typedef enum
{
CONN_NOT_CONNECTED, /* Connection has not been established */ CONN_NOT_CONNECTED, /* Connection has not been established */
CONN_CONNECTED, /* Connection is up and has been established */ CONN_CONNECTED, /* Connection is up and has been
* established */
CONN_DOWN, /* Connection is broken */ CONN_DOWN, /* Connection is broken */
CONN_EXECUTING /* the connection is currently executing a statement */ CONN_EXECUTING /* the connection is currently executing a
* statement */
} CONN_Status; } CONN_Status;
/* These errors have general sql error state */ /* These errors have general sql error state */
...@@ -122,7 +125,8 @@ typedef struct _StartupPacket ...@@ -122,7 +125,8 @@ typedef struct _StartupPacket
/* Structure to hold all the connection attributes for a specific /* Structure to hold all the connection attributes for a specific
connection (used for both registry and file, DSN and DRIVER) connection (used for both registry and file, DSN and DRIVER)
*/ */
typedef struct { typedef struct
{
char dsn[MEDIUM_REGISTRY_LEN]; char dsn[MEDIUM_REGISTRY_LEN];
char desc[MEDIUM_REGISTRY_LEN]; char desc[MEDIUM_REGISTRY_LEN];
char driver[MEDIUM_REGISTRY_LEN]; char driver[MEDIUM_REGISTRY_LEN];
...@@ -180,9 +184,10 @@ typedef struct { ...@@ -180,9 +184,10 @@ typedef struct {
#define PG_VERSION_LT(conn, ver) (! PG_VERSION_GE(conn, ver)) #define PG_VERSION_LT(conn, ver) (! PG_VERSION_GE(conn, ver))
/* This is used to store cached table information in the connection */ /* This is used to store cached table information in the connection */
struct col_info { struct col_info
{
QResultClass *result; QResultClass *result;
char name[MAX_TABLE_LEN+1]; char name[MAX_TABLE_LEN + 1];
}; };
/* Translation DLL entry points */ /* Translation DLL entry points */
...@@ -194,7 +199,7 @@ struct col_info { ...@@ -194,7 +199,7 @@ struct col_info {
#define HINSTANCE void * #define HINSTANCE void *
#endif #endif
typedef BOOL (FAR WINAPI *DataSourceToDriverProc) (UDWORD, typedef BOOL(FAR WINAPI * DataSourceToDriverProc) (UDWORD,
SWORD, SWORD,
PTR, PTR,
SDWORD, SDWORD,
...@@ -205,7 +210,7 @@ typedef BOOL (FAR WINAPI *DataSourceToDriverProc) (UDWORD, ...@@ -205,7 +210,7 @@ typedef BOOL (FAR WINAPI *DataSourceToDriverProc) (UDWORD,
SWORD, SWORD,
SWORD FAR *); SWORD FAR *);
typedef BOOL (FAR WINAPI *DriverToDataSourceProc) (UDWORD, typedef BOOL(FAR WINAPI * DriverToDataSourceProc) (UDWORD,
SWORD, SWORD,
PTR, PTR,
SDWORD, SDWORD,
...@@ -217,8 +222,10 @@ typedef BOOL (FAR WINAPI *DriverToDataSourceProc) (UDWORD, ...@@ -217,8 +222,10 @@ typedef BOOL (FAR WINAPI *DriverToDataSourceProc) (UDWORD,
SWORD FAR *); SWORD FAR *);
/******* The Connection handle ************/ /******* The Connection handle ************/
struct ConnectionClass_ { struct ConnectionClass_
HENV henv; /* environment this connection was created on */ {
HENV henv; /* environment this connection was created
* on */
StatementOptions stmtOptions; StatementOptions stmtOptions;
char *errormsg; char *errormsg;
int errornumber; int errornumber;
...@@ -234,9 +241,13 @@ struct ConnectionClass_ { ...@@ -234,9 +241,13 @@ struct ConnectionClass_ {
HINSTANCE translation_handle; HINSTANCE translation_handle;
DataSourceToDriverProc DataSourceToDriver; DataSourceToDriverProc DataSourceToDriver;
DriverToDataSourceProc DriverToDataSource; DriverToDataSourceProc DriverToDataSource;
char transact_status; /* Is a transaction is currently in progress */ char transact_status;/* Is a transaction is currently in
char errormsg_created; /* has an informative error msg been created? */ * progress */
char pg_version[MAX_INFO_STRING]; /* Version of PostgreSQL we're connected to - DJP 25-1-2001 */ char errormsg_created; /* has an informative error msg
* been created? */
char pg_version[MAX_INFO_STRING]; /* Version of PostgreSQL
* we're connected to -
* DJP 25-1-2001 */
float pg_version_number; float pg_version_number;
Int2 pg_version_major; Int2 pg_version_major;
Int2 pg_version_minor; Int2 pg_version_minor;
...@@ -259,24 +270,24 @@ struct ConnectionClass_ { ...@@ -259,24 +270,24 @@ struct ConnectionClass_ {
/* prototypes */ /* prototypes */
ConnectionClass *CC_Constructor(void); ConnectionClass *CC_Constructor(void);
char CC_Destructor(ConnectionClass *self); char CC_Destructor(ConnectionClass * self);
int CC_cursor_count(ConnectionClass *self); int CC_cursor_count(ConnectionClass * self);
char CC_cleanup(ConnectionClass *self); char CC_cleanup(ConnectionClass * self);
char CC_abort(ConnectionClass *self); char CC_abort(ConnectionClass * self);
int CC_set_translation (ConnectionClass *self); int CC_set_translation(ConnectionClass * self);
char CC_connect(ConnectionClass *self, char do_password); char CC_connect(ConnectionClass * self, char do_password);
char CC_add_statement(ConnectionClass *self, StatementClass *stmt); char CC_add_statement(ConnectionClass * self, StatementClass * stmt);
char CC_remove_statement(ConnectionClass *self, StatementClass *stmt); char CC_remove_statement(ConnectionClass * self, StatementClass * stmt);
char CC_get_error(ConnectionClass *self, int *number, char **message); char CC_get_error(ConnectionClass * self, int *number, char **message);
QResultClass *CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi); QResultClass *CC_send_query(ConnectionClass * self, char *query, QueryInfo * qi);
void CC_clear_error(ConnectionClass *self); void CC_clear_error(ConnectionClass * self);
char *CC_create_errormsg(ConnectionClass *self); char *CC_create_errormsg(ConnectionClass * self);
int CC_send_function(ConnectionClass *conn, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG *argv, int nargs); int CC_send_function(ConnectionClass * conn, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG * argv, int nargs);
char CC_send_settings(ConnectionClass *self); char CC_send_settings(ConnectionClass * self);
void CC_lookup_lo(ConnectionClass *conn); void CC_lookup_lo(ConnectionClass * conn);
void CC_lookup_pg_version(ConnectionClass *conn); void CC_lookup_pg_version(ConnectionClass * conn);
void CC_initialize_pg_version(ConnectionClass *conn); void CC_initialize_pg_version(ConnectionClass * conn);
void CC_log_error(char *func, char *desc, ConnectionClass *self); void CC_log_error(char *func, char *desc, ConnectionClass * self);
#endif #endif
This diff is collapsed.
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
#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
{
int m; int m;
int d; int d;
int y; int y;
...@@ -29,14 +30,14 @@ typedef struct { ...@@ -29,14 +30,14 @@ typedef struct {
int ss; int ss;
} SIMPLE_TIME; } SIMPLE_TIME;
int copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col); int copy_and_convert_field_bindinfo(StatementClass * stmt, Int4 field_type, void *value, int col);
int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, int copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2 fCType,
PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue); PTR rgbValue, SDWORD cbValueMax, SDWORD * pcbValue);
int copy_statement_with_parameters(StatementClass *stmt); int copy_statement_with_parameters(StatementClass * stmt);
char *convert_escape(char *value); char *convert_escape(char *value);
char *convert_money(char *s); char *convert_money(char *s);
char parse_datetime(char *buf, SIMPLE_TIME *st); char parse_datetime(char *buf, SIMPLE_TIME * st);
int convert_linefeeds(char *s, char *dst, size_t max); int convert_linefeeds(char *s, char *dst, size_t max);
char *convert_special_chars(char *si, char *dst, int used); char *convert_special_chars(char *si, char *dst, int used);
...@@ -45,7 +46,7 @@ int convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbV ...@@ -45,7 +46,7 @@ int convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbV
int convert_to_pgbinary(unsigned char *in, char *out, int len); int convert_to_pgbinary(unsigned char *in, char *out, int len);
void encode(char *in, char *out); void encode(char *in, char *out);
void decode(char *in, char *out); void decode(char *in, char *out);
int convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue, int convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
SDWORD cbValueMax, SDWORD *pcbValue); SDWORD cbValueMax, SDWORD * pcbValue);
#endif #endif
This diff is collapsed.
...@@ -31,23 +31,26 @@ ...@@ -31,23 +31,26 @@
/* 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"
# warning "location of odbcinst.ini file defaulted to /etc" #warning "location of odbcinst.ini file defaulted to /etc"
# endif #endif
#else /* WIN32 */ #else /* WIN32 */
# define ODBC_INI "ODBC.INI" /* ODBC initialization file */ #define ODBC_INI "ODBC.INI" /* ODBC initialization file */
# define ODBCINST_INI "ODBCINST.INI" /* ODBC Installation file */ #define ODBCINST_INI "ODBCINST.INI" /* ODBC Installation file */
#endif /* WIN32 */ #endif /* WIN32 */
#define INI_DSN DBMS_NAME /* Name of default Datasource in ini file (not used?) */ #define INI_DSN DBMS_NAME /* Name of default Datasource in
* ini file (not used?) */
#define INI_KDESC "Description" /* Data source description */ #define INI_KDESC "Description" /* Data source description */
#define INI_SERVER "Servername" /* Name of Server running the Postgres service */ #define INI_SERVER "Servername" /* Name of Server running the
#define INI_PORT "Port" /* Port on which the Postmaster is listening */ * Postgres service */
#define INI_PORT "Port"/* Port on which the Postmaster is
* listening */
#define INI_DATABASE "Database" /* Database Name */ #define INI_DATABASE "Database" /* Database Name */
#define INI_USER "Username" /* Default User Name */ #define INI_USER "Username" /* Default User Name */
#define INI_PASSWORD "Password" /* Default Password */ #define INI_PASSWORD "Password" /* Default Password */
...@@ -55,17 +58,22 @@ ...@@ -55,17 +58,22 @@
#define INI_FETCH "Fetch" /* Fetch Max Count */ #define INI_FETCH "Fetch" /* Fetch Max Count */
#define INI_SOCKET "Socket" /* Socket buffer size */ #define INI_SOCKET "Socket" /* Socket buffer size */
#define INI_READONLY "ReadOnly" /* Database is read only */ #define INI_READONLY "ReadOnly" /* Database is read only */
#define INI_COMMLOG "CommLog" /* Communication to backend logging */ #define INI_COMMLOG "CommLog" /* Communication to backend
* logging */
#define INI_PROTOCOL "Protocol" /* What protocol (6.2) */ #define INI_PROTOCOL "Protocol" /* What protocol (6.2) */
#define INI_OPTIMIZER "Optimizer" /* Use backend genetic optimizer */ #define INI_OPTIMIZER "Optimizer" /* Use backend genetic optimizer */
#define INI_KSQO "Ksqo" /* Keyset query optimization */ #define INI_KSQO "Ksqo"/* Keyset query optimization */
#define INI_CONNSETTINGS "ConnSettings" /* Anything to send to backend on successful connection */ #define INI_CONNSETTINGS "ConnSettings" /* Anything to send to
* backend on successful
* connection */
#define INI_UNIQUEINDEX "UniqueIndex" /* Recognize unique indexes */ #define INI_UNIQUEINDEX "UniqueIndex" /* Recognize unique indexes */
#define INI_UNKNOWNSIZES "UnknownSizes" /* How to handle unknown result set sizes */ #define INI_UNKNOWNSIZES "UnknownSizes" /* How to handle unknown
* result set sizes */
#define INI_CANCELASFREESTMT "CancelAsFreeStmt" #define INI_CANCELASFREESTMT "CancelAsFreeStmt"
#define INI_USEDECLAREFETCH "UseDeclareFetch" /* Use Declare/Fetch cursors */ #define INI_USEDECLAREFETCH "UseDeclareFetch" /* Use Declare/Fetch
* cursors */
/* More ini stuff */ /* More ini stuff */
#define INI_TEXTASLONGVARCHAR "TextAsLongVarchar" #define INI_TEXTASLONGVARCHAR "TextAsLongVarchar"
...@@ -90,7 +98,8 @@ ...@@ -90,7 +98,8 @@
/* Connection Defaults */ /* Connection Defaults */
#define DEFAULT_PORT "5432" #define DEFAULT_PORT "5432"
#define DEFAULT_READONLY 1 #define DEFAULT_READONLY 1
#define DEFAULT_PROTOCOL "6.4" /* the latest protocol is the default */ #define DEFAULT_PROTOCOL "6.4" /* the latest protocol is
* the default */
#define DEFAULT_USEDECLAREFETCH 0 #define DEFAULT_USEDECLAREFETCH 0
#define DEFAULT_TEXTASLONGVARCHAR 1 #define DEFAULT_TEXTASLONGVARCHAR 1
#define DEFAULT_UNKNOWNSASLONGVARCHAR 0 #define DEFAULT_UNKNOWNSASLONGVARCHAR 0
...@@ -118,8 +127,8 @@ ...@@ -118,8 +127,8 @@
void getGlobalDefaults(char *section, char *filename, char override); void getGlobalDefaults(char *section, char *filename, char override);
#ifdef WIN32 #ifdef WIN32
void SetDlgStuff(HWND hdlg, ConnInfo *ci); void SetDlgStuff(HWND hdlg, ConnInfo * ci);
void GetDlgStuff(HWND hdlg, ConnInfo *ci); void GetDlgStuff(HWND hdlg, ConnInfo * ci);
int CALLBACK driver_optionsProc(HWND hdlg, int CALLBACK driver_optionsProc(HWND hdlg,
WORD wMsg, WORD wMsg,
...@@ -129,14 +138,15 @@ int CALLBACK ds_optionsProc(HWND hdlg, ...@@ -129,14 +138,15 @@ int CALLBACK ds_optionsProc(HWND hdlg,
WORD wMsg, WORD wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
#endif /* WIN32 */ #endif /* WIN32 */
void updateGlobals(void); void updateGlobals(void);
void writeDSNinfo(ConnInfo *ci); void writeDSNinfo(ConnInfo * ci);
void getDSNdefaults(ConnInfo *ci); void getDSNdefaults(ConnInfo * ci);
void getDSNinfo(ConnInfo *ci, char overwrite); void getDSNinfo(ConnInfo * ci, char overwrite);
void makeConnectString(char *connect_string, ConnInfo *ci); void makeConnectString(char *connect_string, ConnInfo * ci);
void copyAttributes(ConnInfo *ci, char *attribute, char *value); void copyAttributes(ConnInfo * ci, char *attribute, char *value);
#endif #endif
...@@ -52,45 +52,50 @@ ...@@ -52,45 +52,50 @@
#include "dlg_specific.h" #include "dlg_specific.h"
/* prototypes */ /* prototypes */
void dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci); void dconn_get_connect_attributes(UCHAR FAR * connect_string, ConnInfo * ci);
#ifdef WIN32 #ifdef WIN32
BOOL FAR PASCAL dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, LPARAM lParam); BOOL FAR PASCAL dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, LPARAM lParam);
RETCODE dconn_DoDialog(HWND hwnd, ConnInfo *ci); RETCODE dconn_DoDialog(HWND hwnd, ConnInfo * ci);
extern HINSTANCE NEAR s_hModule;/* Saved module handle. */
extern HINSTANCE NEAR s_hModule; /* Saved module handle. */
#endif #endif
extern GLOBAL_VALUES globals; extern GLOBAL_VALUES globals;
RETCODE SQL_API SQLDriverConnect( RETCODE SQL_API
SQLDriverConnect(
HDBC hdbc, HDBC hdbc,
HWND hwnd, HWND hwnd,
UCHAR FAR *szConnStrIn, UCHAR FAR * szConnStrIn,
SWORD cbConnStrIn, SWORD cbConnStrIn,
UCHAR FAR *szConnStrOut, UCHAR FAR * szConnStrOut,
SWORD cbConnStrOutMax, SWORD cbConnStrOutMax,
SWORD FAR *pcbConnStrOut, SWORD FAR * pcbConnStrOut,
UWORD fDriverCompletion) UWORD fDriverCompletion)
{ {
static char *func = "SQLDriverConnect"; static char *func = "SQLDriverConnect";
ConnectionClass *conn = (ConnectionClass *) hdbc; ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci; ConnInfo *ci;
#ifdef WIN32 #ifdef WIN32
RETCODE dialog_result; RETCODE dialog_result;
#endif #endif
RETCODE result; RETCODE result;
char connStrIn[MAX_CONNECT_STRING]; char connStrIn[MAX_CONNECT_STRING];
char connStrOut[MAX_CONNECT_STRING]; char connStrOut[MAX_CONNECT_STRING];
int retval; int retval;
char password_required = FALSE; char password_required = FALSE;
int len = 0; int len = 0;
mylog("%s: entering...\n", func); mylog("%s: entering...\n", func);
if ( ! conn) { if (!conn)
{
CC_log_error(func, "", NULL); CC_log_error(func, "", NULL);
return SQL_INVALID_HANDLE; return SQL_INVALID_HANDLE;
} }
...@@ -120,13 +125,13 @@ dialog: ...@@ -120,13 +125,13 @@ dialog:
#endif #endif
ci->focus_password = password_required; ci->focus_password = password_required;
switch(fDriverCompletion) { switch (fDriverCompletion)
{
#ifdef WIN32 #ifdef WIN32
case SQL_DRIVER_PROMPT: case SQL_DRIVER_PROMPT:
dialog_result = dconn_DoDialog(hwnd, ci); dialog_result = dconn_DoDialog(hwnd, ci);
if(dialog_result != SQL_SUCCESS) { if (dialog_result != SQL_SUCCESS)
return dialog_result; return dialog_result;
}
break; break;
case SQL_DRIVER_COMPLETE_REQUIRED: case SQL_DRIVER_COMPLETE_REQUIRED:
...@@ -136,17 +141,17 @@ dialog: ...@@ -136,17 +141,17 @@ dialog:
case SQL_DRIVER_COMPLETE: case SQL_DRIVER_COMPLETE:
/* Password is not a required parameter. */ /* Password is not a required parameter. */
if( ci->username[0] == '\0' || if (ci->username[0] == '\0' ||
ci->server[0] == '\0' || ci->server[0] == '\0' ||
ci->database[0] == '\0' || ci->database[0] == '\0' ||
ci->port[0] == '\0' || ci->port[0] == '\0' ||
password_required) { password_required)
{
dialog_result = dconn_DoDialog(hwnd, ci); dialog_result = dconn_DoDialog(hwnd, ci);
if(dialog_result != SQL_SUCCESS) { if (dialog_result != SQL_SUCCESS)
return dialog_result; return dialog_result;
} }
}
break; break;
#else #else
case SQL_DRIVER_PROMPT: case SQL_DRIVER_PROMPT:
...@@ -157,14 +162,17 @@ dialog: ...@@ -157,14 +162,17 @@ dialog:
break; break;
} }
/* Password is not a required parameter unless authentication asks for it. /*
For now, I think it's better to just let the application ask over and over until * Password is not a required parameter unless authentication asks for
a password is entered (the user can always hit Cancel to get out) * it. For now, I think it's better to just let the application ask
* over and over until a password is entered (the user can always hit
* Cancel to get out)
*/ */
if( ci->username[0] == '\0' || if (ci->username[0] == '\0' ||
ci->server[0] == '\0' || ci->server[0] == '\0' ||
ci->database[0] == '\0' || ci->database[0] == '\0' ||
ci->port[0] == '\0') { ci->port[0] == '\0')
{
/* (password_required && ci->password[0] == '\0')) */ /* (password_required && ci->password[0] == '\0')) */
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
...@@ -173,12 +181,16 @@ dialog: ...@@ -173,12 +181,16 @@ dialog:
/* do the actual connect */ /* do the actual connect */
retval = CC_connect(conn, password_required); retval = CC_connect(conn, password_required);
if (retval < 0) { /* need a password */ if (retval < 0)
if (fDriverCompletion == SQL_DRIVER_NOPROMPT) { { /* need a password */
if (fDriverCompletion == SQL_DRIVER_NOPROMPT)
{
CC_log_error(func, "Need password but Driver_NoPrompt", conn); CC_log_error(func, "Need password but Driver_NoPrompt", conn);
return SQL_ERROR; /* need a password but not allowed to prompt so error */ return SQL_ERROR; /* need a password but not allowed to
* prompt so error */
} }
else { else
{
#ifdef WIN32 #ifdef WIN32
password_required = TRUE; password_required = TRUE;
goto dialog; goto dialog;
...@@ -187,7 +199,8 @@ dialog: ...@@ -187,7 +199,8 @@ dialog:
#endif #endif
} }
} }
else if (retval == 0) { else if (retval == 0)
{
/* error msg filled in above */ /* error msg filled in above */
CC_log_error(func, "Error from CC_Connect", conn); CC_log_error(func, "Error from CC_Connect", conn);
return SQL_ERROR; return SQL_ERROR;
...@@ -201,25 +214,29 @@ dialog: ...@@ -201,25 +214,29 @@ dialog:
makeConnectString(connStrOut, ci); makeConnectString(connStrOut, ci);
len = strlen(connStrOut); len = strlen(connStrOut);
if(szConnStrOut) { if (szConnStrOut)
{
/* Return the completed string to the caller. The correct method is to
only construct the connect string if a dialog was put up, otherwise, /*
it should just copy the connection input string to the output. * Return the completed string to the caller. The correct method
However, it seems ok to just always construct an output string. There * is to only construct the connect string if a dialog was put up,
are possible bad side effects on working applications (Access) by * otherwise, it should just copy the connection input string to
implementing the correct behavior, anyway. * the output. However, it seems ok to just always construct an
* output string. There are possible bad side effects on working
* applications (Access) by implementing the correct behavior,
* anyway.
*/ */
strncpy_null(szConnStrOut, connStrOut, cbConnStrOutMax); strncpy_null(szConnStrOut, connStrOut, cbConnStrOutMax);
if (len >= cbConnStrOutMax) { if (len >= cbConnStrOutMax)
{
result = SQL_SUCCESS_WITH_INFO; result = SQL_SUCCESS_WITH_INFO;
conn->errornumber = CONN_TRUNCATED; conn->errornumber = CONN_TRUNCATED;
conn->errormsg = "The buffer was too small for the result."; conn->errormsg = "The buffer was too small for the result.";
} }
} }
if(pcbConnStrOut) if (pcbConnStrOut)
*pcbConnStrOut = len; *pcbConnStrOut = len;
mylog("szConnStrOut = '%s'\n", szConnStrOut); mylog("szConnStrOut = '%s'\n", szConnStrOut);
...@@ -231,35 +248,38 @@ dialog: ...@@ -231,35 +248,38 @@ dialog:
} }
#ifdef WIN32 #ifdef WIN32
RETCODE dconn_DoDialog(HWND hwnd, ConnInfo *ci) RETCODE
dconn_DoDialog(HWND hwnd, ConnInfo * ci)
{ {
int dialog_result; int dialog_result;
mylog("dconn_DoDialog: ci = %u\n", ci); mylog("dconn_DoDialog: ci = %u\n", ci);
if(hwnd) { if (hwnd)
{
dialog_result = DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_CONFIG), dialog_result = DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_CONFIG),
hwnd, dconn_FDriverConnectProc, (LPARAM) ci); hwnd, dconn_FDriverConnectProc, (LPARAM) ci);
if(!dialog_result || (dialog_result == -1)) { if (!dialog_result || (dialog_result == -1))
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
} else { else
return SQL_SUCCESS; return SQL_SUCCESS;
} }
}
return SQL_ERROR; return SQL_ERROR;
} }
BOOL FAR PASCAL dconn_FDriverConnectProc( BOOL FAR PASCAL
dconn_FDriverConnectProc(
HWND hdlg, HWND hdlg,
UINT wMsg, UINT wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
ConnInfo *ci; ConnInfo *ci;
switch (wMsg) { switch (wMsg)
{
case WM_INITDIALOG: case WM_INITDIALOG:
ci = (ConnInfo *) lParam; ci = (ConnInfo *) lParam;
...@@ -274,7 +294,8 @@ ConnInfo *ci; ...@@ -274,7 +294,8 @@ ConnInfo *ci;
ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE); ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE); ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE);
SetWindowLong(hdlg, DWL_USER, lParam);/* Save the ConnInfo for the "OK" */ SetWindowLong(hdlg, DWL_USER, lParam); /* Save the ConnInfo for
* the "OK" */
SetDlgStuff(hdlg, ci); SetDlgStuff(hdlg, ci);
...@@ -293,7 +314,8 @@ ConnInfo *ci; ...@@ -293,7 +314,8 @@ ConnInfo *ci;
break; break;
case WM_COMMAND: case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam)) { switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDOK: case IDOK:
ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER); ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
...@@ -328,11 +350,15 @@ ConnInfo *ci; ...@@ -328,11 +350,15 @@ ConnInfo *ci;
#endif /* WIN32 */ #endif /* WIN32 */
void dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci) void
dconn_get_connect_attributes(UCHAR FAR * connect_string, ConnInfo * ci)
{ {
char *our_connect_string; char *our_connect_string;
char *pair, *attribute, *value, *equals; char *pair,
char *strtok_arg; *attribute,
*value,
*equals;
char *strtok_arg;
memset(ci, 0, sizeof(ConnInfo)); memset(ci, 0, sizeof(ConnInfo));
...@@ -341,17 +367,16 @@ char *strtok_arg; ...@@ -341,17 +367,16 @@ char *strtok_arg;
mylog("our_connect_string = '%s'\n", our_connect_string); mylog("our_connect_string = '%s'\n", our_connect_string);
while(1) { while (1)
{
pair = strtok(strtok_arg, ";"); pair = strtok(strtok_arg, ";");
if(strtok_arg) { if (strtok_arg)
strtok_arg = 0; strtok_arg = 0;
} if (!pair)
if(!pair) {
break; break;
}
equals = strchr(pair, '='); equals = strchr(pair, '=');
if ( ! equals) if (!equals)
continue; continue;
*equals = '\0'; *equals = '\0';
...@@ -360,7 +385,7 @@ char *strtok_arg; ...@@ -360,7 +385,7 @@ char *strtok_arg;
mylog("attribute = '%s', value = '%s'\n", attribute, value); mylog("attribute = '%s', value = '%s'\n", attribute, value);
if( !attribute || !value) if (!attribute || !value)
continue; continue;
/* Copy the appropriate value to the conninfo */ /* Copy the appropriate value to the conninfo */
...@@ -371,4 +396,3 @@ char *strtok_arg; ...@@ -371,4 +396,3 @@ char *strtok_arg;
free(our_connect_string); free(our_connect_string);
} }
This diff is collapsed.
...@@ -29,17 +29,18 @@ ...@@ -29,17 +29,18 @@
#define ENV_ALLOC_ERROR 1 #define ENV_ALLOC_ERROR 1
/********** Environment Handle *************/ /********** Environment Handle *************/
struct EnvironmentClass_ { struct EnvironmentClass_
{
char *errormsg; char *errormsg;
int errornumber; int errornumber;
}; };
/* Environment prototypes */ /* Environment prototypes */
EnvironmentClass *EN_Constructor(void); EnvironmentClass *EN_Constructor(void);
char EN_Destructor(EnvironmentClass *self); char EN_Destructor(EnvironmentClass * self);
char EN_get_error(EnvironmentClass *self, int *number, char **message); char EN_get_error(EnvironmentClass * self, int *number, char **message);
char EN_add_connection(EnvironmentClass *self, ConnectionClass *conn); char EN_add_connection(EnvironmentClass * self, ConnectionClass * conn);
char EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn); char EN_remove_connection(EnvironmentClass * self, ConnectionClass * conn);
void EN_log_error(char *func, char *desc, EnvironmentClass *self); void EN_log_error(char *func, char *desc, EnvironmentClass * self);
#endif #endif
This diff is collapsed.
This diff is collapsed.
...@@ -13,25 +13,32 @@ ...@@ -13,25 +13,32 @@
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C"
{
#endif #endif
DWORD DWORD
GetPrivateProfileString(char *theSection, /* section name */ GetPrivateProfileString(char *theSection, /* section name */
char *theKey, /* search key name */ char *theKey, /* search key name */
char *theDefault, /* default value if not found */ char *theDefault, /* default value if not
char *theReturnBuffer, /* return valuse stored here */ * found */
size_t theBufferLength, /* byte length of return buffer */ char *theReturnBuffer, /* return valuse stored
char *theIniFileName); /* pathname of ini file to search */ * here */
size_t theBufferLength, /* byte length of return
* buffer */
char *theIniFileName); /* pathname of ini file
* to search */
DWORD DWORD
WritePrivateProfileString(char *theSection, /* section name */ WritePrivateProfileString(char *theSection, /* section name */
char *theKey, /* write key name */ char *theKey, /* write key name */
char *theBuffer, /* input buffer */ char *theBuffer, /* input buffer */
char *theIniFileName); /* pathname of ini file to write */ char *theIniFileName); /* pathname of ini file
* to write */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#ifndef WIN32 #ifndef WIN32
......
This diff is collapsed.
#ifndef _IODBC_H #ifndef _IODBC_H
#define _IODBC_H #define _IODBC_H
# if !defined(WIN32) && !defined(WIN32_SYSTEM) #if !defined(WIN32) && !defined(WIN32_SYSTEM)
# define _UNIX_ #define _UNIX_
# 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
# define FAR #define FAR
typedef signed short SSHOR; typedef signed short SSHOR;
typedef short WORD; typedef short WORD;
typedef long DWORD; typedef long DWORD;
typedef WORD WPARAM; typedef WORD WPARAM;
typedef DWORD LPARAM; typedef DWORD LPARAM;
typedef void* HWND; typedef void *HWND;
typedef int BOOL; typedef int BOOL;
# endif /* _UNIX_ */ #endif /* _UNIX_ */
# if defined(WIN32) || defined(WIN32_SYSTEM) #if defined(WIN32) || defined(WIN32_SYSTEM)
# include <windows.h> #include <windows.h>
# 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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
#include "psqlodbc.h" #include "psqlodbc.h"
struct lo_arg { struct lo_arg
{
int isint; int isint;
int len; int len;
union union
...@@ -35,14 +36,13 @@ struct lo_arg { ...@@ -35,14 +36,13 @@ struct lo_arg {
#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);
int lo_close(ConnectionClass *conn, int fd); int lo_close(ConnectionClass * conn, int fd);
int lo_read(ConnectionClass *conn, int fd, char *buf, int len); int lo_read(ConnectionClass * conn, int fd, char *buf, int len);
int lo_write(ConnectionClass *conn, int fd, char *buf, int len); int lo_write(ConnectionClass * conn, int fd, char *buf, int len);
int lo_lseek(ConnectionClass *conn, int fd, int offset, int len); int lo_lseek(ConnectionClass * conn, int fd, int offset, int len);
int lo_tell(ConnectionClass *conn, int fd); int lo_tell(ConnectionClass * conn, int fd);
int lo_unlink(ConnectionClass *conn, Oid lobjId); int lo_unlink(ConnectionClass * conn, Oid lobjId);
#endif #endif
This diff is collapsed.
...@@ -39,35 +39,37 @@ ...@@ -39,35 +39,37 @@
#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,...);
#else #else
#ifndef WIN32 #ifndef WIN32
#define mylog(args...) /* GNU convention for variable arguments */ #define mylog(args...) /* GNU convention for variable arguments */
#else #else
#define mylog /* mylog */ #define mylog /* mylog */
#endif #endif
#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,...);
#else #else
#ifndef WIN32 #ifndef WIN32
#define qlog(args...) /* GNU convention for variable arguments */ #define qlog(args...) /* GNU convention for variable arguments */
#else #else
#define qlog /* qlog */ #define qlog /* qlog */
#endif #endif
#endif #endif
#ifndef WIN32 #ifndef WIN32
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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