Fix #13178 - Issues with uppercase table and database names

Fixes: #13178
[ci skip]
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-04-28 21:01:36 +02:00
parent 14e8d5db7e
commit ca3f027f7e
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
3 changed files with 30 additions and 0 deletions

View File

@ -125,6 +125,12 @@ class ServerDatabasesController extends Controller
*/
public function createDatabaseAction()
{
// lower_case_table_names=1 `DB` becomes `db`
if ($GLOBALS['dbi']->getLowerCaseNames() === '1') {
$_POST['new_db'] = mb_strtolower(
$_POST['new_db']
);
}
/**
* Builds and executes the db creation sql query
*/

View File

@ -62,6 +62,15 @@ $action = 'tbl_create.php';
* The form used to define the structure of the table has been submitted
*/
if (isset($_POST['do_save_data'])) {
// lower_case_table_names=1 `DB` becomes `db`
if ($GLOBALS['dbi']->getLowerCaseNames() === '1') {
$db = mb_strtolower(
$db
);
$table = mb_strtolower(
$table
);
}
$sql_query = $createAddField->getTableCreationQuery($db, $table);
// If there is a request for SQL previewing.

View File

@ -24,6 +24,15 @@ require_once 'libraries/common.inc.php';
*/
require_once 'libraries/check_user_privileges.inc.php';
// lower_case_table_names=1 `DB` becomes `db`
$lowerCaseNames = $GLOBALS['dbi']->getLowerCaseNames() === '1';
if ($lowerCaseNames) {
$GLOBALS['table'] = mb_strtolower(
$GLOBALS['table']
);
}
$pma_table = new Table($GLOBALS['table'], $GLOBALS['db']);
/**
@ -121,6 +130,12 @@ if (isset($_POST['submitoptions'])) {
$warning_messages = array();
if (isset($_POST['new_name'])) {
// lower_case_table_names=1 `DB` becomes `db`
if ($lowerCaseNames) {
$_POST['new_name'] = mb_strtolower(
$_POST['new_name']
);
}
// Get original names before rename operation
$oldTable = $pma_table->getName();
$oldDb = $pma_table->getDbName();