* Rename user feature for PostgreSQL >= 7.4
* Create functions returning arrays and table types
* Allow editing Select results by oid
+* Allow pagination of queries entered in the SQL box
+* Allow EXPLAIN ANALYZE of SQL queries
+* Default cursor conveniently in SQL box and Find
Bugs
* Object browser fixed for databases with no schemas
/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.58 2004/02/02 12:15:57 chriskl Exp $
+ * $Id: Misc.php,v 1.59 2004/02/13 08:53:05 chriskl Exp $
*/
class Misc {
* Displays link to the context help.if $conf['docsdir'] is set
* @param $url - last part of a document's url (relative to $conf['docsdir'])
*/
-
function printHelp($url) {
global $lang, $conf;
}
}
+ /**
+ * Outputs JavaScript to set default focus
+ * @param $object eg. forms[0].username
+ */
+ function setFocus($object) {
+ echo "<script language=\"JavaScript\">\n";
+ echo "<!--\n";
+ echo " document.{$object}.focus();\n";
+ echo "-->\n";
+ echo "</script>\n";
+ }
+
}
?>
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.34 2004/02/02 12:15:57 chriskl Exp $
+ * $Id: database.php,v 1.35 2004/02/13 08:53:04 chriskl Exp $
*/
// Include application functions
echo "<input type=\"hidden\" name=\"action\" value=\"find\" />\n";
echo "</form>\n";
+ // Default focus
+ $misc->setFocus('forms[0].term');
+
// If a search term has been specified, then perform the search
// and display the results, grouped by object type
if ($_GET['term'] != '') {
htmlspecialchars($_REQUEST['query']), "</textarea></p>\n";
echo $misc->form;
+ echo "<input type=\"checkbox\" name=\"paginate\"", (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''), " /> {$lang['strpaginate']}\n";
+ echo "<br /><br />\n";
echo "<input type=\"submit\" value=\"{$lang['strgo']}\" />\n";
echo "</form>\n";
+
+ // Default focus
+ $misc->setFocus('forms[0].query');
}
/**
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.131 2004/02/02 12:15:58 chriskl Exp $
+ * $Id: english.php,v 1.132 2004/02/13 08:53:05 chriskl Exp $
*/
// Language and character set
$lang['strexpand'] = 'Expand';
$lang['strcollapse'] = 'Collapse';
$lang['strexplain'] = 'Explain';
+ $lang['strexplainanalyze'] = 'Explain Analyze';
$lang['strfind'] = 'Find';
$lang['stroptions'] = 'Options';
$lang['strrefresh'] = 'Refresh';
$lang['strprocesses'] = 'Processes';
$lang['strsetting'] = 'Setting';
$lang['strparameters'] = 'Parameters';
- $lang['streditquery'] = 'Edit query';
+ $lang['streditsql'] = 'Edit SQL';
+ $lang['strpaginate'] = 'Paginate results';
$lang['strstarttime'] = 'Start Time';
// Error handling
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.83 2004/02/02 12:15:58 chriskl Exp $
+ * $Id: english.php,v 1.84 2004/02/13 08:53:05 chriskl Exp $
*/
// Language and character set
$lang['strexpand'] = 'Expand';
$lang['strcollapse'] = 'Collapse';
$lang['strexplain'] = 'Explain';
+ $lang['strexplainanalyze'] = 'Explain Analyze';
$lang['strfind'] = 'Find';
$lang['stroptions'] = 'Options';
$lang['strrefresh'] = 'Refresh';
$lang['strprocesses'] = 'Processes';
$lang['strsetting'] = 'Setting';
$lang['strparameters'] = 'Parameters';
- $lang['streditquery'] = 'Edit query';
+ $lang['streditsql'] = 'Edit SQL';
+ $lang['strpaginate'] = 'Paginate results';
$lang['strstarttime'] = 'Start Time';
// Error handling
* how many SQL statements have been strung together with semi-colons
* @param $query The SQL query string to execute
*
- * $Id: sql.php,v 1.14 2003/12/17 09:11:32 chriskl Exp $
+ * $Id: sql.php,v 1.15 2004/02/13 08:53:04 chriskl Exp $
*/
// Include application functions
include_once('./libraries/lib.inc.php');
+
+ // Check to see if pagination has been specified. In that case, send to display
+ // script for pagination
+ if (isset($_POST['paginate'])) {
+ $_REQUEST['return_url'] = "database.php?{$misc->href}&action=sql&paginate=on&query=" . urlencode($_POST['query']);
+ $_REQUEST['return_desc'] = $lang['streditsql'];
+ include('./display.php');
+ exit;
+ }
$PHP_SELF = $_SERVER['PHP_SELF'];
echo "<h2>", $misc->printVal($_REQUEST['database']), ": {$lang['strsql']}: {$lang['strqueryresults']}</h2>\n";
// NOTE: This is a quick hack!
+ // TODO: Is there a generic (non PostgreSQL specific) way to do this
if (isset($_POST['explain']) && isset($_POST['query'])) {
- // TODO: Is there a generic (non PostgreSQL specific) way to do this
$_POST['query'] = 'EXPLAIN ' . $_POST['query'];
}
+ elseif (isset($_POST['explain_analyze']) && isset($_POST['query'])) {
+ $_POST['query'] = 'EXPLAIN ANALYZE ' . $_POST['query'];
+ }
// Set fetch mode to NUM so that duplicate field names are properly returned
$data->conn->setFetchMode(ADODB_FETCH_NUM);
}
echo "<p><a class=\"navlink\" href=\"database.php?database=", urlencode($_REQUEST['database']),
- "&action=sql&query=", urlencode($_POST['query']), "\">{$lang['strback']}</a>";
+ "&action=sql&query=", urlencode($_POST['query']), "\">{$lang['streditsql']}</a>";
if ($conf['show_reports'] && isset($rs) && is_object($rs) && $rs->recordCount() > 0) {
echo " | <a class=\"navlink\" href=\"reports.php?action=create&db_name=", urlencode($_REQUEST['database']), "&report_sql=",
urlencode($_POST['query']), "\">{$lang['strcreatereport']}</a>";
/**
* Alternative SQL editing window
*
- * $Id: sqledit.php,v 1.10 2003/12/17 09:11:32 chriskl Exp $
+ * $Id: sqledit.php,v 1.11 2004/02/13 08:53:04 chriskl Exp $
*/
// Include application functions
echo $misc->form;
echo "<input type=\"hidden\" name=\"action\" value=\"find\" />\n";
echo "</form>\n";
+
+ // Default focus
+ $misc->setFocus('forms[0].term');
}
/**
echo "<textarea style=\"width: 100%\" rows=\"10\" cols=\"50\" name=\"query\">",
htmlspecialchars($_POST['query']), "</textarea>\n";
+ echo "<input type=\"checkbox\" name=\"paginate\"", (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''), " /> {$lang['strpaginate']}\n";
+ echo "<br />\n";
echo "<p><input type=\"submit\" value=\"{$lang['strgo']}\" />\n";
echo "<input type=\"submit\" name=\"explain\" value=\"{$lang['strexplain']}\" />\n";
+ echo "<input type=\"submit\" name=\"explain_analyze\" value=\"{$lang['strexplainanalyze']}\" />\n";
echo "<input type=\"reset\" value=\"{$lang['strreset']}\" /></p>\n";
echo $misc->form;
echo "</form>\n";
+
+ // Default focus
+ $misc->setFocus('forms[0].query');
}
$misc->printHeader($lang['strsql']);