diff --git a/src/interfaces/odbc/connection.c b/src/interfaces/odbc/connection.c index 7d20e4cb4f..cc09c4aa2f 100644 --- a/src/interfaces/odbc/connection.c +++ b/src/interfaces/odbc/connection.c @@ -259,13 +259,11 @@ ConnectionClass *rv; rv->pg_version_major = 0; rv->pg_version_minor = 0; - /* Initialize statement options to defaults */ /* Statements under this conn will inherit these options */ InitializeStatementOptions(&rv->stmtOptions); - } return rv; } @@ -303,7 +301,6 @@ CC_Destructor(ConnectionClass *self) free(self->col_info); } - free(self); mylog("exit CC_Destructor\n"); @@ -396,11 +393,8 @@ StatementClass *stmt; for (i = 0; i < self->num_stmts; i++) { stmt = self->stmts[i]; if (stmt) { - stmt->hdbc = NULL; /* prevent any more dbase interactions */ - SC_Destructor(stmt); - self->stmts[i] = NULL; } } @@ -461,7 +455,6 @@ char CC_connect(ConnectionClass *self, char do_password) { StartupPacket sp; -StartupPacket6_2 sp62; QResultClass *res; SocketClass *sock; ConnInfo *ci = &(self->connInfo); @@ -538,36 +531,20 @@ static char *func="CC_connect"; } mylog("connection to the server socket succeeded.\n"); - if ( PROTOCOL_62(ci)) { - sock->reverse = TRUE; /* make put_int and get_int work for 6.2 */ + memset(&sp, 0, sizeof(StartupPacket)); - memset(&sp62, 0, sizeof(StartupPacket6_2)); - SOCK_put_int(sock, htonl(4+sizeof(StartupPacket6_2)), 4); - sp62.authtype = htonl(NO_AUTHENTICATION); - strncpy(sp62.database, ci->database, PATH_SIZE); - strncpy(sp62.user, ci->username, NAMEDATALEN); - SOCK_put_n_char(sock, (char *) &sp62, sizeof(StartupPacket6_2)); - SOCK_flush_output(sock); - } - else { - memset(&sp, 0, sizeof(StartupPacket)); + mylog("sizeof startup packet = %d\n", sizeof(StartupPacket)); - mylog("sizeof startup packet = %d\n", sizeof(StartupPacket)); + /* Send length of Authentication Block */ + SOCK_put_int(sock, 4+sizeof(StartupPacket), 4); - /* Send length of Authentication Block */ - 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.user, ci->username, SM_USER); - strncpy(sp.database, ci->database, SM_DATABASE); - strncpy(sp.user, ci->username, SM_USER); - - SOCK_put_n_char(sock, (char *) &sp, sizeof(StartupPacket)); - SOCK_flush_output(sock); - } + SOCK_put_n_char(sock, (char *) &sp, sizeof(StartupPacket)); + SOCK_flush_output(sock); mylog("sent the authentication block.\n"); @@ -580,7 +557,6 @@ static char *func="CC_connect"; mylog("sent the authentication block successfully.\n"); } - mylog("gonna do authentication\n"); @@ -588,7 +564,7 @@ static char *func="CC_connect"; /* Now get the authentication request from backend */ /* *************************************************** */ - if ( ! PROTOCOL_62(ci)) do { + do { if (do_password) beresp = 'R'; @@ -671,7 +647,6 @@ static char *func="CC_connect"; } while (areq != AUTH_REQ_OK); - CC_clear_error(self); /* clear any password error */ /* send an empty query in order to find out whether the specified */ @@ -929,7 +904,6 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont until an 'I' is received */ - SOCK_put_string(sock, "Q "); SOCK_flush_output(sock); @@ -1115,7 +1089,6 @@ int i; SOCK_put_int(sock, fnid, 4); SOCK_put_int(sock, nargs, 4); - mylog("send_function: done sending function\n"); for (i = 0; i < nargs; ++i) { @@ -1127,8 +1100,6 @@ int i; SOCK_put_int(sock, args[i].u.integer, 4); else SOCK_put_n_char(sock, (char *) args[i].u.ptr, args[i].len); - - } mylog(" done sending args\n"); @@ -1378,19 +1349,9 @@ 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; - } + 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/src/interfaces/odbc/connection.h b/src/interfaces/odbc/connection.h index 8222d98518..9169583e45 100644 --- a/src/interfaces/odbc/connection.h +++ b/src/interfaces/odbc/connection.h @@ -106,10 +106,8 @@ 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) -/* This startup packet is to support latest Postgres protocol (6.4, 6.3) */ +/* This startup packet is to support latest Postgres protocol */ typedef struct _StartupPacket { ProtocolVersion protoVersion; @@ -121,18 +119,6 @@ typedef struct _StartupPacket } StartupPacket; -/* This startup packet is to support pre-Postgres 6.3 protocol */ -typedef struct _StartupPacket6_2 -{ - unsigned int authtype; - char database[PATH_SIZE]; - char user[NAMEDATALEN]; - char options[ARGV_SIZE]; - char execfile[ARGV_SIZE]; - char tty[PATH_SIZE]; -} StartupPacket6_2; - - /* Structure to hold all the connection attributes for a specific connection (used for both registry and file, DSN and DRIVER) */ @@ -157,12 +143,6 @@ typedef struct { char focus_password; } 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 diff --git a/src/interfaces/odbc/dlg_specific.c b/src/interfaces/odbc/dlg_specific.c index 9be8b3cdd5..2bbf46faea 100644 --- a/src/interfaces/odbc/dlg_specific.c +++ b/src/interfaces/odbc/dlg_specific.c @@ -243,12 +243,7 @@ char buf[128]; 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); + CheckDlgButton(hdlg, DS_PG64, 1); @@ -281,12 +276,7 @@ char buf[128]; 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); + strcpy(ci->protocol, PG64); sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES)); diff --git a/src/interfaces/odbc/psqlodbc.h b/src/interfaces/odbc/psqlodbc.h index 54fd4e2eea..96588de590 100644 --- a/src/interfaces/odbc/psqlodbc.h +++ b/src/interfaces/odbc/psqlodbc.h @@ -6,7 +6,7 @@ * * Comments: See "notice.txt" for copyright and license information. * - * $Id: psqlodbc.h,v 1.30 2001/02/06 02:21:12 inoue Exp $ + * $Id: psqlodbc.h,v 1.31 2001/02/10 06:57:53 momjian Exp $ */ #ifndef __PSQLODBC_H__ @@ -91,8 +91,6 @@ typedef UInt4 Oid; /* 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; @@ -132,8 +130,10 @@ typedef struct GlobalValues_ char cancel_as_freestmt; char extra_systable_prefixes[MEDIUM_REGISTRY_LEN]; char conn_settings[LARGE_REGISTRY_LEN]; + /* Protocol is not used anymore, but kept in case + * it is useful in the future. bjm 2001-02-10 + */ char protocol[SMALL_REGISTRY_LEN]; - FILE* mylogFP; FILE* qlogFP; } GLOBAL_VALUES; diff --git a/src/interfaces/odbc/resource.h b/src/interfaces/odbc/resource.h index c823241d7e..cfe83cf10e 100644 --- a/src/interfaces/odbc/resource.h +++ b/src/interfaces/odbc/resource.h @@ -19,7 +19,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 @@ -48,7 +47,6 @@ #define IDC_OPTIONS 1054 #define DRV_KSQO 1055 #define DS_PG64 1057 -#define DS_PG63 1058 /* Next default values for new objects */ diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c index b0ea3a9f59..da2cd146ad 100644 --- a/src/interfaces/odbc/statement.c +++ b/src/interfaces/odbc/statement.c @@ -789,8 +789,6 @@ QueryInfo qi; CC_set_in_trans(conn); } - - oldstatus = conn->status; conn->status = CONN_EXECUTING; self->status = STMT_EXECUTING; @@ -829,11 +827,7 @@ QueryInfo qi; self->result = CC_send_query( conn, fetch, &qi); } - mylog(" done sending the query:\n"); - - - } else { /* not a SELECT statement so don't use a cursor */ mylog(" it's NOT a select statement: stmt=%u\n", self); @@ -850,7 +844,6 @@ QueryInfo qi; QR_Destructor(res); CC_set_no_trans(conn); } - } conn->status = oldstatus;