svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt
trunk/ext/mysqli/mysqli_nonapi.c trunk/ext/mysqli/tests/bug53503.phpt
| From: | Kalle Sommer Nielsen | Date: | Sun, 12 Dec 2010 16:17:50 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt trunk/ext/mysqli/mysqli_nonapi.c trunk/ext/mysqli/tests/bug53503.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-64101@lists.php.net to get a copy of this message | ||
kalle Sun, 12 Dec 2010 16:17:50 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=306266
Log:
Fixed bug #53503 (mysqli::query returns false after successful LOAD DATA query)
Bug: http://bugs.php.net/53503 (error getting bug
information)
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c
A php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt
U php/php-src/trunk/ext/mysqli/mysqli_nonapi.c
A php/php-src/trunk/ext/mysqli/tests/bug53503.phpt
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-12-12 16:06:41 UTC (rev 306265)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-12-12 16:17:50 UTC (rev 306266)
@@ -11,6 +11,10 @@
. Fixed bug #53512 (NumberFormatter::setSymbol crash on bogus $attr values).
(Felipe)
+- MySQL Improved extension:
+ . Fixed bug #53503 (mysqli::query returns false after successful LOAD DATA
+ query). (Kalle)
+
- PDO Oracle driver:
. Fixed bug #39199 (Cannot load Lob data with more than 4000 bytes on
ORACLE 10). (spatar at mail dot nnov dot ru)
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c 2010-12-12 16:06:41 UTC (rev 306265)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c 2010-12-12 16:17:50 UTC (rev 306266)
@@ -538,7 +538,7 @@
result = mysql_use_result(mysql->mysql);
break;
}
- if (!result) {
+ if (!result && mysql_errno(mysql->mysql)) {
php_mysqli_throw_sql_exception((char *)mysql_sqlstate(mysql->mysql),
mysql_errno(mysql->mysql) TSRMLS_CC,
"%s", mysql_error(mysql->mysql));
RETURN_FALSE;
Added: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt 2010-12-12 16:17:50 UTC (rev 306266)
@@ -0,0 +1,50 @@
+--TEST--
+Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+ }
+
+ if (!$link->query("DROP TABLE IF EXISTS tlocaldata")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE tlocaldata (dump1 INT UNSIGNED NOT NULL PRIMARY KEY)
ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ file_put_contents('bug53503.data', 'jokijoki');
+
+ if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' REPLACE INTO TABLE
tlocaldata (dump1)")) {
+ echo "bug";
+ } else {
+ echo "done";
+ }
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s,
port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!mysqli_query($link, 'DROP TABLE IF EXISTS tlocaldata')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+}
+
+mysqli_close($link);
+
+unlink('bug53503.data');
+?>
+--EXPECT--
+done
\ No newline at end of file
Modified: php/php-src/trunk/ext/mysqli/mysqli_nonapi.c
===================================================================
--- php/php-src/trunk/ext/mysqli/mysqli_nonapi.c 2010-12-12 16:06:41 UTC (rev 306265)
+++ php/php-src/trunk/ext/mysqli/mysqli_nonapi.c 2010-12-12 16:17:50 UTC (rev 306266)
@@ -526,7 +526,7 @@
result = mysql_use_result(mysql->mysql);
break;
}
- if (!result) {
+ if (!result && mysql_errno(mysql->mysql)) {
php_mysqli_throw_sql_exception((char *)mysql_sqlstate(mysql->mysql),
mysql_errno(mysql->mysql) TSRMLS_CC,
"%s", mysql_error(mysql->mysql));
RETURN_FALSE;
Added: php/php-src/trunk/ext/mysqli/tests/bug53503.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/bug53503.phpt (rev 0)
+++ php/php-src/trunk/ext/mysqli/tests/bug53503.phpt 2010-12-12 16:17:50 UTC (rev 306266)
@@ -0,0 +1,50 @@
+--TEST--
+Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+ }
+
+ if (!$link->query("DROP TABLE IF EXISTS tlocaldata")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE tlocaldata (dump1 INT UNSIGNED NOT NULL PRIMARY KEY)
ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ file_put_contents('bug53503.data', 'jokijoki');
+
+ if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' REPLACE INTO TABLE
tlocaldata (dump1)")) {
+ echo "bug";
+ } else {
+ echo "done";
+ }
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s,
port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!mysqli_query($link, 'DROP TABLE IF EXISTS tlocaldata')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+}
+
+mysqli_close($link);
+
+unlink('bug53503.data');
+?>
+--EXPECT--
+done
\ No newline at end of file