summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xext/mysql/tests/002.phpt4
-rwxr-xr-xext/mysql/tests/003.phpt4
-rw-r--r--ext/mysql/tests/bug47438.phpt16
-rw-r--r--ext/mysql/tests/clean_table.inc15
-rw-r--r--ext/mysql/tests/mysql_affected_rows.phpt4
-rw-r--r--ext/mysql/tests/mysql_create_db.phpt12
-rw-r--r--ext/mysql/tests/mysql_data_seek.phpt4
-rw-r--r--ext/mysql/tests/mysql_db_query.phpt4
-rw-r--r--ext/mysql/tests/mysql_drop_db.phpt12
-rw-r--r--ext/mysql/tests/mysql_errno.phpt4
-rw-r--r--ext/mysql/tests/mysql_error.phpt4
-rw-r--r--ext/mysql/tests/mysql_fetch_array.phpt4
-rw-r--r--ext/mysql/tests/mysql_fetch_assoc.phpt4
-rw-r--r--ext/mysql/tests/mysql_fetch_field.phpt4
-rw-r--r--ext/mysql/tests/mysql_fetch_lengths.phpt8
-rw-r--r--ext/mysql/tests/mysql_fetch_object.phpt4
-rw-r--r--ext/mysql/tests/mysql_fetch_row.phpt4
-rw-r--r--ext/mysql/tests/mysql_field_flags.phpt8
-rw-r--r--ext/mysql/tests/mysql_field_len.phpt8
-rw-r--r--ext/mysql/tests/mysql_field_name.phpt4
-rw-r--r--ext/mysql/tests/mysql_field_seek.phpt4
-rw-r--r--ext/mysql/tests/mysql_field_table.phpt4
-rw-r--r--ext/mysql/tests/mysql_field_type.phpt4
-rw-r--r--ext/mysql/tests/mysql_free_result.phpt8
-rw-r--r--ext/mysql/tests/mysql_get_host_info.phpt8
-rw-r--r--ext/mysql/tests/mysql_get_proto_info.phpt8
-rw-r--r--ext/mysql/tests/mysql_get_server_info.phpt4
-rw-r--r--ext/mysql/tests/mysql_info.phpt8
-rw-r--r--ext/mysql/tests/mysql_insert_id.phpt8
-rw-r--r--ext/mysql/tests/mysql_list_dbs.phpt8
-rw-r--r--ext/mysql/tests/mysql_list_fields.phpt15
-rw-r--r--ext/mysql/tests/mysql_list_tables.phpt8
-rw-r--r--ext/mysql/tests/mysql_max_persistent.phpt24
-rw-r--r--ext/mysql/tests/mysql_num_fields.phpt8
-rw-r--r--ext/mysql/tests/mysql_num_rows.phpt8
-rw-r--r--ext/mysql/tests/mysql_pconn_disable.phpt4
-rwxr-xr-xext/mysql/tests/mysql_pconn_kill.phpt16
-rw-r--r--ext/mysql/tests/mysql_pconn_max_links.phpt16
-rw-r--r--ext/mysql/tests/mysql_ping.phpt8
-rw-r--r--ext/mysql/tests/mysql_query.phpt20
-rw-r--r--ext/mysql/tests/mysql_result.phpt4
-rw-r--r--ext/mysql/tests/mysql_trace_mode.phpt7
-rw-r--r--ext/mysql/tests/mysql_unbuffered_query.phpt20
43 files changed, 307 insertions, 46 deletions
diff --git a/ext/mysql/tests/002.phpt b/ext/mysql/tests/002.phpt
index 18f6c7037c..8355c5f11e 100755
--- a/ext/mysql/tests/002.phpt
+++ b/ext/mysql/tests/002.phpt
@@ -32,6 +32,10 @@ mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
resource(%d) of type (mysql link)
bool(true)
diff --git a/ext/mysql/tests/003.phpt b/ext/mysql/tests/003.phpt
index dd3c37058c..2d0b68b9f8 100755
--- a/ext/mysql/tests/003.phpt
+++ b/ext/mysql/tests/003.phpt
@@ -52,6 +52,10 @@ mysql_free_result($res);
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
==stdClass==
object(stdClass)#%d (1) {
diff --git a/ext/mysql/tests/bug47438.phpt b/ext/mysql/tests/bug47438.phpt
index 700c6d8018..11f0ff33b8 100644
--- a/ext/mysql/tests/bug47438.phpt
+++ b/ext/mysql/tests/bug47438.phpt
@@ -16,7 +16,7 @@ if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
mysql_select_db($db, $link);
mysql_query("DROP TABLE IF EXISTS test_47438", $link);
mysql_query("CREATE TABLE test_47438 (a INT, b INT, c INT)", $link);
-mysql_query("INSERT INTO test_47438 VALUES (10, 11, 12), (20, 21, 22)", $link);
+mysql_query("INSERT INTO test_47438 VALUES (10, 11, 12), (20, 21, 22)", $link);
$result = mysql_query("SELECT * FROM test_47438", $link);
mysql_field_seek($result, 1);
@@ -32,6 +32,20 @@ while($i<mysql_num_fields($result))
mysql_query("DROP TABLE IF EXISTS test_47438", $link);
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+if (!mysql_select_db($db, $link) ||
+ !mysql_query("DROP TABLE IF EXISTS test_47438", $link))
+ printf("[c002] [%d] %s\n", mysql_errno($link), mysql_error($link));
+
+mysql_close($link);
+?>
--EXPECT--
0.a
1.b
diff --git a/ext/mysql/tests/clean_table.inc b/ext/mysql/tests/clean_table.inc
new file mode 100644
index 0000000000..e53245b43f
--- /dev/null
+++ b/ext/mysql/tests/clean_table.inc
@@ -0,0 +1,15 @@
+<?PHP
+require_once('connect.inc');
+
+// connect + select_db
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $myhost, $user, $db, $port, $socket);
+}
+
+if (!mysql_query('DROP TABLE IF EXISTS test', $link)) {
+ printf("[clean] Failed to drop test table: [%d] %s\n", mysql_errno($link), mysql_error($link));
+}
+
+mysql_close($link);
+?> \ No newline at end of file
diff --git a/ext/mysql/tests/mysql_affected_rows.phpt b/ext/mysql/tests/mysql_affected_rows.phpt
index 9e2da44e3c..ecf0b5d855 100644
--- a/ext/mysql/tests/mysql_affected_rows.phpt
+++ b/ext/mysql/tests/mysql_affected_rows.phpt
@@ -116,5 +116,9 @@ if (false !== ($tmp = @mysql_affected_rows($link)))
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_create_db.phpt b/ext/mysql/tests/mysql_create_db.phpt
index 0a5d30e97a..bc91964f50 100644
--- a/ext/mysql/tests/mysql_create_db.phpt
+++ b/ext/mysql/tests/mysql_create_db.phpt
@@ -40,5 +40,17 @@ if (!mysql_query("DROP DATABASE mysqlcreatedb", $link))
print "done!";
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+if (!mysql_query("DROP DATABASE IF EXISTS mysqlcreatedb", $link))
+ printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+mysql_close($link);
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_data_seek.phpt b/ext/mysql/tests/mysql_data_seek.phpt
index 687af1136b..46a0f86bde 100644
--- a/ext/mysql/tests/mysql_data_seek.phpt
+++ b/ext/mysql/tests/mysql_data_seek.phpt
@@ -62,6 +62,10 @@ mysql_close($link);
print "done!\n";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_data_seek(): Offset 4 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d
diff --git a/ext/mysql/tests/mysql_db_query.phpt b/ext/mysql/tests/mysql_db_query.phpt
index 8adf481711..a3fc8c5608 100644
--- a/ext/mysql/tests/mysql_db_query.phpt
+++ b/ext/mysql/tests/mysql_db_query.phpt
@@ -57,5 +57,9 @@ mysql_close($link);
print "done!\n";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_drop_db.phpt b/ext/mysql/tests/mysql_drop_db.phpt
index fb42f7b22e..bd729e7ab8 100644
--- a/ext/mysql/tests/mysql_drop_db.phpt
+++ b/ext/mysql/tests/mysql_drop_db.phpt
@@ -39,5 +39,17 @@ mysql_close($link);
print "done!\n";
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+if (!mysql_query("DROP DATABASE IF EXISTS mysqldropdb", $link))
+ printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+mysql_close($link);
+?>
--EXPECTF--
done! \ No newline at end of file
diff --git a/ext/mysql/tests/mysql_errno.phpt b/ext/mysql/tests/mysql_errno.phpt
index 7a9e85fb30..8cfa7bd33b 100644
--- a/ext/mysql/tests/mysql_errno.phpt
+++ b/ext/mysql/tests/mysql_errno.phpt
@@ -50,6 +50,10 @@ if ($link = @mysql_connect($host . '_unknown', $user . '_unknown', $passwd, true
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
int(0)
int(%d)
diff --git a/ext/mysql/tests/mysql_error.phpt b/ext/mysql/tests/mysql_error.phpt
index b64982a42f..b92a646e88 100644
--- a/ext/mysql/tests/mysql_error.phpt
+++ b/ext/mysql/tests/mysql_error.phpt
@@ -57,6 +57,10 @@ if ('' == mysql_error())
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_error(): %d is not a valid MySQL-Link resource in %s on line %d
bool(false)
diff --git a/ext/mysql/tests/mysql_fetch_array.phpt b/ext/mysql/tests/mysql_fetch_array.phpt
index 469cc2f6f4..924c717501 100644
--- a/ext/mysql/tests/mysql_fetch_array.phpt
+++ b/ext/mysql/tests/mysql_fetch_array.phpt
@@ -277,6 +277,10 @@ printf("[015] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
[005]
array(4) {
diff --git a/ext/mysql/tests/mysql_fetch_assoc.phpt b/ext/mysql/tests/mysql_fetch_assoc.phpt
index a54e5fd0ec..3c5ca79b2d 100644
--- a/ext/mysql/tests/mysql_fetch_assoc.phpt
+++ b/ext/mysql/tests/mysql_fetch_assoc.phpt
@@ -58,6 +58,10 @@ mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
[005]
array(2) {
diff --git a/ext/mysql/tests/mysql_fetch_field.phpt b/ext/mysql/tests/mysql_fetch_field.phpt
index 0f337b80cb..f9767c82b7 100644
--- a/ext/mysql/tests/mysql_fetch_field.phpt
+++ b/ext/mysql/tests/mysql_fetch_field.phpt
@@ -133,6 +133,10 @@ require_once('skipifconnectfailure.inc');
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
object(stdClass)#%d (13) {
[%u|b%"name"]=>
diff --git a/ext/mysql/tests/mysql_fetch_lengths.phpt b/ext/mysql/tests/mysql_fetch_lengths.phpt
index 4b181765b4..4793e2649b 100644
--- a/ext/mysql/tests/mysql_fetch_lengths.phpt
+++ b/ext/mysql/tests/mysql_fetch_lengths.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_fetch_lengths()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -34,6 +34,10 @@ var_dump(mysql_fetch_lengths($res));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
array(2) {
[0]=>
diff --git a/ext/mysql/tests/mysql_fetch_object.phpt b/ext/mysql/tests/mysql_fetch_object.phpt
index ab31ae742b..c11631e04c 100644
--- a/ext/mysql/tests/mysql_fetch_object.phpt
+++ b/ext/mysql/tests/mysql_fetch_object.phpt
@@ -77,6 +77,10 @@ var_dump(mysql_fetch_object($res, 'this_class_does_not_exist'));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
object(stdClass)#%d (2) {
[%u|b%"ID"]=>
diff --git a/ext/mysql/tests/mysql_fetch_row.phpt b/ext/mysql/tests/mysql_fetch_row.phpt
index 7de2d25266..8d6b9585be 100644
--- a/ext/mysql/tests/mysql_fetch_row.phpt
+++ b/ext/mysql/tests/mysql_fetch_row.phpt
@@ -36,6 +36,10 @@ var_dump(mysql_fetch_row($res));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
[004]
array(2) {
diff --git a/ext/mysql/tests/mysql_field_flags.phpt b/ext/mysql/tests/mysql_field_flags.phpt
index c609123cc2..d655595f7d 100644
--- a/ext/mysql/tests/mysql_field_flags.phpt
+++ b/ext/mysql/tests/mysql_field_flags.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_field_flags()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -135,6 +135,10 @@ var_dump(mysql_field_flags($res, 0));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_field_flags() expects exactly 2 parameters, 1 given in %s on line %d
diff --git a/ext/mysql/tests/mysql_field_len.phpt b/ext/mysql/tests/mysql_field_len.phpt
index a81e36a681..a740c62439 100644
--- a/ext/mysql/tests/mysql_field_len.phpt
+++ b/ext/mysql/tests/mysql_field_len.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_field_len()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -42,6 +42,10 @@ var_dump(mysql_field_len($res, 0));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_field_len() expects exactly 2 parameters, 1 given in %s on line %d
diff --git a/ext/mysql/tests/mysql_field_name.phpt b/ext/mysql/tests/mysql_field_name.phpt
index f2ced72f7d..c87ac188f7 100644
--- a/ext/mysql/tests/mysql_field_name.phpt
+++ b/ext/mysql/tests/mysql_field_name.phpt
@@ -41,6 +41,10 @@ var_dump(mysql_field_name($res, 0));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_field_name() expects exactly 2 parameters, 1 given in %s on line %d
diff --git a/ext/mysql/tests/mysql_field_seek.phpt b/ext/mysql/tests/mysql_field_seek.phpt
index 8424fafc90..7e8b313c87 100644
--- a/ext/mysql/tests/mysql_field_seek.phpt
+++ b/ext/mysql/tests/mysql_field_seek.phpt
@@ -39,6 +39,10 @@ var_dump(mysql_field_seek($res, 0));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_field_seek(): Field -1 is invalid for MySQL result index %d in %s on line %d
bool(false)
diff --git a/ext/mysql/tests/mysql_field_table.phpt b/ext/mysql/tests/mysql_field_table.phpt
index a74b4da5ac..707d1df987 100644
--- a/ext/mysql/tests/mysql_field_table.phpt
+++ b/ext/mysql/tests/mysql_field_table.phpt
@@ -41,6 +41,10 @@ var_dump(mysql_field_table($res, 0));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_field_table() expects exactly 2 parameters, 1 given in %s on line %d
diff --git a/ext/mysql/tests/mysql_field_type.phpt b/ext/mysql/tests/mysql_field_type.phpt
index 575dad1fa1..c737b4e3f2 100644
--- a/ext/mysql/tests/mysql_field_type.phpt
+++ b/ext/mysql/tests/mysql_field_type.phpt
@@ -41,6 +41,10 @@ var_dump(mysql_field_type($res, 0));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_field_type() expects exactly 2 parameters, 1 given in %s on line %d
diff --git a/ext/mysql/tests/mysql_free_result.phpt b/ext/mysql/tests/mysql_free_result.phpt
index 5a02ecff37..fe132d8c2d 100644
--- a/ext/mysql/tests/mysql_free_result.phpt
+++ b/ext/mysql/tests/mysql_free_result.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_free_result()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -39,6 +39,10 @@ if ($tmp = sys_get_temp_dir()) {
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
bool(true)
diff --git a/ext/mysql/tests/mysql_get_host_info.phpt b/ext/mysql/tests/mysql_get_host_info.phpt
index d0ee6803af..4d60c21e80 100644
--- a/ext/mysql/tests/mysql_get_host_info.phpt
+++ b/ext/mysql/tests/mysql_get_host_info.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_get_host_info()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -36,5 +36,9 @@ if (!is_null($tmp = @mysql_get_host_info($link, "too many arguments"))) {
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_get_proto_info.phpt b/ext/mysql/tests/mysql_get_proto_info.phpt
index 3dae99314b..043fb62043 100644
--- a/ext/mysql/tests/mysql_get_proto_info.phpt
+++ b/ext/mysql/tests/mysql_get_proto_info.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_get_proto_info()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -26,5 +26,9 @@ if (NULL !== ($tmp = @mysql_get_proto_info('too many', 'arguments')))
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_get_server_info.phpt b/ext/mysql/tests/mysql_get_server_info.phpt
index 83b9c35f40..037adfb44c 100644
--- a/ext/mysql/tests/mysql_get_server_info.phpt
+++ b/ext/mysql/tests/mysql_get_server_info.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_get_server_info()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
diff --git a/ext/mysql/tests/mysql_info.phpt b/ext/mysql/tests/mysql_info.phpt
index 6cb058f181..ea73433f89 100644
--- a/ext/mysql/tests/mysql_info.phpt
+++ b/ext/mysql/tests/mysql_info.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_info()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -65,5 +65,9 @@ if ($def_tmp !== $tmp) {
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
done! \ No newline at end of file
diff --git a/ext/mysql/tests/mysql_insert_id.phpt b/ext/mysql/tests/mysql_insert_id.phpt
index 832f370b5f..2ef233f943 100644
--- a/ext/mysql/tests/mysql_insert_id.phpt
+++ b/ext/mysql/tests/mysql_insert_id.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_insert_id()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -60,6 +60,10 @@ var_dump(mysql_insert_id($link));
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_insert_id(): %d is not a valid MySQL-Link resource in %s on line %d
bool(false)
diff --git a/ext/mysql/tests/mysql_list_dbs.phpt b/ext/mysql/tests/mysql_list_dbs.phpt
index 7c8828d7aa..57a7efb451 100644
--- a/ext/mysql/tests/mysql_list_dbs.phpt
+++ b/ext/mysql/tests/mysql_list_dbs.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_list_dbs()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -46,5 +46,9 @@ mysql_close($link);
print "done!\n";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_list_fields.phpt b/ext/mysql/tests/mysql_list_fields.phpt
index 3ee7751191..dc3a3417d3 100644
--- a/ext/mysql/tests/mysql_list_fields.phpt
+++ b/ext/mysql/tests/mysql_list_fields.phpt
@@ -41,5 +41,20 @@ mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+if (!mysql_query("DROP TABLE IF EXISTS test", $link))
+ printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+if (!mysql_query("DROP TABLE IF EXISTS test2", $link))
+ printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+mysql_close($link);
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_list_tables.phpt b/ext/mysql/tests/mysql_list_tables.phpt
index 820ad378a0..cf0b1a636d 100644
--- a/ext/mysql/tests/mysql_list_tables.phpt
+++ b/ext/mysql/tests/mysql_list_tables.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_list_tables()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -77,5 +77,9 @@ mysql_close($link);
print "done!\n";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
done!
diff --git a/ext/mysql/tests/mysql_max_persistent.phpt b/ext/mysql/tests/mysql_max_persistent.phpt
index 498b5c5d36..ac35cd178b 100644
--- a/ext/mysql/tests/mysql_max_persistent.phpt
+++ b/ext/mysql/tests/mysql_max_persistent.phpt
@@ -4,15 +4,9 @@ mysql_[p]connect() - max_links/max_persistent
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
-require_once('connect.inc');
-
-$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket);
-if (!$link)
- die("skip Cannot connect to MySQL");
+require_once('table.inc');
-mysql_close($link);
-
-mysqli_query('DROP USER pcontest', $link);
+mysql_query('DROP USER pcontest', $link);
if (!mysql_query('CREATE USER pcontest IDENTIFIED BY "pcontest"', $link)) {
printf("skip Cannot create second DB user [%d] %s", mysql_errno($link), mysql_error($link));
mysql_close($link);
@@ -81,6 +75,20 @@ mysql_query('DROP USER pcontest', $links[0]);
mysql_close($links[0]);
print "done!\n";
?>
+--CLEAN--
+<?php
+// connect + select_db
+require_once("connect.inc");
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[c001] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $myhost, $user, $db, $port, $socket);
+}
+
+@mysql_query('REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest', $link);
+@mysql_query('DROP USER pcontest', $link);
+
+mysql_close($link);
+?>
--EXPECTF--
Warning: mysql_pconnect(): Too many open persistent links (1) in %s on line %d
[020] Cannot connect using host '%s', user '%s', password '****', [0] 0
diff --git a/ext/mysql/tests/mysql_num_fields.phpt b/ext/mysql/tests/mysql_num_fields.phpt
index 3ec305ea2d..0dad5f771d 100644
--- a/ext/mysql/tests/mysql_num_fields.phpt
+++ b/ext/mysql/tests/mysql_num_fields.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_num_fields()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -47,6 +47,10 @@ mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_num_fields(): %d is not a valid MySQL result resource in %s on line %d
done!
diff --git a/ext/mysql/tests/mysql_num_rows.phpt b/ext/mysql/tests/mysql_num_rows.phpt
index d93b4e2ffc..1f68b4d609 100644
--- a/ext/mysql/tests/mysql_num_rows.phpt
+++ b/ext/mysql/tests/mysql_num_rows.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_num_rows()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -57,6 +57,10 @@ if ($res = mysql_query('SELECT COUNT(id) AS num FROM test', $link)) {
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in %s on line %d
diff --git a/ext/mysql/tests/mysql_pconn_disable.phpt b/ext/mysql/tests/mysql_pconn_disable.phpt
index 9ec44234ad..dfb04eeef1 100644
--- a/ext/mysql/tests/mysql_pconn_disable.phpt
+++ b/ext/mysql/tests/mysql_pconn_disable.phpt
@@ -52,6 +52,10 @@ mysql.max_links=2
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
[001] Can connect to the server.
[002] Can fetch data using persistent connection! Data = '1'
diff --git a/ext/mysql/tests/mysql_pconn_kill.phpt b/ext/mysql/tests/mysql_pconn_kill.phpt
index df863bb791..8543e39d6c 100755
--- a/ext/mysql/tests/mysql_pconn_kill.phpt
+++ b/ext/mysql/tests/mysql_pconn_kill.phpt
@@ -1,7 +1,7 @@
--TEST--
mysql_pconnect() - killing persitent connection
--SKIPIF--
-<?php
+<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
@@ -24,7 +24,7 @@ mysql.max_persistent=2
printf("[001] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $myhost, $user, $db, $port, $socket);
mysql_select_db($db, $plink);
-
+
$pthread_id = mysql_thread_id($plink);
$thread_id = mysql_thread_id($link);
@@ -40,8 +40,8 @@ mysql.max_persistent=2
printf("[003] Cannot find regular connection thread in process list, [%d] %s\n", mysql_errno($link), mysql_error($link));
if (!isset($processlist[$pthread_id]))
printf("[004] Cannot find persistent connection thread in process list, [%d] %s\n", mysql_errno($link), mysql_error($link));
-
- if (!mysql_query(sprintf("KILL %d", $pthread_id), $link))
+
+ if (!mysql_query(sprintf("KILL %d", $pthread_id), $link))
printf("[005] Cannot kill persistent connection thread, [%d] %s\n", mysql_errno($link), mysql_error($link));
while (1) {
@@ -64,7 +64,7 @@ mysql.max_persistent=2
mysql_close($plink);
- if (!($plink = mysql_pconnect($myhost, $user, $passwd)))
+ if (!($plink = mysql_pconnect($myhost, $user, $passwd)))
printf("[009] Cannot create new persistent connection, [%d] %s\n", mysql_errno(), mysql_error());
mysql_select_db($db, $plink);
@@ -82,7 +82,7 @@ mysql.max_persistent=2
printf("[012] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $myhost, $user, $db, $port, $socket);
mysql_select_db($db, $link2);
- if (!mysql_query(sprintf("KILL %d", $thread_id), $link2))
+ if (!mysql_query(sprintf("KILL %d", $thread_id), $link2))
printf("[013] Cannot kill regular connection thread, [%d] %s\n", mysql_errno($link2), mysql_error($link2));
if (!($link = mysql_connect($myhost, $user, $passwd, true)))
@@ -101,6 +101,10 @@ mysql.max_persistent=2
mysql_close($link2);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
bool(true)
done!
diff --git a/ext/mysql/tests/mysql_pconn_max_links.phpt b/ext/mysql/tests/mysql_pconn_max_links.phpt
index ef7073fe27..f9776d5797 100644
--- a/ext/mysql/tests/mysql_pconn_max_links.phpt
+++ b/ext/mysql/tests/mysql_pconn_max_links.phpt
@@ -4,7 +4,7 @@ Persistent connections and mysql.max_persistent
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
- require_once('connect.inc');
+ require_once('table.inc');
if ($socket)
$host = sprintf("%s:%s", $host, $socket);
@@ -139,6 +139,20 @@ mysql.allow_persistent=1
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+// connect + select_db
+require_once("connect.inc");
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[c001] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $myhost, $user, $db, $port, $socket);
+}
+
+@mysql_query('REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest', $link);
+@mysql_query('DROP USER pcontest', $link);
+
+mysql_close($link);
+?>
--EXPECTF--
array(2) {
[%u|b%"id"]=>
diff --git a/ext/mysql/tests/mysql_ping.phpt b/ext/mysql/tests/mysql_ping.phpt
index 2e4130e33f..edf18c4391 100644
--- a/ext/mysql/tests/mysql_ping.phpt
+++ b/ext/mysql/tests/mysql_ping.phpt
@@ -1,8 +1,8 @@
--TEST--
mysql_ping()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -37,6 +37,10 @@ if (false !== ($tmp = mysql_ping($link)))
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
bool(true)
bool(true)
diff --git a/ext/mysql/tests/mysql_query.phpt b/ext/mysql/tests/mysql_query.phpt
index 6c8697c7c7..9bfca97b6f 100644
--- a/ext/mysql/tests/mysql_query.phpt
+++ b/ext/mysql/tests/mysql_query.phpt
@@ -92,6 +92,26 @@ if (false !== ($tmp = mysql_query("SELECT id FROM test", $link)))
print "done!";
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+// connect + select_db
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $myhost, $user, $db, $port, $socket);
+}
+
+if (!mysql_query('DROP TABLE IF EXISTS test', $link)) {
+ printf("[clean] Failed to drop test table: [%d] %s\n", mysql_errno($link), mysql_error($link));
+}
+
+/* MySQL server may not support this - ignore errors */
+@mysql_query('DROP PROCEDURE IF EXISTS p', $link);
+@mysql_query('DROP FUNCTION IF EXISTS f', $link);
+
+mysql_close($link);
+?>
--EXPECTF--
array(1) {
[%u|b%"valid"]=>
diff --git a/ext/mysql/tests/mysql_result.phpt b/ext/mysql/tests/mysql_result.phpt
index 218cfc319d..2c7c618547 100644
--- a/ext/mysql/tests/mysql_result.phpt
+++ b/ext/mysql/tests/mysql_result.phpt
@@ -60,6 +60,10 @@ var_dump(mysql_result($res, 0));
mysql_close($link);
print "done!";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Warning: mysql_result(): Unable to jump to row -1 on MySQL result index %d in %s on line %d
bool(false)
diff --git a/ext/mysql/tests/mysql_trace_mode.phpt b/ext/mysql/tests/mysql_trace_mode.phpt
index 201129eff6..622f413062 100644
--- a/ext/mysql/tests/mysql_trace_mode.phpt
+++ b/ext/mysql/tests/mysql_trace_mode.phpt
@@ -10,12 +10,11 @@ mysql.trace_mode=1
error_reporting=E_ALL | E_NOTICE | E_STRICT
--FILE--
<?php
-require_once('connect.inc');
require_once('table.inc');
$res1 = mysql_query('SELECT id FROM test', $link);
-if (!$res2 = mysql_db_query('test', 'SELECT id FROM test', $link))
+if (!$res2 = mysql_db_query($db, 'SELECT id FROM test', $link))
printf("[001] [%d] %s\n", mysql_errno($link), mysql_error($link));
mysql_free_result($res2);
print mysql_escape_string("I don't mind character sets, do I?\n");
@@ -25,6 +24,10 @@ mysql_close($link);
print "done!\n";
?>
+--CLEAN--
+<?php
+require_once("clean_table.inc");
+?>
--EXPECTF--
Deprecated: mysql_db_query(): %s
diff --git a/ext/mysql/tests/mysql_unbuffered_query.phpt b/ext/mysql/tests/mysql_unbuffered_query.phpt
index bc73c58885..b234f2008d 100644
--- a/ext/mysql/tests/mysql_unbuffered_query.phpt
+++ b/ext/mysql/tests/mysql_unbuffered_query.phpt
@@ -86,6 +86,26 @@ if (false !== ($tmp = mysql_unbuffered_query("SELECT id FROM test", $link)))
print "done!";
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+// connect + select_db
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $myhost, $user, $db, $port, $socket);
+}
+
+if (!mysql_query('DROP TABLE IF EXISTS test', $link)) {
+ printf("[clean] Failed to drop test table: [%d] %s\n", mysql_errno($link), mysql_error($link));
+}
+
+/* MySQL server may not support this - ignore errors */
+@mysql_query('DROP PROCEDURE IF EXISTS p', $link);
+@mysql_query('DROP FUNCTION IF EXISTS f', $link);
+
+mysql_close($link);
+?>
--EXPECTF--
array(1) {
[%u|b%"valid"]=>