From e7e706edd77a1c1f02a82af0ae0981a84ec3f671 Mon Sep 17 00:00:00 2001 From: Ludek Finstrle Date: Thu, 26 Jan 2006 18:44:29 +0000 Subject: [PATCH] remove obsolete (not used) protocol option --- connection.c | 32 -------------------------------- connection.h | 20 -------------------- dlg_specific.c | 50 +++++++------------------------------------------- dlg_specific.h | 4 ---- dlg_wingui.c | 21 ++------------------- drvconn.c | 2 -- psqlodbc.h | 9 +-------- psqlodbc.rc | 34 ++++++++++------------------------ resource.h | 3 --- 9 files changed, 20 insertions(+), 155 deletions(-) diff --git a/connection.c b/connection.c index 6d285c6..09c0cfb 100644 --- a/connection.c +++ b/connection.c @@ -112,8 +112,6 @@ PGAPI_Connect( memcpy(&ci->drivers, &globals, sizeof(globals)); getDSNinfo(ci, CONN_OVERWRITE); logs_on_off(1, ci->drivers.debug, ci->drivers.commlog); - /* initialize pg_version from connInfo.protocol */ - CC_initialize_pg_version(conn); /* * override values from DSN info with UID and authStr(pwd) This only @@ -740,36 +738,6 @@ CC_lookup_lo(ConnectionClass *self) } -/* - * This function initializes the version of PostgreSQL from - * connInfo.protocol that we're connected to. - * h-inoue 01-2-2001 - */ -void -CC_initialize_pg_version(ConnectionClass *self) -{ - strcpy(self->pg_version, self->connInfo.protocol); - if (PROTOCOL_62(&self->connInfo)) - { - self->pg_version_number = (float) 6.2; - self->pg_version_major = 6; - self->pg_version_minor = 2; - } - else if (PROTOCOL_63(&self->connInfo)) - { - self->pg_version_number = (float) 6.3; - self->pg_version_major = 6; - self->pg_version_minor = 3; - } - else - { - self->pg_version_number = (float) 6.4; - self->pg_version_major = 6; - self->pg_version_minor = 4; - } -} - - /* * This function gets the version of PostgreSQL that we're connected to. * This is used to return the correct info in SQLGetInfo diff --git a/connection.h b/connection.h index 325d87d..b39b4cc 100644 --- a/connection.h +++ b/connection.h @@ -171,13 +171,6 @@ #define ARGV_SIZE 64 #define USRNAMEDATALEN 16 -typedef unsigned int ProtocolVersion; - -#define PG_PROTOCOL(major, minor) (((major) << 16) | (minor)) -#define PG_PROTOCOL_LATEST PG_PROTOCOL(2, 0) -#define PG_PROTOCOL_63 PG_PROTOCOL(1, 0) -#define PG_PROTOCOL_62 PG_PROTOCOL(0, 0) - typedef enum { @@ -189,11 +182,6 @@ typedef enum * statement */ } CONN_Status; -/* Transferred from pqcomm.h: */ - - -typedef ProtocolVersion MsgType; - /* Structure to hold all the connection attributes for a specific connection (used for both registry and file, DSN and DRIVER) */ @@ -207,7 +195,6 @@ typedef struct char username[MEDIUM_REGISTRY_LEN]; char password[MEDIUM_REGISTRY_LEN]; char conn_settings[LARGE_REGISTRY_LEN]; - char protocol[SMALL_REGISTRY_LEN]; char port[SMALL_REGISTRY_LEN]; char sslmode[MEDIUM_REGISTRY_LEN]; char onlyread[SMALL_REGISTRY_LEN]; @@ -231,12 +218,6 @@ typedef struct } ConnInfo; -/* Macro to determine is the connection using 6.2 protocol? */ -#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) - /* * Macros to compare the server's version with a specified version * 1st parameter: pointer to a ConnectionClass object @@ -390,7 +371,6 @@ int CC_send_function(ConnectionClass *conn, int fnid, void *result_buf, int *ac char CC_send_settings(ConnectionClass *self); void CC_lookup_lo(ConnectionClass *conn); void CC_lookup_pg_version(ConnectionClass *conn); -void CC_initialize_pg_version(ConnectionClass *conn); void CC_log_error(const char *func, const char *desc, const ConnectionClass *self); int CC_get_max_query_len(const ConnectionClass *self); int CC_send_cancel_request(const ConnectionClass *conn); diff --git a/dlg_specific.c b/dlg_specific.c index a19b21e..eeb91a4 100644 --- a/dlg_specific.c +++ b/dlg_specific.c @@ -12,6 +12,10 @@ * * API functions: none * + * Removed params: Don't reuse old parameter name if it's not for original + * purpose. Here is list of deleted params: + * Protocol communication protocol (before libpq) + * * Comments: See "notice.txt" for copyright and license information. *------- */ @@ -62,11 +66,9 @@ makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) hlen = strlen(connect_string); if (!abbrev) sprintf(&connect_string[hlen], - ";%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d", + ";%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d", INI_READONLY, ci->onlyread, - INI_PROTOCOL, - ci->protocol, INI_FAKEOIDINDEX, ci->fake_oid_index, INI_SHOWOIDCOLUMN, @@ -137,12 +139,6 @@ makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) flag |= BIT_LFCONVERSION; if (ci->drivers.unique_index) flag |= BIT_UNIQUEINDEX; - if (strncmp(ci->protocol, PG64, strlen(PG64)) == 0) - flag |= BIT_PROTOCOL_64; - else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0) - flag |= BIT_PROTOCOL_63; - else if (strncmp(ci->protocol, "7.4", 3) == 0) - flag |= (BIT_PROTOCOL_63 | BIT_PROTOCOL_64); switch (ci->drivers.unknown_sizes) { case UNKNOWNS_AS_DONTKNOW: @@ -231,12 +227,6 @@ unfoldCXAttribute(ConnInfo *ci, const char *value) if (count < 4) return; ci->drivers.unique_index = (char)((flag & BIT_UNIQUEINDEX) != 0); - if ((flag & BIT_PROTOCOL_64) != 0) - strcpy(ci->protocol, PG64); - else if ((flag & BIT_PROTOCOL_63) != 0) - strcpy(ci->protocol, PG63); - else - strcpy(ci->protocol, PG62); if ((flag & BIT_UNKNOWN_DONTKNOW) != 0) ci->drivers.unknown_sizes = UNKNOWNS_AS_DONTKNOW; else if ((flag & BIT_UNKNOWN_ASMAX) != 0) @@ -293,9 +283,6 @@ copyAttributes(ConnInfo *ci, const char *attribute, const char *value) else if (stricmp(attribute, INI_READONLY) == 0 || stricmp(attribute, "A0") == 0) strcpy(ci->onlyread, value); - else if (stricmp(attribute, INI_PROTOCOL) == 0 || stricmp(attribute, "A1") == 0) - strcpy(ci->protocol, value); - else if (stricmp(attribute, INI_SHOWOIDCOLUMN) == 0 || stricmp(attribute, "A3") == 0) strcpy(ci->show_oid_column, value); @@ -332,7 +319,7 @@ copyAttributes(ConnInfo *ci, const char *attribute, const char *value) else if (stricmp(attribute, "CX") == 0) unfoldCXAttribute(ci, value); - mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',sslmode='%s',onlyread='%s',protocol='%s',conn_settings='%s',disallow_premature=%d)\n", ci->dsn, ci->server, ci->database, ci->username, ci->password ? "xxxxx" : "", ci->port, ci->sslmode, ci->onlyread, ci->protocol, ci->conn_settings, ci->disallow_premature); + mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',sslmode='%s',onlyread='%s',conn_settings='%s',disallow_premature=%d)\n", ci->dsn, ci->server, ci->database, ci->username, ci->password ? "xxxxx" : "", ci->port, ci->sslmode, ci->onlyread, ci->conn_settings, ci->disallow_premature); } void @@ -410,9 +397,6 @@ getDSNdefaults(ConnInfo *ci) if (ci->onlyread[0] == '\0') sprintf(ci->onlyread, "%d", globals.onlyread); - if (ci->protocol[0] == '\0') - strcpy(ci->protocol, globals.protocol); - if (ci->fake_oid_index[0] == '\0') sprintf(ci->fake_oid_index, "%d", DEFAULT_FAKEOIDINDEX); @@ -517,9 +501,6 @@ getDSNinfo(ConnInfo *ci, char overwrite) if (ci->show_system_tables[0] == '\0' || overwrite) SQLGetPrivateProfileString(DSN, INI_SHOWSYSTEMTABLES, "", ci->show_system_tables, sizeof(ci->show_system_tables), ODBC_INI); - if (ci->protocol[0] == '\0' || overwrite) - SQLGetPrivateProfileString(DSN, INI_PROTOCOL, "", ci->protocol, sizeof(ci->protocol), ODBC_INI); - if (ci->conn_settings[0] == '\0' || overwrite) { SQLGetPrivateProfileString(DSN, INI_CONNSETTINGS, "", encoded_conn_settings, sizeof(encoded_conn_settings), ODBC_INI); @@ -598,9 +579,8 @@ getDSNinfo(ConnInfo *ci, char overwrite) ci->database, ci->username, ci->password ? "xxxxx" : ""); - qlog(" onlyread='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n", + qlog(" onlyread='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n", ci->onlyread, - ci->protocol, ci->show_oid_column, ci->fake_oid_index, ci->show_system_tables); @@ -775,11 +755,6 @@ writeDSNinfo(const ConnInfo *ci) ci->show_system_tables, ODBC_INI); - SQLWritePrivateProfileString(DSN, - INI_PROTOCOL, - ci->protocol, - ODBC_INI); - SQLWritePrivateProfileString(DSN, INI_CONNSETTINGS, encoded_conn_settings, @@ -1021,16 +996,5 @@ getCommonDefaults(const char *section, const char *filename, ConnInfo *ci) else comval->onlyread = DEFAULT_READONLY; - /* - * Default state for future DSN's protocol attribute This isn't a - * real driver option YET. This is more intended for - * customization from the install. - */ - SQLGetPrivateProfileString(section, INI_PROTOCOL, "@@@", - temp, sizeof(temp), filename); - if (strcmp(temp, "@@@")) - strcpy(comval->protocol, temp); - else - strcpy(comval->protocol, DEFAULT_PROTOCOL); } } diff --git a/dlg_specific.h b/dlg_specific.h index c3d3b32..edc8cdf 100644 --- a/dlg_specific.h +++ b/dlg_specific.h @@ -55,7 +55,6 @@ #define INI_SOCKET "Socket" /* Socket buffer size */ #define INI_READONLY "ReadOnly" /* Database is read only */ #define INI_COMMLOG "CommLog" /* Communication to backend logging */ -#define INI_PROTOCOL "Protocol" /* What protocol (6.2) */ #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 */ @@ -96,8 +95,6 @@ #define BIT_UPDATABLECURSORS (1L<<1) #define BIT_DISALLOWPREMATURE (1L<<2) #define BIT_UNIQUEINDEX (1L<<3) -#define BIT_PROTOCOL_63 (1L<<4) -#define BIT_PROTOCOL_64 (1L<<5) #define BIT_UNKNOWN_DONTKNOW (1L<<6) #define BIT_UNKNOWN_ASMAX (1L<<7) #define BIT_OPTIMIZER (1L<<8) @@ -127,7 +124,6 @@ #define DEFAULT_PORT "5432" #define DEFAULT_SSLMODE "prefer" #define DEFAULT_READONLY 0 -#define DEFAULT_PROTOCOL "6.4" /* the latest protocol is the default */ #define DEFAULT_USEDECLAREFETCH 0 #define DEFAULT_TEXTASLONGVARCHAR 1 #define DEFAULT_UNKNOWNSASLONGVARCHAR 0 diff --git a/dlg_wingui.c b/dlg_wingui.c index 68a411f..e69cbab 100644 --- a/dlg_wingui.c +++ b/dlg_wingui.c @@ -70,7 +70,8 @@ SetDlgStuff(HWND hdlg, const ConnInfo *ci) LoadString(GetWindowInstance(hdlg),IDS_SSLREQUEST_REQUIRE, buff, MEDIUM_REGISTRY_LEN); SendDlgItemMessage(hdlg, IDC_SSLMODE, CB_ADDSTRING, 0, (WPARAM) buff); LoadString(GetWindowInstance(hdlg),IDS_SSLREQUEST_DISABLE, buff, MEDIUM_REGISTRY_LEN); - SendDlgItemMessage(hdlg, IDC_SSLMODE, CB_ADDSTRING, 0, (WPARAM) buff); + SendDlgItemMessage(hdlg, IDC_SSLMODE, CB_ADDSTRING, 0, (WPARAM) buff); + if (!strcmp(ci->sslmode, "allow")) LoadString(GetWindowInstance(hdlg), IDS_SSLREQUEST_ALLOW, buff, MEDIUM_REGISTRY_LEN); @@ -455,15 +456,6 @@ ds_options2Proc(HWND hdlg, /* Readonly */ CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread)); - /* Protocol */ - if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0) - CheckDlgButton(hdlg, DS_PG62, 1); - else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0) - CheckDlgButton(hdlg, DS_PG63, 1); - else - /* latest */ - CheckDlgButton(hdlg, DS_PG64, 1); - /* Int8 As */ switch (ci->int8_as) { @@ -524,15 +516,6 @@ ds_options2Proc(HWND hdlg, /* Readonly */ sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY)); - /* Protocol */ - if (IsDlgButtonChecked(hdlg, DS_PG62)) - strcpy(ci->protocol, PG62); - else if (IsDlgButtonChecked(hdlg, DS_PG63)) - strcpy(ci->protocol, PG63); - else - /* latest */ - strcpy(ci->protocol, PG64); - /* Int8 As */ if (IsDlgButtonChecked(hdlg, DS_INT8_AS_DEFAULT)) ci->int8_as = 0; diff --git a/drvconn.c b/drvconn.c index 07ae7d9..2637855 100644 --- a/drvconn.c +++ b/drvconn.c @@ -141,8 +141,6 @@ PGAPI_DriverConnect( /* Fill in any default parameters if they are not there. */ getDSNdefaults(ci); - /* initialize pg_version */ - CC_initialize_pg_version(conn); salt[0] = '\0'; #ifdef WIN32 diff --git a/psqlodbc.h b/psqlodbc.h index 254909d..2ae050b 100644 --- a/psqlodbc.h +++ b/psqlodbc.h @@ -5,7 +5,7 @@ * * Comments: See "notice.txt" for copyright and license information. * - * $Id: psqlodbc.h,v 1.93 2005/10/20 13:06:10 petere Exp $ + * $Id: psqlodbc.h,v 1.94 2006/01/26 18:44:28 luf Exp $ * */ @@ -202,12 +202,6 @@ typedef double SDOUBLE; /* Now that's 0, lets use this instead. DJP 24-1-2001 */ #define STD_STATEMENT_LEN MAX_MESSAGE_LEN -#define PG62 "6.2" /* "Protocol" key setting - * to force Postgres 6.2 */ -#define PG63 "6.3" /* "Protocol" key setting - * to force postgres 6.3 */ -#define PG64 "6.4" - typedef struct ConnectionClass_ ConnectionClass; typedef struct StatementClass_ StatementClass; typedef struct QResultClass_ QResultClass; @@ -252,7 +246,6 @@ typedef struct GlobalValues_ char cancel_as_freestmt; char extra_systable_prefixes[MEDIUM_REGISTRY_LEN]; char conn_settings[LARGE_REGISTRY_LEN]; - char protocol[SMALL_REGISTRY_LEN]; } GLOBAL_VALUES; typedef struct StatementOptions_ diff --git a/psqlodbc.rc b/psqlodbc.rc index 48b30b0..1d02674 100644 --- a/psqlodbc.rc +++ b/psqlodbc.rc @@ -163,21 +163,14 @@ BEGIN WS_TABSTOP,184,108,40,10 CONTROL "int4",DS_INT8_AS_INT4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,227,108,29,10 - GROUPBOX "ƒvƒƒgƒRƒ‹ƒo|ƒWƒ‡ƒ“",IDC_STATIC,5,128,296,25 - CONTROL ">= 6.4",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_GROUP, - 18,139,49,10 - CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 87,139,26,10 - CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 140,140,26,10 - GROUPBOX "OID ƒIƒvƒVƒ‡ƒ“",IDC_STATIC,5,158,296,25 + GROUPBOX "OID ƒIƒvƒVƒ‡ƒ“",IDC_STATIC,5,128,296,25 CONTROL "ƒJƒ‰ƒ€—ñ•\ަ(&C)",DS_SHOWOIDCOLUMN,"Button", - BS_AUTOCHECKBOX | WS_GROUP,16,169,72,10 + BS_AUTOCHECKBOX | WS_GROUP,16,139,72,10 CONTROL "ƒCƒ“ƒfƒbƒNƒX‚ð‘•‚¤(&I)",DS_FAKEOIDINDEX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,107,169,95,10 - LTEXT "Ú‘±Žž Ý’è:(&S)",IDC_STATIC,13,192,69,10,NOT + BS_AUTOCHECKBOX | WS_TABSTOP,107,139,95,10 + LTEXT "Ú‘±Žž Ý’è:(&S)",IDC_STATIC,13,159,69,10,NOT WS_GROUP - EDITTEXT DS_CONNSETTINGS,90,191,211,27,ES_MULTILINE | + EDITTEXT DS_CONNSETTINGS,90,160,211,58,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_TABSTOP DEFPUSHBUTTON "OK",IDOK,5,224,50,14,WS_GROUP @@ -509,20 +502,13 @@ BEGIN WS_TABSTOP,184,108,40,10 CONTROL "int4",DS_INT8_AS_INT4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,227,108,29,10 - GROUPBOX "Protocol",IDC_STATIC,5,126,277,25 - CONTROL ">= 6.4",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_GROUP, - 44,137,49,10 - CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 117,137,26,10 - CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 191,137,26,10 - GROUPBOX "OID Options",IDC_STATIC,5,155,277,25 + GROUPBOX "OID Options",IDC_STATIC,5,127,277,25 CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX | - WS_GROUP | WS_TABSTOP,53,167,59,10 + WS_GROUP | WS_TABSTOP,53,138,59,10 CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX | - WS_GROUP | WS_TABSTOP,155,166,51,10 - LTEXT "Connect\n&Settings",IDC_STATIC,5,188,62,17 - EDITTEXT DS_CONNSETTINGS,47,188,235,27,ES_MULTILINE | + WS_GROUP | WS_TABSTOP,155,138,51,10 + LTEXT "Connect\n&Settings",IDC_STATIC,5,160,62,17 + EDITTEXT DS_CONNSETTINGS,47,160,235,55,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN DEFPUSHBUTTON "OK",IDOK,121,220,50,14,WS_GROUP PUSHBUTTON "Cancel",IDCANCEL,231,220,50,14 diff --git a/resource.h b/resource.h index e7f56a9..5aad119 100644 --- a/resource.h +++ b/resource.h @@ -34,7 +34,6 @@ #define DS_SHOWOIDCOLUMN 1012 #define DS_FAKEOIDINDEX 1013 #define DRV_COMMLOG 1014 -#define DS_PG62 1016 #define IDC_DATASOURCE 1018 #define DRV_OPTIMIZER 1019 #define DS_CONNSETTINGS 1020 @@ -62,8 +61,6 @@ #define DRV_CANCELASFREESTMT 1053 #define IDC_OPTIONS 1054 #define DRV_KSQO 1055 -#define DS_PG64 1057 -#define DS_PG63 1058 #define DRV_OR_DSN 1059 #define DRV_DEBUG 1060 #define DS_DISALLOWPREMATURE 1061 -- 2.39.5