Skip to content

Commit

Permalink
Reserved word warning config
Browse files Browse the repository at this point in the history
This commit removes reserved word warning from the Browse pages and the
warning on structure page can be switched on/off using the config
variable $cfg['ReservedWordWarning']
  • Loading branch information
ayushchd committed Mar 10, 2013
1 parent 2194bfc commit 665ffd4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
7 changes: 7 additions & 0 deletions libraries/config.default.php
Expand Up @@ -69,6 +69,13 @@
*/ */
$cfg['ServerLibraryDifference_DisableWarning'] = false; $cfg['ServerLibraryDifference_DisableWarning'] = false;


/**

This comment has been minimized.

Copy link
@lem9

lem9 Mar 11, 2013

When adding a new directive, you should document it. This is done in doc/config.rst and I suggest adding a short paragraph in the Generic settings section.

It would be interesting also to offer the user a chance to change the directive, via the user prefs module (the "More settings" link on home page). Can you take care of these two issues?

This comment has been minimized.

Copy link
@ayushchd

ayushchd Mar 12, 2013

Author Owner

Okay, I'll do that.

* Show warning about MySQL reserved words in column names
*
* @global boolean $cfg['ReservedWordWarning']
*/

This comment has been minimized.

Copy link
@lem9

lem9 Mar 11, 2013

It's not an easy choice to pick up a default value but I think the community would be best served by setting this to true.

$cfg['ReservedWordWarning'] = false;

/** /**
* Show warning about incomplete translations on certain threshold. * Show warning about incomplete translations on certain threshold.
* *
Expand Down
14 changes: 0 additions & 14 deletions sql.php
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
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['ReservedWordWarning'] === true) {
$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

0 comments on commit 665ffd4

Please sign in to comment.