diff options
| author | Mark Newnham <mark@newnhams.com> | 2020-05-31 18:48:04 -0600 |
|---|---|---|
| committer | Mark Newnham <mark@newnhams.com> | 2020-05-31 18:48:04 -0600 |
| commit | 65b0e14d999ff24b2b8249adf1b9b6fc52c30c20 (patch) | |
| tree | a7168f74d251c3e9a2a2b6885b8812e89bb56517 | |
| parent | 59af4437f57d316e5f101fc7ee6b4e02dc06e002 (diff) | |
| download | adodb-65b0e14d999ff24b2b8249adf1b9b6fc52c30c20.tar.gz adodb-65b0e14d999ff24b2b8249adf1b9b6fc52c30c20.tar.bz2 adodb-65b0e14d999ff24b2b8249adf1b9b6fc52c30c20.zip | |
Retrieve error messages early before connection close #614
Error messages from last error are lost if the
connection is closed before retrieval
| -rw-r--r-- | drivers/adodb-mssqlnative.inc.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/adodb-mssqlnative.inc.php b/drivers/adodb-mssqlnative.inc.php index 87b60f17..d1adc027 100644 --- a/drivers/adodb-mssqlnative.inc.php +++ b/drivers/adodb-mssqlnative.inc.php @@ -1218,14 +1218,26 @@ class ADORecordset_mssqlnative extends ADORecordSet { * close() only needs to be called if you are worried about using too much * memory while your script is running. All associated result memory for * the specified result identifier will automatically be freed. + * + * @return bool tru if we succeeded in closing down */ function _close() { - if(is_resource($this->_queryID)) { + + /* + * If we are closing down a failed query, collect any + * error messages. This is a hack fix to the "close too early" + * problem so this might go away later + */ + $this->connection->errorMsg(); + + if(is_resource($this->_queryID)) + { $rez = sqlsrv_free_stmt($this->_queryID); $this->_queryID = false; return $rez; } + return true; } |
