Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions ext/odbc/php_odbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
efree(res->values);
res->values = NULL;
}
if (res->stmt) {
/* If aborted via timer expiration, don't try to call any unixODBC function */
if (res->stmt && !(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) {
#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc,
(SQLUSMALLINT) SQL_COMMIT);
Expand Down Expand Up @@ -484,9 +485,12 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
}

safe_odbc_disconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
SQLFreeEnv(conn->henv);
/* If aborted via timer expiration, don't try to call any unixODBC function */
if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) {
safe_odbc_disconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
SQLFreeEnv(conn->henv);
}
efree(conn);
ODBCG(num_links)--;
}
Expand All @@ -512,9 +516,12 @@ static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
}

safe_odbc_disconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
SQLFreeEnv(conn->henv);
/* If aborted via timer expiration, don't try to call any unixODBC function */
if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) {
safe_odbc_disconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
SQLFreeEnv(conn->henv);
}
free(conn);

ODBCG(num_links)--;
Expand Down