Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reserved words issue #216

Merged
merged 2 commits into from
Mar 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions doc/config.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ Basic settings


You can set this parameter to ``true`` to stop this message from appearing. You can set this parameter to ``true`` to stop this message from appearing.


.. config:option:: $cfg['ReservedWordDisableWarning']

:type: boolean
:default: false

This warning is displayed on the Structure page of a table if one or more
column names match with words which are MySQL reserved.

If you want to turn off this warning, you can set it to ``true`` and
warning will not longer be displayed

.. config:option:: $cfg['TranslationWarningThreshold'] .. config:option:: $cfg['TranslationWarningThreshold']


:type: integer :type: integer
Expand Down
7 changes: 7 additions & 0 deletions libraries/config.default.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
*/ */
$cfg['ServerLibraryDifference_DisableWarning'] = false; $cfg['ServerLibraryDifference_DisableWarning'] = false;


/**
* Disable the default warning about MySQL reserved words in column names
*
* @global boolean $cfg['ReservedWordDisableWarning']
*/
$cfg['ReservedWordDisableWarning'] = false;

/** /**
* Show warning about incomplete translations on certain threshold. * Show warning about incomplete translations on certain threshold.
* *
Expand Down
2 changes: 2 additions & 0 deletions libraries/config/messages.inc.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@
$strConfigPmaNoRelation_DisableWarning_name = __('Missing phpMyAdmin configuration storage tables'); $strConfigPmaNoRelation_DisableWarning_name = __('Missing phpMyAdmin configuration storage tables');
$strConfigServerLibraryDifference_DisableWarning_desc = __('Disable the default warning that is displayed if a difference between the MySQL library and server is detected'); $strConfigServerLibraryDifference_DisableWarning_desc = __('Disable the default warning that is displayed if a difference between the MySQL library and server is detected');
$strConfigServerLibraryDifference_DisableWarning_name = __('Server/library difference warning'); $strConfigServerLibraryDifference_DisableWarning_name = __('Server/library difference warning');
$strConfigReservedWordDisableWarning_desc = __('Disable the default warning that is displayed on the Structure page if column names in a table are reserved MySQL words');
$strConfigReservedWordDisableWarning_name = __('MySQL reserved word warning');
$strConfigPropertiesIconic_desc = __('Use only icons, only text or both'); $strConfigPropertiesIconic_desc = __('Use only icons, only text or both');
$strConfigPropertiesIconic_name = __('Iconic table operations'); $strConfigPropertiesIconic_name = __('Iconic table operations');
$strConfigProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing'); $strConfigProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing');
Expand Down
3 changes: 2 additions & 1 deletion libraries/config/user_preferences.forms.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
'ServerLibraryDifference_DisableWarning', 'ServerLibraryDifference_DisableWarning',
'PmaNoRelation_DisableWarning', 'PmaNoRelation_DisableWarning',
'SuhosinDisableWarning', 'SuhosinDisableWarning',
'McryptDisableWarning'); 'McryptDisableWarning',
'ReservedWordDisableWarning');
// settings from this form are treated specially, // settings from this form are treated specially,
// see prefs_forms.php and user_preferences.lib.php // see prefs_forms.php and user_preferences.lib.php
$forms['Features']['Developer'] = array( $forms['Features']['Developer'] = array(
Expand Down
14 changes: 0 additions & 14 deletions sql.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1203,20 +1203,6 @@
echo '</fieldset>' . "\n"; echo '</fieldset>' . "\n";
} }



// Check column names for MySQL reserved words
$pma_table = new PMA_Table($table, $db);
$columns = $pma_table->getReservedColumnNames();
if (! empty($columns)) {
foreach ($columns as $column) {
$msg = PMA_message::notice(
__('The column name \'%s\' is a MySQL reserved keyword.')
);
$msg->addParam($column);
$msg->display();
}
}

// Displays the results in a table // Displays the results in a table
if (empty($disp_mode)) { if (empty($disp_mode)) {
// see the "PMA_setDisplayMode()" function in // see the "PMA_setDisplayMode()" function in
Expand Down
20 changes: 11 additions & 9 deletions tbl_structure.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -134,15 +134,17 @@
$url_params['back'] = 'tbl_structure.php'; $url_params['back'] = 'tbl_structure.php';


// Check column names for MySQL reserved words // Check column names for MySQL reserved words
$pma_table = new PMA_Table($table, $db); if ($cfg['ReservedWordDisableWarning'] === false) {
$columns = $pma_table->getReservedColumnNames(); $pma_table = new PMA_Table($table, $db);
if (! empty($columns)) { $columns = $pma_table->getReservedColumnNames();
foreach ($columns as $column) { if (! empty($columns)) {
$msg = PMA_message::notice( foreach ($columns as $column) {
__('The column name \'%s\' is a MySQL reserved keyword.') $msg = PMA_message::notice(
); __('The column name \'%s\' is a MySQL reserved keyword.')
$msg->addParam($column); );
$response->addHTML($msg); $msg->addParam($column);
$response->addHTML($msg);
}
} }
} }


Expand Down