Commit 87225ca3 authored by Byron Nikolaidis's avatar Byron Nikolaidis

Update for version 06-40-0001

parent f03729c6
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#include "columninfo.h" #include "columninfo.h"
#include "connection.h"
#include "socket.h" #include "socket.h"
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h> #include <malloc.h>
...@@ -31,6 +32,7 @@ ColumnInfoClass *rv; ...@@ -31,6 +32,7 @@ ColumnInfoClass *rv;
rv->adtid = NULL; rv->adtid = NULL;
rv->adtsize = NULL; rv->adtsize = NULL;
rv->display_size = NULL; rv->display_size = NULL;
rv->atttypmod = NULL;
} }
return rv; return rv;
...@@ -49,14 +51,19 @@ CI_Destructor(ColumnInfoClass *self) ...@@ -49,14 +51,19 @@ 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, SocketClass *sock) 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;
char new_field_name[MAX_MESSAGE_LEN+1]; char new_field_name[MAX_MESSAGE_LEN+1];
SocketClass *sock;
ConnInfo *ci;
sock = CC_get_socket(conn);
ci = &conn->connInfo;
/* at first read in the number of fields that are in the query */ /* at first read in the number of fields that are in the query */
new_num_fields = (Int2) SOCK_get_int(sock, sizeof(Int2)); new_num_fields = (Int2) SOCK_get_int(sock, sizeof(Int2));
...@@ -74,10 +81,23 @@ char new_field_name[MAX_MESSAGE_LEN+1]; ...@@ -74,10 +81,23 @@ char new_field_name[MAX_MESSAGE_LEN+1];
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);
mylog("CI_read_fields: fieldname='%s', adtid=%d, adtsize=%d\n", new_field_name, new_adtid, new_adtsize); /* If 6.4 protocol, then read the atttypmod field */
if ( ! PROTOCOL_63(ci) && ! PROTOCOL_62(ci)) {
mylog("READING ATTTYPMOD\n");
new_atttypmod = (Int4) SOCK_get_int(sock, 4);
/* Subtract the header length */
new_atttypmod -= 4;
if (new_atttypmod < 0)
new_atttypmod = -1;
}
mylog("CI_read_fields: fieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d\n", new_field_name, new_adtid, new_adtsize, new_atttypmod);
if (self) if (self)
CI_set_field_info(self, lf, new_field_name, new_adtid, new_adtsize); CI_set_field_info(self, lf, new_field_name, new_adtid, new_adtsize, new_atttypmod);
} }
return (SOCK_get_errcode(sock) == 0); return (SOCK_get_errcode(sock) == 0);
...@@ -101,6 +121,8 @@ int num_fields = self->num_fields; ...@@ -101,6 +121,8 @@ int num_fields = self->num_fields;
free(self->adtid); free(self->adtid);
free(self->adtsize); free(self->adtsize);
free(self->display_size); free(self->display_size);
free(self->atttypmod);
} }
void void
...@@ -114,11 +136,12 @@ CI_set_num_fields(ColumnInfoClass *self, int new_num_fields) ...@@ -114,11 +136,12 @@ CI_set_num_fields(ColumnInfoClass *self, int new_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);
} }
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) Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
{ {
// check bounds // check bounds
...@@ -130,6 +153,7 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, ...@@ -130,6 +153,7 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
self->name[field_num] = strdup(new_name); self->name[field_num] = strdup(new_name);
self->adtid[field_num] = new_adtid; self->adtid[field_num] = new_adtid;
self->adtsize[field_num] = new_adtsize; self->adtsize[field_num] = new_adtsize;
self->atttypmod[field_num] = new_atttypmod;
self->display_size[field_num] = 0; self->display_size[field_num] = 0;
} }
......
...@@ -18,6 +18,7 @@ struct ColumnInfoClass_ { ...@@ -18,6 +18,7 @@ struct ColumnInfoClass_ {
Oid *adtid; /* list of type ids */ Oid *adtid; /* list of type ids */
Int2 *adtsize; /* list type sizes */ Int2 *adtsize; /* list type sizes */
Int2 *display_size; /* the display size (longest row) */ Int2 *display_size; /* the display size (longest row) */
Int4 *atttypmod; /* the length of bpchar/varchar */
}; };
#define CI_get_num_fields(self) (self->num_fields) #define CI_get_num_fields(self) (self->num_fields)
...@@ -25,17 +26,18 @@ struct ColumnInfoClass_ { ...@@ -25,17 +26,18 @@ struct ColumnInfoClass_ {
#define CI_get_fieldname(self, col) (self->name[col]) #define CI_get_fieldname(self, col) (self->name[col])
#define CI_get_fieldsize(self, col) (self->adtsize[col]) #define CI_get_fieldsize(self, col) (self->adtsize[col])
#define CI_get_display_size(self, col) (self->display_size[col]) #define CI_get_display_size(self, col) (self->display_size[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, SocketClass *sock); 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); Oid new_adtid, Int2 new_adtsize, Int4 atttypmod);
#endif #endif
...@@ -472,8 +472,9 @@ static char *func="CC_connect"; ...@@ -472,8 +472,9 @@ static char *func="CC_connect";
globals.unknown_sizes, globals.unknown_sizes,
globals.max_varchar_size, globals.max_varchar_size,
globals.max_longvarchar_size); globals.max_longvarchar_size);
qlog(" disable_optimizer=%d, unique_index=%d, use_declarefetch=%d\n", qlog(" disable_optimizer=%d, ksqo=%d, unique_index=%d, use_declarefetch=%d\n",
globals.disable_optimizer, globals.disable_optimizer,
globals.ksqo,
globals.unique_index, globals.unique_index,
globals.use_declarefetch); globals.use_declarefetch);
qlog(" text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d\n", qlog(" text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d\n",
...@@ -542,7 +543,11 @@ static char *func="CC_connect"; ...@@ -542,7 +543,11 @@ static char *func="CC_connect";
// Send length of Authentication Block // Send length of Authentication Block
SOCK_put_int(sock, 4+sizeof(StartupPacket), 4); SOCK_put_int(sock, 4+sizeof(StartupPacket), 4);
sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_LATEST); if ( PROTOCOL_63(ci))
sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_63);
else
sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_LATEST);
strncpy(sp.database, ci->database, SM_DATABASE); strncpy(sp.database, ci->database, SM_DATABASE);
strncpy(sp.user, ci->username, SM_USER); strncpy(sp.user, ci->username, SM_USER);
...@@ -913,22 +918,41 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont ...@@ -913,22 +918,41 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont
SOCK_put_string(sock, "Q "); SOCK_put_string(sock, "Q ");
SOCK_flush_output(sock); SOCK_flush_output(sock);
while(!clear) {
SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
mylog("send_query: read command '%s'\n", cmdbuffer);
clear = (cmdbuffer[0] == 'I');
if (cmdbuffer[0] == 'N')
qlog("NOTICE from backend during send_query: '%s'\n", &cmdbuffer[1]);
else if (cmdbuffer[0] == 'E')
qlog("ERROR from backend during send_query: '%s'\n", &cmdbuffer[1]);
else if (cmdbuffer[0] == 'C')
qlog("Command response: '%s'\n", &cmdbuffer[1]);
}
while( ! clear) {
id = SOCK_get_char(sock);
switch(id) {
case 'I':
(void) SOCK_get_char(sock);
clear = TRUE;
break;
case 'Z':
break;
case 'C':
SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
qlog("Command response: '%s'\n", cmdbuffer);
break;
case 'N':
SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
qlog("NOTICE from backend during clear: '%s'\n", cmdbuffer);
break;
case 'E':
SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
qlog("ERROR from backend during clear: '%s'\n", cmdbuffer);
break;
}
}
mylog("send_query: returning res = %u\n", res); mylog("send_query: returning res = %u\n", res);
return res; return res;
} }
case 'K': /* Secret key (6.4 protocol) */
(void)SOCK_get_int(sock, 4); /* pid */
(void)SOCK_get_int(sock, 4); /* key */
break;
case 'Z': /* Backend is ready for new query (6.4) */
break;
case 'N' : /* NOTICE: */ case 'N' : /* NOTICE: */
SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH); SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
...@@ -1209,6 +1233,16 @@ static char *func="CC_send_settings"; ...@@ -1209,6 +1233,16 @@ static char *func="CC_send_settings";
} }
/* KSQO */
if (globals.ksqo) {
result = SQLExecDirect(hstmt, "set ksqo to 'ON'", SQL_NTS);
if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
status = FALSE;
mylog("%s: result %d, status %d from set ksqo\n", func, result, status);
}
/* Global settings */ /* Global settings */
if (globals.conn_settings[0] != '\0') { if (globals.conn_settings[0] != '\0') {
cs = strdup(globals.conn_settings); cs = strdup(globals.conn_settings);
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include "psqlodbc.h"
#ifndef WIN32 #ifndef WIN32
#include "iodbc.h" #include "iodbc.h"
#include "isql.h" #include "isql.h"
...@@ -24,7 +26,6 @@ ...@@ -24,7 +26,6 @@
#include <sqlext.h> #include <sqlext.h>
#endif #endif
#include "psqlodbc.h"
typedef enum { typedef enum {
CONN_NOT_CONNECTED, /* Connection has not been established */ CONN_NOT_CONNECTED, /* Connection has not been established */
...@@ -100,10 +101,11 @@ typedef enum { ...@@ -100,10 +101,11 @@ typedef enum {
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(1, 0) #define PG_PROTOCOL_LATEST PG_PROTOCOL(2, 0)
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(0, 0) #define PG_PROTOCOL_63 PG_PROTOCOL(1, 0)
#define PG_PROTOCOL_62 PG_PROTOCOL(0, 0)
/* This startup packet is to support latest Postgres protocol (6.3) */ /* This startup packet is to support latest Postgres protocol (6.4, 6.3) */
typedef struct _StartupPacket typedef struct _StartupPacket
{ {
ProtocolVersion protoVersion; ProtocolVersion protoVersion;
...@@ -154,6 +156,8 @@ typedef struct { ...@@ -154,6 +156,8 @@ typedef struct {
/* Macro to determine is the connection using 6.2 protocol? */ /* Macro to determine is the connection using 6.2 protocol? */
#define PROTOCOL_62(conninfo_) (strncmp((conninfo_)->protocol, PG62, strlen(PG62)) == 0) #define PROTOCOL_62(conninfo_) (strncmp((conninfo_)->protocol, PG62, strlen(PG62)) == 0)
/* Macro to determine is the connection using 6.3 protocol? */
#define PROTOCOL_63(conninfo_) (strncmp((conninfo_)->protocol, PG63, strlen(PG63)) == 0)
/* This is used to store cached table information in the connection */ /* This is used to store cached table information in the connection */
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "psqlodbc.h"
#ifndef WIN32 #ifndef WIN32
#include "iodbc.h" #include "iodbc.h"
#include "isql.h" #include "isql.h"
...@@ -120,7 +122,7 @@ struct tm *tim; ...@@ -120,7 +122,7 @@ struct tm *tim;
st.d = tim->tm_mday; st.d = tim->tm_mday;
st.y = tim->tm_year + 1900; st.y = tim->tm_year + 1900;
mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType, (value==NULL)?"<NULL>":value, cbValueMax); mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType, value, cbValueMax);
if ( ! value) { if ( ! value) {
/* handle a null just by returning SQL_NULL_DATA in pcbValue, */ /* handle a null just by returning SQL_NULL_DATA in pcbValue, */
......
...@@ -87,6 +87,7 @@ int CALLBACK driver_optionsProc(HWND hdlg, ...@@ -87,6 +87,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
CheckDlgButton(hdlg, DRV_COMMLOG, globals.commlog); CheckDlgButton(hdlg, DRV_COMMLOG, globals.commlog);
CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer); CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer);
CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo);
CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index); CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index);
CheckDlgButton(hdlg, DRV_READONLY, globals.readonly); CheckDlgButton(hdlg, DRV_READONLY, globals.readonly);
CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch); CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch);
...@@ -128,6 +129,7 @@ int CALLBACK driver_optionsProc(HWND hdlg, ...@@ -128,6 +129,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
globals.commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG); globals.commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER); globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX); globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
globals.readonly = IsDlgButtonChecked(hdlg, DRV_READONLY); globals.readonly = IsDlgButtonChecked(hdlg, DRV_READONLY);
globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH); globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
...@@ -168,6 +170,7 @@ int CALLBACK driver_optionsProc(HWND hdlg, ...@@ -168,6 +170,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
case IDDEFAULTS: case IDDEFAULTS:
CheckDlgButton(hdlg, DRV_COMMLOG, DEFAULT_COMMLOG); CheckDlgButton(hdlg, DRV_COMMLOG, DEFAULT_COMMLOG);
CheckDlgButton(hdlg, DRV_OPTIMIZER, DEFAULT_OPTIMIZER); CheckDlgButton(hdlg, DRV_OPTIMIZER, DEFAULT_OPTIMIZER);
CheckDlgButton(hdlg, DRV_KSQO, DEFAULT_KSQO);
CheckDlgButton(hdlg, DRV_UNIQUEINDEX, DEFAULT_UNIQUEINDEX); CheckDlgButton(hdlg, DRV_UNIQUEINDEX, DEFAULT_UNIQUEINDEX);
CheckDlgButton(hdlg, DRV_READONLY, DEFAULT_READONLY); CheckDlgButton(hdlg, DRV_READONLY, DEFAULT_READONLY);
CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, DEFAULT_USEDECLAREFETCH); CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, DEFAULT_USEDECLAREFETCH);
...@@ -238,8 +241,11 @@ char buf[128]; ...@@ -238,8 +241,11 @@ char buf[128];
/* Protocol */ /* Protocol */
if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0) if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
CheckDlgButton(hdlg, DS_PG62, 1); CheckDlgButton(hdlg, DS_PG62, 1);
else else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
CheckDlgButton(hdlg, DS_PG62, 0); CheckDlgButton(hdlg, DS_PG63, 1);
else
CheckDlgButton(hdlg, DS_PG64, 1);
CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column)); CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
...@@ -273,11 +279,11 @@ char buf[128]; ...@@ -273,11 +279,11 @@ char buf[128];
/* Protocol */ /* Protocol */
if ( IsDlgButtonChecked(hdlg, DS_PG62)) if ( IsDlgButtonChecked(hdlg, DS_PG62))
strcpy(ci->protocol, PG62); strcpy(ci->protocol, PG62);
else else if ( IsDlgButtonChecked(hdlg, DS_PG63))
strcpy(ci->protocol, PG63);
else
ci->protocol[0] = '\0'; ci->protocol[0] = '\0';
sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES)); sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING)); sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING));
...@@ -634,6 +640,13 @@ char temp[256]; ...@@ -634,6 +640,13 @@ char temp[256];
else if ( ! override) else if ( ! override)
globals.disable_optimizer = DEFAULT_OPTIMIZER; globals.disable_optimizer = DEFAULT_OPTIMIZER;
// KSQO is stored in the driver section only
SQLGetPrivateProfileString(section, INI_KSQO, "",
temp, sizeof(temp), filename);
if ( temp[0] )
globals.ksqo = atoi(temp);
else if ( ! override)
globals.ksqo = DEFAULT_KSQO;
// Recognize Unique Index is stored in the driver section only // Recognize Unique Index is stored in the driver section only
SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "", SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "",
...@@ -769,6 +782,10 @@ char tmp[128]; ...@@ -769,6 +782,10 @@ char tmp[128];
SQLWritePrivateProfileString(DBMS_NAME, SQLWritePrivateProfileString(DBMS_NAME,
INI_OPTIMIZER, tmp, ODBCINST_INI); INI_OPTIMIZER, tmp, ODBCINST_INI);
sprintf(tmp, "%d", globals.ksqo);
SQLWritePrivateProfileString(DBMS_NAME,
INI_KSQO, tmp, ODBCINST_INI);
sprintf(tmp, "%d", globals.unique_index); sprintf(tmp, "%d", globals.unique_index);
SQLWritePrivateProfileString(DBMS_NAME, SQLWritePrivateProfileString(DBMS_NAME,
INI_UNIQUEINDEX, tmp, ODBCINST_INI); INI_UNIQUEINDEX, tmp, ODBCINST_INI);
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#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_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 */
...@@ -93,6 +94,7 @@ ...@@ -93,6 +94,7 @@
#define DEFAULT_UNKNOWNSASLONGVARCHAR 0 #define DEFAULT_UNKNOWNSASLONGVARCHAR 0
#define DEFAULT_BOOLSASCHAR 1 #define DEFAULT_BOOLSASCHAR 1
#define DEFAULT_OPTIMIZER 1 // disable #define DEFAULT_OPTIMIZER 1 // disable
#define DEFAULT_KSQO 1 // on
#define DEFAULT_UNIQUEINDEX 0 // dont recognize #define DEFAULT_UNIQUEINDEX 0 // dont recognize
#define DEFAULT_COMMLOG 0 // dont log #define DEFAULT_COMMLOG 0 // dont log
#define DEFAULT_DEBUG 0 #define DEFAULT_DEBUG 0
......
...@@ -129,7 +129,7 @@ RETCODE SQL_API SQLExecDirect( ...@@ -129,7 +129,7 @@ RETCODE SQL_API SQLExecDirect(
SDWORD cbSqlStr) SDWORD cbSqlStr)
{ {
StatementClass *stmt = (StatementClass *) hstmt; StatementClass *stmt = (StatementClass *) hstmt;
RETCODE SQL_API result; RETCODE result;
static char *func = "SQLExecDirect"; static char *func = "SQLExecDirect";
mylog( "%s: entering...\n", func); mylog( "%s: entering...\n", func);
......
...@@ -44,7 +44,7 @@ generate_filename(char* dirname,char* prefix,char* filename) ...@@ -44,7 +44,7 @@ generate_filename(char* dirname,char* prefix,char* filename)
return; return;
strcpy(filename,dirname); strcpy(filename,dirname);
strcat(filename,DIRSEPARATOR); strcat(filename,DIRSEPERATOR);
if(prefix != 0) if(prefix != 0)
strcat(filename,prefix); strcat(filename,prefix);
#ifndef WIN32 #ifndef WIN32
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
portion of the registry. You may have to manually add this key. portion of the registry. You may have to manually add this key.
This logfile is intended for development use, not for an end user! This logfile is intended for development use, not for an end user!
*/ */
#define MY_LOG // #define MY_LOG
/* Uncomment Q_LOG to compile in the qlog() statements (Communications log, i.e. CommLog). /* Uncomment Q_LOG to compile in the qlog() statements (Communications log, i.e. CommLog).
...@@ -39,41 +39,33 @@ ...@@ -39,41 +39,33 @@
#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
void mylog(); /* prototype */ void mylog(); /* prototype */
#else #else
#ifndef WIN32 #define mylog // mylog
#define mylog(args...) /* GNU convention for variable arguments */
#else
#define mylog // mylog
#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
void qlog(); /* prototype */ void qlog(); /* prototype */
#else #else
#ifndef WIN32 #define qlog // qlog
#define qlog(args...) /* GNU convention for variable arguments */
#else
#define qlog // qlog
#endif
#endif #endif
#ifndef WIN32 #ifndef WIN32
#define DIRSEPARATOR "/" #define DIRSEPERATOR "/"
#else #else
#define DIRSEPARATOR "\\" #define DIRSEPERATOR "\\"
#endif #endif
void remove_newlines(char *string); void remove_newlines(char *string);
......
...@@ -242,6 +242,9 @@ mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unkno ...@@ -242,6 +242,9 @@ mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unkno
} }
/* Size is unknown -- handle according to parameter */ /* Size is unknown -- handle according to parameter */
if (QR_get_atttypmod(result, col) > -1)
return QR_get_atttypmod(result, col);
if (type == PG_TYPE_BPCHAR || handle_unknown_size_as == UNKNOWNS_AS_LONGEST) { if (type == PG_TYPE_BPCHAR || handle_unknown_size_as == UNKNOWNS_AS_LONGEST) {
p = QR_get_display_size(result, col); p = QR_get_display_size(result, col);
mylog("getCharPrecision: LONGEST: p = %d\n", p); mylog("getCharPrecision: LONGEST: p = %d\n", p);
......
...@@ -33,6 +33,7 @@ typedef double SDOUBLE; ...@@ -33,6 +33,7 @@ typedef double SDOUBLE;
typedef UInt4 Oid; typedef UInt4 Oid;
# define ODBCVER 0x0200
/* Limits */ /* Limits */
#define MAX_MESSAGE_LEN 8192 #define MAX_MESSAGE_LEN 8192
...@@ -69,8 +70,8 @@ typedef UInt4 Oid; ...@@ -69,8 +70,8 @@ typedef UInt4 Oid;
/* Driver stuff */ /* Driver stuff */
#define DRIVERNAME "PostgreSQL ODBC" #define DRIVERNAME "PostgreSQL ODBC"
#define DBMS_NAME "PostgreSQL" #define DBMS_NAME "PostgreSQL"
#define DBMS_VERSION "06.30.0250 PostgreSQL 6.3" #define DBMS_VERSION "06.40.0001 PostgreSQL 6.4"
#define POSTGRESDRIVERVERSION "06.30.0250" #define POSTGRESDRIVERVERSION "06.40.0001"
#ifdef WIN32 #ifdef WIN32
#define DRIVER_FILE_NAME "PSQLODBC.DLL" #define DRIVER_FILE_NAME "PSQLODBC.DLL"
...@@ -79,7 +80,7 @@ typedef UInt4 Oid; ...@@ -79,7 +80,7 @@ typedef UInt4 Oid;
#endif #endif
#define PG62 "6.2" /* "Protocol" key setting to force Postgres 6.2 */ #define PG62 "6.2" /* "Protocol" key setting to force Postgres 6.2 */
#define PG63 "6.3" /* "Protocol" key setting to force postgres 6.3 */
typedef struct ConnectionClass_ ConnectionClass; typedef struct ConnectionClass_ ConnectionClass;
typedef struct StatementClass_ StatementClass; typedef struct StatementClass_ StatementClass;
...@@ -106,6 +107,7 @@ typedef struct GlobalValues_ ...@@ -106,6 +107,7 @@ typedef struct GlobalValues_
char debug; char debug;
char commlog; char commlog;
char disable_optimizer; char disable_optimizer;
char ksqo;
char unique_index; char unique_index;
char readonly; char readonly;
char use_declarefetch; char use_declarefetch;
......
...@@ -88,78 +88,77 @@ CAPTION "Advanced Options (Driver)" ...@@ -88,78 +88,77 @@ CAPTION "Advanced Options (Driver)"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
CONTROL "Disable Genetic &Optimizer",DRV_OPTIMIZER,"Button", CONTROL "Disable Genetic &Optimizer",DRV_OPTIMIZER,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,10,97,10 BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,5,97,10
CONTROL "Comm&Log (C:\\psqlodbc.log)",DRV_COMMLOG,"Button", CONTROL "Comm&Log (C:\\psqlodbc.log)",DRV_COMMLOG,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,140,10,113,10 BS_AUTOCHECKBOX | WS_TABSTOP,140,5,113,10
CONTROL "Recognize Unique &Indexes",DRV_UNIQUEINDEX,"Button", CONTROL "&KSQO (Keyset Query Optimization)",DRV_KSQO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,25,101,10 BS_AUTOCHECKBOX | WS_TABSTOP,15,20,124,10
CONTROL "&ReadOnly (Default)",DRV_READONLY,"Button", CONTROL "&ReadOnly (Default)",DRV_READONLY,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,140,25,80,10 BS_AUTOCHECKBOX | WS_TABSTOP,140,20,80,10
CONTROL "&Use Declare/Fetch",DRV_USEDECLAREFETCH,"Button", CONTROL "Recognize Unique &Indexes",DRV_UNIQUEINDEX,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,40,80,10 BS_AUTOCHECKBOX | WS_TABSTOP,15,35,101,10
CONTROL "P&arse Statements",DRV_PARSE,"Button",BS_AUTOCHECKBOX | CONTROL "P&arse Statements",DRV_PARSE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,140,40,80,10 WS_TABSTOP,140,35,80,10
GROUPBOX "Unknown Sizes",IDC_STATIC,10,55,175,25 CONTROL "&Use Declare/Fetch",DRV_USEDECLAREFETCH,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,50,80,10
GROUPBOX "Unknown Sizes",IDC_STATIC,10,65,175,25
CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON | CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,15,65,45,10 WS_GROUP | WS_TABSTOP,15,76,45,10
CONTROL "Don't Know",DRV_UNKNOWN_DONTKNOW,"Button", CONTROL "Don't Know",DRV_UNKNOWN_DONTKNOW,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,70,65,53,10 BS_AUTORADIOBUTTON | WS_TABSTOP,70,76,53,10
CONTROL "Longest",DRV_UNKNOWN_LONGEST,"Button", CONTROL "Longest",DRV_UNKNOWN_LONGEST,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,130,65,50,10 BS_AUTORADIOBUTTON | WS_TABSTOP,130,76,50,10
GROUPBOX "Data Type Options",IDC_STATIC,10,85,270,25 GROUPBOX "Data Type Options",IDC_STATIC,10,95,270,25
CONTROL "Text as LongVarChar",DRV_TEXT_LONGVARCHAR,"Button", CONTROL "Text as LongVarChar",DRV_TEXT_LONGVARCHAR,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,95,80,10 BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,105,80,10
CONTROL "Unknowns as LongVarChar",DRV_UNKNOWNS_LONGVARCHAR, CONTROL "Unknowns as LongVarChar",DRV_UNKNOWNS_LONGVARCHAR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,95,100,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,105,100,10
CONTROL "Bools as Char",DRV_BOOLS_CHAR,"Button",BS_AUTOCHECKBOX | CONTROL "Bools as Char",DRV_BOOLS_CHAR,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,215,95,60,10 WS_TABSTOP,215,105,60,10
LTEXT "&Cache Size:",IDC_STATIC,10,120,40,10 LTEXT "&Cache Size:",IDC_STATIC,10,130,40,10
EDITTEXT DRV_CACHE_SIZE,50,120,35,12,ES_AUTOHSCROLL EDITTEXT DRV_CACHE_SIZE,50,130,35,12,ES_AUTOHSCROLL
LTEXT "Max &Varchar:",IDC_STATIC,90,120,45,10 LTEXT "Max &Varchar:",IDC_STATIC,90,130,45,10
EDITTEXT DRV_VARCHAR_SIZE,135,120,35,12,ES_AUTOHSCROLL EDITTEXT DRV_VARCHAR_SIZE,135,130,35,12,ES_AUTOHSCROLL
LTEXT "Max Lon&gVarChar:",IDC_STATIC,180,120,60,10 LTEXT "Max Lon&gVarChar:",IDC_STATIC,180,130,60,10
EDITTEXT DRV_LONGVARCHAR_SIZE,240,120,35,12,ES_AUTOHSCROLL EDITTEXT DRV_LONGVARCHAR_SIZE,240,130,35,12,ES_AUTOHSCROLL
LTEXT "SysTable &Prefixes:",IDC_STATIC,15,135,35,20 LTEXT "SysTable &Prefixes:",IDC_STATIC,15,145,35,20
EDITTEXT DRV_EXTRASYSTABLEPREFIXES,50,140,75,12,ES_AUTOHSCROLL EDITTEXT DRV_EXTRASYSTABLEPREFIXES,50,151,75,12,ES_AUTOHSCROLL
RTEXT "Connect &Settings:",IDC_STATIC,10,165,35,25 RTEXT "Connect &Settings:",IDC_STATIC,10,170,35,20
EDITTEXT DRV_CONNSETTINGS,50,160,225,35,ES_MULTILINE | EDITTEXT DRV_CONNSETTINGS,50,170,225,25,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,45,205,50,14,WS_GROUP DEFPUSHBUTTON "OK",IDOK,45,205,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,115,205,50,14 PUSHBUTTON "Cancel",IDCANCEL,115,205,50,14
PUSHBUTTON "Defaults",IDDEFAULTS,185,205,50,15 PUSHBUTTON "Defaults",IDDEFAULTS,185,205,50,15
END END
DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 170 DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 161
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Options (DataSource)" CAPTION "Advanced Options (DataSource)"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
CONTROL "&ReadOnly",DS_READONLY,"Button",BS_AUTOCHECKBOX | CONTROL "&ReadOnly",DS_READONLY,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,25,10,45,15 WS_GROUP | WS_TABSTOP,25,10,53,10
CONTROL "&6.2 Protocol",DS_PG62,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,130,10,60,14
CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,25,30,85,10
CONTROL "Row &Versioning",DS_ROWVERSIONING,"Button", CONTROL "Row &Versioning",DS_ROWVERSIONING,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,130,30,85,10 BS_AUTOCHECKBOX | WS_TABSTOP,130,10,85,10
GROUPBOX "OID Options",IDC_STATIC,15,50,180,25 CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,25,25,85,10
GROUPBOX "Protocol",IDC_STATIC,15,40,180,25
CONTROL "6.4",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_GROUP,25,
50,26,10
CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
75,50,26,10
CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
130,50,26,10
GROUPBOX "OID Options",IDC_STATIC,15,70,180,25
CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX | CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,25,60,59,10 WS_GROUP | WS_TABSTOP,25,81,59,10
CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX | CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,115,60,51,10 WS_GROUP | WS_TABSTOP,115,81,51,10
RTEXT "Connect &Settings:",IDC_STATIC,10,90,35,25 RTEXT "Connect &Settings:",IDC_STATIC,10,105,35,25
EDITTEXT DS_CONNSETTINGS,50,85,200,35,ES_MULTILINE | EDITTEXT DS_CONNSETTINGS,50,105,200,20,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,65,130,50,14,WS_GROUP DEFPUSHBUTTON "OK",IDOK,71,135,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,140,130,50,14 PUSHBUTTON "Cancel",IDCANCEL,146,135,50,14
GROUPBOX "Unknown Sizes",IDC_STATIC,10,145,175,25,NOT WS_VISIBLE
CONTROL "Maximum",DS_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
NOT WS_VISIBLE | WS_GROUP | WS_TABSTOP,15,155,45,10
CONTROL "Don't Know",DS_UNKNOWN_DONTKNOW,"Button",
BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_TABSTOP,70,155,
53,10
CONTROL "Longest",DS_UNKNOWN_LONGEST,"Button",BS_AUTORADIOBUTTON |
NOT WS_VISIBLE | WS_TABSTOP,130,155,50,10
END END
...@@ -190,7 +189,7 @@ BEGIN ...@@ -190,7 +189,7 @@ BEGIN
RIGHTMARGIN, 260 RIGHTMARGIN, 260
VERTGUIDE, 55 VERTGUIDE, 55
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 163 BOTTOMMARGIN, 154
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
...@@ -203,8 +202,8 @@ END ...@@ -203,8 +202,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 6,30,2,50 FILEVERSION 6,40,0,1
PRODUCTVERSION 6,30,2,50 PRODUCTVERSION 6,40,0,1
FILEFLAGSMASK 0x3L FILEFLAGSMASK 0x3L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
...@@ -222,12 +221,12 @@ BEGIN ...@@ -222,12 +221,12 @@ BEGIN
VALUE "Comments", "PostgreSQL ODBC driver for Windows 95\0" VALUE "Comments", "PostgreSQL ODBC driver for Windows 95\0"
VALUE "CompanyName", "Insight Distribution Systems\0" VALUE "CompanyName", "Insight Distribution Systems\0"
VALUE "FileDescription", "PostgreSQL Driver\0" VALUE "FileDescription", "PostgreSQL Driver\0"
VALUE "FileVersion", " 6.30.0250\0" VALUE "FileVersion", " 6.40.0001\0"
VALUE "InternalName", "psqlodbc\0" VALUE "InternalName", "psqlodbc\0"
VALUE "LegalTrademarks", "ODBC(TM) is a trademark of Microsoft Corporation. Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0" VALUE "LegalTrademarks", "ODBC(TM) is a trademark of Microsoft Corporation. Microsoft is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0"
VALUE "OriginalFilename", "psqlodbc.dll\0" VALUE "OriginalFilename", "psqlodbc.dll\0"
VALUE "ProductName", "Microsoft Open Database Connectivity\0" VALUE "ProductName", "Microsoft Open Database Connectivity\0"
VALUE "ProductVersion", " 6.30.0250\0" VALUE "ProductVersion", " 6.40.0001\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
......
...@@ -186,8 +186,7 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor) ...@@ -186,8 +186,7 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
if (conn != NULL) { if (conn != NULL) {
self->conn = conn; self->conn = conn;
mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n", mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n", cursor, self->cursor);
(cursor==NULL)?"":cursor, self->cursor);
if (self->cursor) if (self->cursor)
free(self->cursor); free(self->cursor);
...@@ -203,7 +202,7 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor) ...@@ -203,7 +202,7 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
// Read the field attributes. // Read the field attributes.
// $$$$ Should do some error control HERE! $$$$ // $$$$ Should do some error control HERE! $$$$
if ( CI_read_fields(self->fields, CC_get_socket(self->conn))) { if ( CI_read_fields(self->fields, self->conn)) {
self->status = PGRES_FIELDS_OK; self->status = PGRES_FIELDS_OK;
self->num_fields = CI_get_num_fields(self->fields); self->num_fields = CI_get_num_fields(self->fields);
} }
...@@ -236,7 +235,7 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor) ...@@ -236,7 +235,7 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
// Always have to read the field attributes. // Always have to read the field attributes.
// But we dont have to reallocate memory for them! // But we dont have to reallocate memory for them!
if ( ! CI_read_fields(NULL, CC_get_socket(self->conn))) { if ( ! CI_read_fields(NULL, self->conn)) {
self->status = PGRES_BAD_RESPONSE; self->status = PGRES_BAD_RESPONSE;
QR_set_message(self, "Error reading field information"); QR_set_message(self, "Error reading field information");
return FALSE; return FALSE;
...@@ -369,6 +368,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont ...@@ -369,6 +368,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont
for ( ; ;) { for ( ; ;) {
id = SOCK_get_char(sock); id = SOCK_get_char(sock);
switch (id) { switch (id) {
case 'T': /* Tuples within tuples cannot be handled */ case 'T': /* Tuples within tuples cannot be handled */
self->status = PGRES_BAD_RESPONSE; self->status = PGRES_BAD_RESPONSE;
...@@ -441,6 +441,8 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont ...@@ -441,6 +441,8 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont
continue; continue;
default: /* this should only happen if the backend dumped core */ default: /* this should only happen if the backend dumped core */
mylog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
qlog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
QR_set_message(self, "Unexpected result from backend. It probably crashed"); QR_set_message(self, "Unexpected result from backend. It probably crashed");
self->status = PGRES_FATAL_ERROR; self->status = PGRES_FATAL_ERROR;
CC_set_no_trans(self->conn); CC_set_no_trans(self->conn);
......
...@@ -72,12 +72,13 @@ struct QResultClass_ { ...@@ -72,12 +72,13 @@ struct QResultClass_ {
#define QR_get_fieldname(self, fieldno_) (CI_get_fieldname(self->fields, fieldno_)) #define QR_get_fieldname(self, fieldno_) (CI_get_fieldname(self->fields, fieldno_))
#define QR_get_fieldsize(self, fieldno_) (CI_get_fieldsize(self->fields, fieldno_)) #define QR_get_fieldsize(self, fieldno_) (CI_get_fieldsize(self->fields, fieldno_))
#define QR_get_display_size(self, fieldno_) (CI_get_display_size(self->fields, fieldno_)) #define QR_get_display_size(self, fieldno_) (CI_get_display_size(self->fields, fieldno_))
#define QR_get_atttypmod(self, fieldno_) (CI_get_atttypmod(self->fields, fieldno_))
#define QR_get_field_type(self, fieldno_) (CI_get_oid(self->fields, fieldno_)) #define QR_get_field_type(self, fieldno_) (CI_get_oid(self->fields, fieldno_))
/* These functions are used only for manual result sets */ /* These functions are used only for manual result sets */
#define QR_get_num_tuples(self) (self->manual_tuples ? TL_get_num_tuples(self->manual_tuples) : self->fcount) #define QR_get_num_tuples(self) (self->manual_tuples ? TL_get_num_tuples(self->manual_tuples) : self->fcount)
#define QR_add_tuple(self, new_tuple) (TL_add_tuple(self->manual_tuples, new_tuple)) #define QR_add_tuple(self, new_tuple) (TL_add_tuple(self->manual_tuples, new_tuple))
#define QR_set_field_info(self, field_num, name, adtid, adtsize) (CI_set_field_info(self->fields, field_num, name, adtid, adtsize)) #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))
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#define DRV_OPTIMIZER 1019 #define DRV_OPTIMIZER 1019
#define DS_CONNSETTINGS 1020 #define DS_CONNSETTINGS 1020
#define IDC_DRIVER 1021 #define IDC_DRIVER 1021
#define DS_UNKNOWN_MAX 1023
#define DS_UNKNOWN_DONTKNOW 1024
#define DRV_CONNSETTINGS 1031 #define DRV_CONNSETTINGS 1031
#define DRV_UNIQUEINDEX 1032 #define DRV_UNIQUEINDEX 1032
#define DRV_UNKNOWN_MAX 1035 #define DRV_UNKNOWN_MAX 1035
...@@ -34,7 +32,6 @@ ...@@ -34,7 +32,6 @@
#define IDC_DESCTEXT 1039 #define IDC_DESCTEXT 1039
#define DRV_MSG_LABEL 1040 #define DRV_MSG_LABEL 1040
#define DRV_UNKNOWN_LONGEST 1041 #define DRV_UNKNOWN_LONGEST 1041
#define DS_UNKNOWN_LONGEST 1042
#define DRV_TEXT_LONGVARCHAR 1043 #define DRV_TEXT_LONGVARCHAR 1043
#define DRV_UNKNOWNS_LONGVARCHAR 1044 #define DRV_UNKNOWNS_LONGVARCHAR 1044
#define DRV_CACHE_SIZE 1045 #define DRV_CACHE_SIZE 1045
...@@ -48,6 +45,9 @@ ...@@ -48,6 +45,9 @@
#define DS_ROWVERSIONING 1052 #define DS_ROWVERSIONING 1052
#define DRV_PARSE 1052 #define DRV_PARSE 1052
#define IDC_OPTIONS 1054 #define IDC_OPTIONS 1054
#define DRV_KSQO 1055
#define DS_PG64 1057
#define DS_PG63 1058
// Next default values for new objects // Next default values for new objects
// //
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104 #define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1055 #define _APS_NEXT_CONTROL_VALUE 1060
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif
...@@ -855,7 +855,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result); ...@@ -855,7 +855,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
value = QR_get_value_backend_row(res, stmt->currTuple, lf); value = QR_get_value_backend_row(res, stmt->currTuple, lf);
} }
mylog("value = '%s'\n", (value==NULL)?"<NULL>":value); mylog("value = '%s'\n", value);
retval = copy_and_convert_field_bindinfo(stmt, type, value, lf); retval = copy_and_convert_field_bindinfo(stmt, type, value, lf);
......
...@@ -23,13 +23,6 @@ ...@@ -23,13 +23,6 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#define closesocket(xxx) close(xxx) #define closesocket(xxx) close(xxx)
#define SOCKETFD int #define SOCKETFD int
#ifndef INADDR_NONE
#ifndef _IN_ADDR_T
#define _IN_ADDR_T
typedef unsigned int in_addr_t;
#endif
#define INADDR_NONE ((in_addr_t)-1)
#endif
#else #else
#include <winsock.h> #include <winsock.h>
#define SOCKETFD SOCKET #define SOCKETFD SOCKET
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include "psqlodbc.h"
#ifndef WIN32 #ifndef WIN32
#include "iodbc.h" #include "iodbc.h"
#include "isql.h" #include "isql.h"
...@@ -22,7 +24,6 @@ ...@@ -22,7 +24,6 @@
#include <sql.h> #include <sql.h>
#endif #endif
#include "psqlodbc.h"
#ifndef FALSE #ifndef FALSE
#define FALSE (BOOL)0 #define FALSE (BOOL)0
......
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