Merge remote-tracking branch 'origin/QA_4_4' into QA_4_4
[phpmyadmin.git] / db_sql_autocomplete.php
blob4897f0058aa90e84a6d4c1772bfa1ed56df37bad
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 $db = isset($_POST['db']) ? $_POST['db'] : $GLOBALS['db'];
12 $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
23 $response = PMA_Response::getInstance();
24 $response->addJSON("tables", json_encode($sql_autocomplete));