Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

PHP mysqlnd svn commit: r485 - trunk/tests/ext/mysqli

From: <ahristov(at)mysql.com>
Date: Tue Jun 26 2007 - 03:29:39 EDT


Author: ahristov
Date: 2007-06-26 09:29:38 +0200 (Tue, 26 Jun 2007) New Revision: 485

Modified:

   trunk/tests/ext/mysqli/mysqli_fetch_assoc_no_alias_utf8.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_bad_character.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_buffer_overflow.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_negative_len.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nested_call.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nofileop.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_replace_buffer.phpt
   trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_short_len.phpt
Log:
Fix tests so they clean the temp file after they are finished.

Fix utf8 test and add also three-byte utf8 sequences. Used Google Translator for translating the first names of the mysqlnd creators. If translations are wrong the Google tool is to blame :)

Modified: trunk/tests/ext/mysqli/mysqli_fetch_assoc_no_alias_utf8.phpt


  • trunk/tests/ext/mysqli/mysqli_fetch_assoc_no_alias_utf8.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_fetch_assoc_no_alias_utf8.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -32,34 +32,37 @@
    printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); }
    • if (!$res = mysqli_query($link, "SELECT 1 AS 'Ð?ндрей ХриÑ?тов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) { + if (!$res = mysqli_query($link, "SELECT 1 AS 'Андрей Христов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) { printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } print "[003]\n"; var_dump(mysqli_fetch_assoc($res)); mysqli_free_result($res);
    • if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, фамилиÑ? varchar(20) character set utf8)")) { + if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, фамилия varchar(20) character set utf8)")) { printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); }
    • if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ?) VALUES ('Ð?ндрей', 'ХриÑ?тов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) { + if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('Андрей', 'Христов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) { printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); }
    • if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ?) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) { + if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) { printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } -
    • if (!$res = mysqli_query($link, "SELECT id, име, фамилиÑ? FROM автори_на_mysqlnd ORDER BY фамилиÑ?")) { + if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('安德烈', 'Hristov'), ('格奥尔', 'Richter'), ('乌尔夫','Wendel')")) { printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); }
    • print "[008]\n"; + + if (!$res = mysqli_query($link, "SELECT id, име, фамилия FROM автори_на_mysqlnd ORDER BY фамилия, име")) { + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + print "[009]\n"; while ($row = mysqli_fetch_assoc($res)) { var_dump($row); } mysqli_free_result($res);
    if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) {
-        printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
     }
 
     mysqli_close($link);

@@ -69,44 +72,68 @@

 --EXPECTF--
 [003]
 array(3) {
- ["Ð?ндрей ХриÑ?тов"]=>
+ ["Андрей Христов"]=>

   string(1) "1"
   ["Улф Вендел"]=>
   string(1) "2"
   ["Георг Рихтер"]=>
   string(1) "3"
 }
-[008]
+[009]
 array(3) {
   ["id"]=>
   string(1) "4"
   ["име"]=>
   string(6) "Andrey"
- ["фамилиÑ?"]=>
+ ["фамилия"]=>

   string(7) "Hristov"
 }
 array(3) {
   ["id"]=>

+  string(1) "7"
+  ["име"]=>
+  string(9) "安德烈"
+  ["фамилия"]=>
+  string(7) "Hristov"
+}
+array(3) {
+  ["id"]=>

   string(1) "5"
   ["име"]=>

   string(5) "Georg"
-  ["фамили?"]=>
+  ["фамилия"]=>

   string(7) "Richter"
 }
 array(3) {
   ["id"]=>

+  string(1) "8"
+  ["име"]=>
+  string(9) "格奥尔"
+  ["фамилия"]=>
+  string(7) "Richter"
+}
+array(3) {
+  ["id"]=>
Do you need help?X

   string(1) "6"
   ["име"]=>
   string(3) "Ulf"
- ["фамилиÑ?"]=>
+ ["фамилия"]=>

   string(6) "Wendel"
 }
 array(3) {
   ["id"]=>

+  string(1) "9"
+  ["име"]=>
+  string(9) "乌尔夫"
+  ["фамилия"]=>
+  string(6) "Wendel"
+}
+array(3) {
+  ["id"]=>

   string(1) "3"
   ["име"]=>
   string(6) "Улф"
- ["фамилиÑ?"]=>
+ ["фамилия"]=>

   string(12) "Вендел"
 }
 array(3) {
@@ -114,59 +141,83 @@

   string(1) "2"
   ["име"]=>
   string(10) "Георг"
- ["фамилиÑ?"]=>
+ ["фамилия"]=>

   string(12) "Рихтер"
 }
 array(3) {
   ["id"]=>
   string(1) "1"
   ["име"]=>

-  string(12) "?ндрей"
-  ["фамили?"]=>
-  string(14) "Хри?тов"
+  string(12) "Андрей"

+ ["фамилия"]=>
+ string(14) "Христов"
 }
 done!
 --UEXPECTF--
 [003]
 array(3) {
- [u"Ð?ндрей ХриÑ?тов"]=>
+ [u"Андрей Христов"]=>

   unicode(1) "1"
   [u"Улф Вендел"]=>
   unicode(1) "2"
   [u"Георг Рихтер"]=>
   unicode(1) "3"
 }
-[008]
+[009]
 array(3) {
   [u"id"]=>
   unicode(1) "4"
   [u"име"]=>
   unicode(6) "Andrey"
- [u"фамилиÑ?"]=>
+ [u"фамилия"]=>

   unicode(7) "Hristov"
 }
 array(3) {
   [u"id"]=>

+  unicode(1) "7"
+  [u"име"]=>
+  unicode(3) "安德烈"
+  [u"фамилия"]=>
+  unicode(7) "Hristov"
+}
+array(3) {
+  [u"id"]=>
Do you need more help?X

   unicode(1) "5"
   [u"име"]=>

   unicode(5) "Georg"
-  [u"фамили?"]=>
+  [u"фамилия"]=>

   unicode(7) "Richter"
 }
 array(3) {
   [u"id"]=>

+  unicode(1) "8"
+  [u"име"]=>
+  unicode(3) "格奥尔"
+  [u"фамилия"]=>
Can we help you?X
+ unicode(7) "Richter" +} +array(3) { + [u"id"]=>

   unicode(1) "6"
   [u"име"]=>
   unicode(3) "Ulf"
- [u"фамилиÑ?"]=>
+ [u"фамилия"]=>

   unicode(6) "Wendel"
 }
 array(3) {
   [u"id"]=>

+  unicode(1) "9"
+  [u"име"]=>
+  unicode(3) "乌尔夫"
+  [u"фамилия"]=>
+  unicode(6) "Wendel"
+}
+array(3) {
+  [u"id"]=>

   unicode(1) "3"
   [u"име"]=>
   unicode(3) "Улф"
- [u"фамилиÑ?"]=>
+ [u"фамилия"]=>

   unicode(6) "Вендел"
 }
 array(3) {
@@ -174,15 +225,15 @@

   unicode(1) "2"
   [u"име"]=>
   unicode(5) "Георг"
- [u"фамилиÑ?"]=>
+ [u"фамилия"]=>

   unicode(6) "Рихтер"
 }
 array(3) {
   [u"id"]=>
   unicode(1) "1"
   [u"име"]=>

-  unicode(6) "?ндрей"
-  [u"фамили?"]=>
-  unicode(7) "Хри?тов"
+  unicode(6) "Андрей"

+ [u"фамилия"]=>
+ unicode(7) "Христов"
 }
 done!
\ No newline at end of file
Can't find what you're looking for?X

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -11,7 +11,13 @@
    <?php include "connect.inc"; include("table.inc"); - + + function shutdown_clean($file) { + if ($file) { + unlink($file); + } + } + function callback_simple($fp, &$buffer, $buflen, &$error) { static $invocation = 0;

@@ -103,6 +109,8 @@

     $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
     if (!$fp = fopen($file, 'w'))
         printf("[005] Cannot create CVS file '%s'\n", $file);
+	else
+        register_shutdown_function("shutdown_clean", $file);
 
     if (!fwrite($fp, "97;'x';\n") ||
         !fwrite($fp, "98;'y';\n") ||

@@ -200,7 +208,7 @@
if (!is_null($tmp = @mysqli_set_local_infile_handler($link, 'callback_simple'))) printf("[300] Expecting NULL/NULL got %s/%s\n", $tmp, gettype($tmp)); - + print "done!";

 ?>
 --EXPECTF--
@@ -213,4 +221,4 @@

 Callback set to 'callback_error'
 Callback: 0
 Should bail or warn!
-done!
\ No newline at end of file
+done!

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_bad_character.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_bad_character.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_bad_character.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -11,6 +11,12 @@
    <?php include "connect.inc"; include("table.inc"); + + function shutdown_clean($file) { + if ($file) { + unlink($file); + } + }
     function callback_bad_character($fp, &$buffer, $buflen, &$error) {
         static $invocation = 0;

@@ -84,6 +90,8 @@
$file = tempnam(sys_get_temp_dir(), 'mysqli_test'); if (!$fp = fopen($file, 'w')) printf("[005] Cannot create CVS file '%s'\n", $file); + else + register_shutdown_function("shutdown_clean", $file); if (!fwrite($fp, "97;'x';\n") || !fwrite($fp, "98;'y';\n") ||

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_buffer_overflow.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_buffer_overflow.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_buffer_overflow.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -12,6 +12,11 @@
    include "connect.inc"; include("table.inc");
+    function shutdown_clean($file) {
+	    if ($file) {
+	        unlink($file);
+	    }
+	}
         
     function callback_buffer_overflow($fp, &$buffer, $buflen, &$error) {
         static $invocation = 0;

@@ -85,6 +90,8 @@
$file = tempnam(sys_get_temp_dir(), 'mysqli_test'); if (!$fp = fopen($file, 'w')) printf("[005] Cannot create CVS file '%s'\n", $file); + else + register_shutdown_function("shutdown_clean", $file); if (!fwrite($fp, "97;'x';\n") || !fwrite($fp, "98;'y';\n") ||
@@ -102,10 +109,10 @@
); try_handler(20, $link, $file, 'callback_buffer_overflow', $expected);
Don't know where to look next?X
  • mysqli_close($link); + mysqli_close($link); print "done!"; ?> --EXPECTF-- Callback set to 'callback_buffer_overflow' Callback: 0 -done! \ No newline at end of file +done!

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_negative_len.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_negative_len.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_negative_len.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -11,8 +11,13 @@
    <?php include "connect.inc"; include("table.inc"); + + function shutdown_clean($file) { + if ($file) { + unlink($file); + } + }
-        
     function callback_negative_len($fp, &$buffer, $buflen, &$error) {
         static $invocation = 0;
         

@@ -84,6 +89,8 @@
$file = tempnam(sys_get_temp_dir(), 'mysqli_test'); if (!$fp = fopen($file, 'w')) printf("[005] Cannot create CVS file '%s'\n", $file); + else + register_shutdown_function("shutdown_clean", $file); if (!fwrite($fp, "97;'x';\n") || !fwrite($fp, "98;'y';\n") ||

@@ -107,4 +114,4 @@

 --EXPECTF--
 Callback set to 'callback_buffer_overflow'  Callback: 0
-done!
\ No newline at end of file
+done!

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nested_call.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nested_call.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nested_call.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -12,6 +12,11 @@
    include "connect.inc"; include("table.inc");
+    function shutdown_clean($file) {
+	    if ($file) {
+	        unlink($file);
+	    }
+	}
         
     function callback_simple($fp, &$buffer, $buflen, &$error) {
         static $invocation = 0;

@@ -131,6 +136,8 @@
$file = tempnam(sys_get_temp_dir(), 'mysqli_test'); if (!$fp = fopen($file, 'w')) printf("[005] Cannot create CVS file '%s'\n", $file); + else + register_shutdown_function("shutdown_clean", $file); if (!fwrite($fp, "97;'x';\n") || !fwrite($fp, "98;'y';\n") ||

@@ -160,4 +167,4 @@
 Callback: 0
 Callback: 1
 Callback: 1

-done!
\ No newline at end of file
+done!

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nofileop.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nofileop.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_nofileop.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -11,6 +11,12 @@
    <?php include "connect.inc"; include("table.inc"); + + function shutdown_clean($file) { + if ($file) { + unlink($file); + } + }
     function callback_nofileop($fp, &$buffer, $buflen, &$error) {
         static $invocation = 0;

@@ -83,6 +89,8 @@
$file = tempnam(sys_get_temp_dir(), 'mysqli_test'); if (!$fp = fopen($file, 'w')) printf("[005] Cannot create CVS file '%s'\n", $file); + else + register_shutdown_function("shutdown_clean", $file); if (!fwrite($fp, "97;'x';\n") || !fwrite($fp, "98;'y';\n") ||

@@ -105,4 +113,4 @@

 --EXPECTF--
 Callback set to 'callback_nofileop'
 Callback: 0
-done!
\ No newline at end of file
+done!

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_replace_buffer.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_replace_buffer.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_replace_buffer.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -12,6 +12,12 @@
    include "connect.inc"; include("table.inc");
+    function shutdown_clean($file) {
+	    if ($file) {
+	        unlink($file);
+	    }
+	}
+
     function callback_replace_buffer($fp, &$buffer, $buflen, &$error) {
         static $invocation = 0;            
         

@@ -87,6 +93,8 @@
$file = tempnam(sys_get_temp_dir(), 'mysqli_test'); if (!$fp = fopen($file, 'w')) printf("[005] Cannot create CVS file '%s'\n", $file);
Call Pantek today for Open Source Technical Support at 1-877-546-8934 - 24/7/365X
+ else + register_shutdown_function("shutdown_clean", $file); if (!fwrite($fp, "97;'x';\n") || !fwrite($fp, "98;'y';\n") ||

@@ -109,4 +117,4 @@

 --EXPECTF--
 Callback set to 'callback_nofileop'
 Callback: 0
-done!
\ No newline at end of file
+done!
Confused? Frustrated?X

Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_short_len.phpt


  • trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_short_len.phpt 2007-06-25 18:32:10 UTC (rev 484) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_short_len.phpt 2007-06-26 07:29:38 UTC (rev 485)
    @@ -12,6 +12,11 @@
    include "connect.inc"; include("table.inc");
+    function shutdown_clean($file) {
+	    if ($file) {
+	        unlink($file);
+	    }
+	}
         
     function callback_short_len($fp, &$buffer, $buflen, &$error) {
         static $invocation = 0;

@@ -124,6 +129,8 @@
$file = tempnam(sys_get_temp_dir(), 'mysqli_test'); if (!$fp = fopen($file, 'w')) printf("[005] Cannot create CVS file '%s'\n", $file); + else + register_shutdown_function("shutdown_clean", $file); if (!fwrite($fp, "97;'x';\n") || !fwrite($fp, "98;'y';\n") ||

@@ -151,4 +158,4 @@

 Callback set to 'callback_short_len'
 Callback: 0
 Callback: 1
-done!
\ No newline at end of file
+done!
-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Tue Jun 26 03:33:42 2007

This archive was generated by hypermail 2.1.8 : Tue Jun 26 2007 - 03:40:03 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library