diff options
author | Michal Čihař <michal@cihar.com> | 2006-12-05 13:11:16 +0300 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2006-12-05 13:11:16 +0300 |
commit | a247be5fc0fc941a51e336980ae4be2ccfb86d91 (patch) | |
tree | f3bf4e343296bf86846406d4bbc796c8a1e4839f /server_privileges.php | |
parent | 8ff15cb2146d1d4f2c72553d15742eb258c54e99 (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.php | 4 |
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; |