Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNisarg Jhaveri <nisarg.jhaveri@research.iiit.ac.in>2014-10-14 21:52:15 +0400
committerNisarg Jhaveri <nisarg.jhaveri@research.iiit.ac.in>2014-10-14 21:52:15 +0400
commit6cc3ea6eae4a0cef0987cb40dfe8b2fc20ffe20a (patch)
treebeb0733df07169337c0c6dfe62ee2e1549b0f3bf /db_sql_autocomplete.php
parentbd25766b7b15b129515f6a0ae94ab9533216bdcf (diff)
Autocomplete table/column names in SQL editors
- In DB and Table level SQL editors, console - Updated CodeMirror addon `sql-hint.js` to newer version Signed-off-by: Nisarg Jhaveri <nisarg.jhaveri@research.iiit.ac.in>
Diffstat (limited to 'db_sql_autocomplete.php')
-rw-r--r--db_sql_autocomplete.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/db_sql_autocomplete.php b/db_sql_autocomplete.php
new file mode 100644
index 0000000000..48cf3d884c
--- /dev/null
+++ b/db_sql_autocomplete.php
@@ -0,0 +1,22 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Table/Column autocomplete in SQL editors
+ *
+ * @package PhpMyAdmin
+ */
+
+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']->getColumnNames($db, $tableName);
+ }
+}
+
+$response = PMA_Response::getInstance();
+$response->addJSON("tables", json_encode($sql_autocomplete));