Translated using Weblate (Hebrew)
[phpmyadmin.git] / db_sql_autocomplete.php
blob0fe4ae6fbde213e689a704e11dc450cd7112ca2e
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 PhpMyAdmin\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));