]> git.joonet.de Git - adminer.git/commitdiff
Fix PDO error handling
authorJakub Vrana <jakub@vrana.cz>
Thu, 10 Jan 2013 20:57:00 +0000 (12:57 -0800)
committerJakub Vrana <jakub@vrana.cz>
Thu, 10 Jan 2013 21:01:48 +0000 (13:01 -0800)
adminer/drivers/mysql.inc.php
adminer/include/pdo.inc.php

index c59e96950bd9c45dac75d21dd6951c3dab9a0e46..a3b2bceb2edadf2fd43aeccaa5230fd8d963c48e 100644 (file)
@@ -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;
                                }
index ebe7c34d35daa51a11b154bfdf8cdaddc6312892..47d26a36218734d171a0f4404bfa1342c711dc7a 100644 (file)
@@ -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
                }