Add IF NOT EXISTS to CREATE DATABASE query (RFE #1608372), reload navigation after creating database.

This commit is contained in:
Michal Čihař
2006-12-05 10:11:16 +00:00
parent 8ff15cb214
commit a247be5fc0
2 changed files with 7 additions and 1 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog
$Id$ $Id$
$HeadURL$ $HeadURL$
2006-12-05 Michal Čihař <michal@cihar.com>
* server_privileges.php: Add IF NOT EXISTS to CREATE DATABASE query (RFE
#1608372), reload navigation after creating database.
2006-12-04 Marc Delisle <lem9@users.sourceforge.net> 2006-12-04 Marc Delisle <lem9@users.sourceforge.net>
* db_structure.php, bug #1605985, missing HTML tag * db_structure.php, bug #1605985, missing HTML tag

View File

@@ -836,9 +836,11 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
/* Create database for new user */ /* Create database for new user */
if (isset($createdb) && $createdb > 0) { if (isset($createdb) && $createdb > 0) {
if ($createdb == 1) { 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; $sql_query .= $q;
PMA_DBI_try_query($q) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query); 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 . '\';'; $q = 'GRANT ALL PRIVILEGES ON ' . PMA_backquote(PMA_sqlAddslashes($username)) . '.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';';
$sql_query .= $q; $sql_query .= $q;