]> granicus.if.org Git - postgresql/commitdiff
Cleanup
authorBruce Momjian <bruce@momjian.us>
Sat, 10 Feb 2001 06:57:53 +0000 (06:57 +0000)
committerBruce Momjian <bruce@momjian.us>
Sat, 10 Feb 2001 06:57:53 +0000 (06:57 +0000)
src/interfaces/odbc/connection.c
src/interfaces/odbc/connection.h
src/interfaces/odbc/dlg_specific.c
src/interfaces/odbc/psqlodbc.h
src/interfaces/odbc/resource.h
src/interfaces/odbc/statement.c

index 7d20e4cb4f1560514d603ac30ca7c8e1f777a20c..cc09c4aa2fdcf798d5db41793fe37c53debc0b99 100644 (file)
@@ -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
index 8222d98518039bbe4b73b39e6a532ffff237d870..9169583e457272426207023dfcabc8563ff89cdf 100644 (file)
@@ -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
index 9be8b3cdd5fc0542e2a40775c7762ef57acf9429..2bbf46faea94bb43826656125179c7dffca1af69 100644 (file)
@@ -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));
 
index 54fd4e2eeae90918ff5dac3b3381ccc62cb2df0a..96588de59061615d927d776d0d7be89f3a8f44a7 100644 (file)
@@ -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;
index c823241d7e41c87d76f6d90aead7d95ab049e525..cfe83cf10e8dc16db54fe144d9c4326213c597a6 100644 (file)
@@ -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 */
 
index b0ea3a9f59c8337b6d3ee0106ba0c90862ad0d18..da2cd146add4ff811aa96081ebfb2a029a036e28 100644 (file)
@@ -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;