patch for odbc.c: PHP problems

Lothar Krauss Lothar.Krauss at epost.de
Mon Dec 17 15:16:23 EST 2001


Hello

I had two problems with freetds5.3 while accessing M$SQL 7.0 from a PHP script:
1. The socket from the client to the database server remains open
2. When starting a SQL fetch before all data from a previos fetch was read, I
get an error message.

The following patch solved this problem for me:
------------------------------------------------------------------------------
--- odbc.c.org  Sun Dec 16 12:25:44 2001
+++ odbc.c      Sun Dec 16 12:31:12 2001
@@ -732,6 +732,10 @@
 SQLRETURN SQL_API SQLDisconnect(
     SQLHDBC            hdbc)
 {
+/* lkrauss at wbs-blank.de: Close socket to database */
+       struct _hdbc *dbc = (struct _hdbc *) hdbc;
+       tds_free_socket(dbc->tds_socket);
+       dbc->tds_socket=NULL;
        return SQL_SUCCESS;
 }

@@ -869,6 +873,8 @@
 {
        switch(HandleType) {
                case SQL_HANDLE_STMT:
+/* lkrauss at wbs-blank.de: Free statement before free handle */
+                       _SQLFreeStmt(Handle,SQL_CLOSE);
                        _SQLFreeStmt(Handle,SQL_DROP);
                        break;
                case SQL_HANDLE_DBC:
---------------------------------------------------------------------------

Lothar Krauss




More information about the FreeTDS mailing list