Merge pull request #1601 from pratiksethia1/rfe1625-Autocomplete-Sql
Feature Request #1625 Autocomplete Sql
This commit is contained in:
commit
a653247189
@ -8,17 +8,19 @@
|
||||
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
$db = isset($_POST['db']) ? $_POST['db'] : $GLOBALS['db'];
|
||||
$sql_autocomplete = array();
|
||||
|
||||
if ($db) {
|
||||
$tableNames = $GLOBALS['dbi']->getTables($db);
|
||||
foreach ($tableNames as $tableName) {
|
||||
$sql_autocomplete[$tableName] = $GLOBALS['dbi']->getColumns(
|
||||
$db, $tableName
|
||||
);
|
||||
if ($GLOBALS['cfg']['EnableAutocompleteForTablesAndColumns']) {
|
||||
$db = isset($_POST['db']) ? $_POST['db'] : $GLOBALS['db'];
|
||||
$sql_autocomplete = array();
|
||||
if ($db) {
|
||||
$tableNames = $GLOBALS['dbi']->getTables($db);
|
||||
foreach ($tableNames as $tableName) {
|
||||
$sql_autocomplete[$tableName] = $GLOBALS['dbi']->getColumns(
|
||||
$db, $tableName
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sql_autocomplete = true;
|
||||
}
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON("tables", json_encode($sql_autocomplete));
|
||||
|
||||
@ -2435,6 +2435,14 @@ Text fields
|
||||
Defines if the whole textarea of the query box will be selected on
|
||||
click.
|
||||
|
||||
.. config:option:: $cfg['EnableAutocompleteForTablesAndColumns']
|
||||
|
||||
:type: boolean
|
||||
:default: true
|
||||
|
||||
Whether to Enable Autocomplete for table and Column names in any
|
||||
SQL Query box.
|
||||
|
||||
|
||||
SQL query box settings
|
||||
----------------------
|
||||
|
||||
@ -2875,6 +2875,13 @@ $cfg['SQLQuery']['ShowAsPHP'] = true;
|
||||
*/
|
||||
$cfg['SQLQuery']['Refresh'] = true;
|
||||
|
||||
/**
|
||||
* Enables AutoComplete for table & Column names in SQL queries
|
||||
*
|
||||
* default = 'true'
|
||||
*/
|
||||
$cfg['EnableAutocompleteForTablesAndColumns'] = true;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Web server upload/save/import directories
|
||||
|
||||
@ -91,6 +91,8 @@ $strConfigDefaultTabServer_desc = __('Tab that is displayed when entering a serv
|
||||
$strConfigDefaultTabServer_name = __('Default server tab');
|
||||
$strConfigDefaultTabTable_desc = __('Tab that is displayed when entering a table.');
|
||||
$strConfigDefaultTabTable_name = __('Default table tab');
|
||||
$strConfigEnableAutocompleteForTablesAndColumns_desc = __('Auto-Complete of the table and Column names in the SQL queries.');
|
||||
$strConfigEnableAutocompleteForTablesAndColumns_name = __('Enable AutoComplete for Table ');
|
||||
$strConfigHideStructureActions_desc
|
||||
= __('Whether the table structure actions should be hidden.');
|
||||
$strConfigHideStructureActions_name = __('Hide table structure actions');
|
||||
|
||||
@ -159,7 +159,8 @@ $forms['Sql_queries']['Sql_queries'] = array(
|
||||
'IgnoreMultiSubmitErrors',
|
||||
'MaxCharactersInDisplayedSQL',
|
||||
'RetainQueryBox',
|
||||
'CodemirrorEnable');
|
||||
'CodemirrorEnable',
|
||||
'EnableAutocompleteForTablesAndColumns');
|
||||
$forms['Sql_queries']['Sql_box'] = array('SQLQuery' => array(
|
||||
'Edit',
|
||||
'Explain',
|
||||
|
||||
@ -68,7 +68,8 @@ $forms['Sql_queries']['Sql_queries'] = array(
|
||||
'IgnoreMultiSubmitErrors',
|
||||
'MaxCharactersInDisplayedSQL',
|
||||
'RetainQueryBox',
|
||||
'CodemirrorEnable');
|
||||
'CodemirrorEnable',
|
||||
'EnableAutocompleteForTablesAndColumns');
|
||||
$forms['Sql_queries']['Sql_box'] = array(
|
||||
'SQLQuery/Edit',
|
||||
'SQLQuery/Explain',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user