summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Treat2015-02-07 20:52:44 +0000
committerRobert Treat2015-02-07 20:52:44 +0000
commit9523ba9c1143436ad453e4e4c9e7f7e0adf807f2 (patch)
tree86a3fb55efcb53bfe6b8ee3a024147c164b89ea3
parent5bae075d524212b3b6c9da965c9104993d15004d (diff)
Enable querying over inspected tables / views. This was based on a patch by Felipe Figueroa <amenadiel@gmail.com>
resolves #22
-rw-r--r--display.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/display.php b/display.php
index 89bf92ac..87771db4 100644
--- a/display.php
+++ b/display.php
@@ -525,6 +525,21 @@
if ($save_history && is_object($rs) && ($type == 'QUERY')) //{
$misc->saveScriptHistory($_REQUEST['query']);
+ echo '<form method="POST" action="'.$_SERVER['REQUEST_URI'].'"><textarea width="90%" name="query" rows="5" cols="100" resizable="true">';
+ if (isset($_REQUEST['query'])) {
+ $query = $_REQUEST['query'];
+ } else {
+ $query = "SELECT * FROM {$_REQUEST['schema']}";
+ if ($_REQUEST['subject'] == 'view') {
+ $query = "{$query}.{$_REQUEST['view']};";
+ } else {
+ $query = "{$query}.{$_REQUEST['table']};";
+ }
+ }
+ //$query = isset($_REQUEST['query'])? $_REQUEST['query'] : "select * from {$_REQUEST['schema']}.{$_REQUEST['table']};";
+ echo $query;
+ echo '</textarea><br><input type="submit"/></form>';
+
if (is_object($rs) && $rs->recordCount() > 0) {
// Show page navigation
$misc->printPages($_REQUEST['page'], $max_pages, $_gets);
@@ -814,7 +829,7 @@
$scripts .= "};\n";
$scripts .= "</script>\n";
- // If a table is specified, then set the title differently
+ // Set the title based on the subject of the request
if (isset($_REQUEST['subject']) && isset($_REQUEST[$_REQUEST['subject']])) {
if ($_REQUEST['subject'] == 'table') {
$misc->printHeader(
@@ -827,7 +842,13 @@
$lang['strviews'].': '.$_REQUEST[$_REQUEST['subject']],
$scripts
);
- }
+ }
+ else if ($_REQUEST['subject'] == 'column') {
+ $misc->printHeader(
+ $lang['strcolumn'].': '.$_REQUEST[$_REQUEST['subject']],
+ $scripts
+ );
+ }
}
else
$misc->printHeader($lang['strqueryresults']);