Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion ext/mysqli/tests/mysqli_get_client_stats.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,33 @@ mysqli_get_client_stats()
mysqli
--SKIPIF--
<?PHP
require_once 'skipifconnectfailure.inc';
require_once __DIR__ . '/test_setup/test_helpers.inc';
$link = mysqli_connect_or_skip();
// We run some operations that need CREATE SERVER and CREATE DATABASE in
// this test, so check if we can do that. We don't check if we can merely
// create a table; if that doesn't work with the provided database, many
// more tests would fail.

// It seems DML can be privilege checked on prepare, but DML can't be, so
// we need to execute and clean up.
try {
$sql = "CREATE DATABASE mysqli_get_client_stats";
$stmt = mysqli_query($link, $sql);
$stmt->close();
mysqli_query($link, "DROP DATABASE mysqli_get_client_stats");
} catch (\mysqli_sql_exception) {
die("skip don't have create database privilege");
}
try {
$sql = sprintf("CREATE SERVER myself FOREIGN DATA WRAPPER mysql OPTIONS (user '%s', password '%s', database '%s')",
get_default_user(), get_default_password(), get_default_database());
$stmt = mysqli_query($link, $sql);
$stmt->close();
mysqli_query($link, "DROP SERVER myself");
} catch(\mysqli_sql_exception) {
die("skip don't have create server privilege");
}
mysqli_close($link);
?>
--INI--
mysqlnd.collect_statistics=1
Expand Down
Loading