Translated using Weblate (Indonesian)
[phpmyadmin.git] / db_sql_autocomplete.php
blob1557da9ec3f34fc880bb8bd59a9f7b4a4ee1dfde
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Table/Column autocomplete in SQL editors
6 * @package PhpMyAdmin
7 */
9 use PMA\libraries\Response;
10 require_once 'libraries/common.inc.php';
12 if ($GLOBALS['cfg']['EnableAutocompleteForTablesAndColumns']) {
13 $db = isset($_POST['db']) ? $_POST['db'] : $GLOBALS['db'];
14 $sql_autocomplete = array();
15 if ($db) {
16 $tableNames = $GLOBALS['dbi']->getTables($db);
17 foreach ($tableNames as $tableName) {
18 $sql_autocomplete[$tableName] = $GLOBALS['dbi']->getColumns(
19 $db, $tableName
23 } else {
24 $sql_autocomplete = true;
26 $response = Response::getInstance();
27 $response->addJSON("tables", json_encode($sql_autocomplete));