Skip to content
Draft
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
8 changes: 4 additions & 4 deletions DB/odbc.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function connect($dsn, $persistent = false)
$dsn['cursor']);
}

if (!is_resource($this->connection)) {
if (!is_resource($this->connection) && !is_a($result, 'Odbc\Connection')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be $this->connection rather than $result.

return $this->raiseError(DB_ERROR_CONNECT_FAILED,
null, null, null,
$this->errorNative());
Expand Down Expand Up @@ -366,7 +366,7 @@ function fetchInto($result, &$arr, $fetchmode, $rownum = null)
*/
function freeResult($result)
{
return is_resource($result) ? odbc_free_result($result) : false;
return (is_resource($result) || is_a($result, 'Odbc\Result')) ? odbc_free_result($result) : false;
}

// }}}
Expand Down Expand Up @@ -691,7 +691,7 @@ function odbcRaiseError($errno = null)
*/
function errorNative()
{
if (!is_resource($this->connection)) {
if (!is_resource($this->connection) && !is_a($result, 'Odbc\Connection')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be $this->connection rather than $result.

return @odbc_error() . ' ' . @odbc_errormsg();
}
return @odbc_error($this->connection) . ' ' . @odbc_errormsg($this->connection);
Expand Down Expand Up @@ -745,7 +745,7 @@ function tableInfo($result, $mode = null)
$got_string = false;
}

if (!is_resource($id)) {
if (!is_resource($id) && !is_a($result, 'Odbc\Result')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be $id rather than $result.

return $this->odbcRaiseError(DB_ERROR_NEED_MORE_DATA);
}

Expand Down