From 61dc40a512f548af2e796b9b36b14b573ab78024 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 10 Jan 2013 12:57:00 -0800 Subject: [PATCH] Fix PDO error handling --- adminer/drivers/mysql.inc.php | 2 +- adminer/include/pdo.inc.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index c59e9695..a3b2bceb 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -111,7 +111,7 @@ if (!defined("DRIVER")) { $result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode $this->error = ""; if (!$result) { - $this->errrno = mysql_errno($this->_link); + $this->errno = mysql_errno($this->_link); $this->error = mysql_error($this->_link); return false; } diff --git a/adminer/include/pdo.inc.php b/adminer/include/pdo.inc.php index ebe7c34d..47d26a36 100644 --- a/adminer/include/pdo.inc.php +++ b/adminer/include/pdo.inc.php @@ -40,6 +40,9 @@ if (extension_loaded('pdo')) { function store_result($result = null) { if (!$result) { $result = $this->_result; + if (!$result) { + return false; + } } if ($result->columnCount()) { $result->num_rows = $result->rowCount(); // is not guaranteed to work with all drivers @@ -50,6 +53,9 @@ if (extension_loaded('pdo')) { } function next_result() { + if (!$this->_result) { + return false; + } $this->_result->_offset = 0; return @$this->_result->nextRowset(); // @ - PDO_PgSQL doesn't support it }