Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2006-12-05 13:11:16 +0300
committerMichal Čihař <michal@cihar.com>2006-12-05 13:11:16 +0300
commita247be5fc0fc941a51e336980ae4be2ccfb86d91 (patch)
treef3bf4e343296bf86846406d4bbc796c8a1e4839f /server_privileges.php
parent8ff15cb2146d1d4f2c72553d15742eb258c54e99 (diff)
Add IF NOT EXISTS to CREATE DATABASE query (RFE #1608372), reload navigation after creating database.
Diffstat (limited to 'server_privileges.php')
-rw-r--r--server_privileges.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/server_privileges.php b/server_privileges.php
index b4f8dbb270..a1613dde5d 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -836,9 +836,11 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
/* Create database for new user */
if (isset($createdb) && $createdb > 0) {
if ($createdb == 1) {
- $q = 'CREATE DATABASE ' . PMA_backquote(PMA_sqlAddslashes($username)) . ';';
+ $q = 'CREATE DATABASE IF NOT EXISTS ' . PMA_backquote(PMA_sqlAddslashes($username)) . ';';
$sql_query .= $q;
PMA_DBI_try_query($q) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query);
+ $GLOBALS['reload'] = TRUE;
+ PMA_reloadNavigation();
$q = 'GRANT ALL PRIVILEGES ON ' . PMA_backquote(PMA_sqlAddslashes($username)) . '.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';';
$sql_query .= $q;