Translated using Weblate (Italian)
[phpmyadmin.git] / db_sql_autocomplete.php
blobb760e2322b240d98dbfffc6253a3a134339c3d0b
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 require_once 'libraries/common.inc.php';
11 if ($GLOBALS['cfg']['EnableAutocompleteForTablesAndColumns']) {
12 $db = isset($_POST['db']) ? $_POST['db'] : $GLOBALS['db'];
13 $sql_autocomplete = array();
14 if ($db) {
15 $tableNames = $GLOBALS['dbi']->getTables($db);
16 foreach ($tableNames as $tableName) {
17 $sql_autocomplete[$tableName] = $GLOBALS['dbi']->getColumns(
18 $db, $tableName
22 } else {
23 $sql_autocomplete = true;
25 $response = PMA\libraries\Response::getInstance();
26 $response->addJSON("tables", json_encode($sql_autocomplete));