diff --git a/application/controllers/SqlController.php b/application/controllers/SqlController.php
index f501fb3..06d34fb 100644
--- a/application/controllers/SqlController.php
+++ b/application/controllers/SqlController.php
@@ -393,15 +393,28 @@ class SqlController extends Zend_Controller_Action
$parser->parse();
if ($sqlObject->hasErrors()) {
$this->view->errorMessage = implode('
', $sqlObject->getErrors());
- }
- $statements = $parser->getParsedStatements();
- foreach ($statements as $statement) {
- //echo "
Extracted statement: ".$statement;
- try {
- $res = $this->_db->query($statement, Msd_Db::ARRAY_ASSOC);
- $this->view->resultset = $res;
- } catch (Exception $e) {
- $this->view->errorMessage = $e->getMessage();
+ } else {
+ $statements = $parser->getParsedStatements();
+ if (sizeof($statements) > 1) {
+ // we have more than one query to execute
+ foreach ($statements as $statement) {
+ try {
+ $this->_db->query($statement, Msd_Db::ARRAY_ASSOC);
+ } catch (Exception $e) {
+ $this->view->errorMessage = $e->getMessage();
+ }
+ }
+ $summary = $parser->getSummary();
+ $this->view->resultSummary = $summary;
+ } else {
+ // process one query
+ try {
+ $res = $this->_db->query($statements[0], Msd_Db::ARRAY_ASSOC);
+ print_r($res);
+ $this->view->resultset = $res;
+ } catch (Exception $e) {
+ $this->view->errorMessage = $e->getMessage();
+ }
}
}
}
diff --git a/application/views/scripts/sql/sqlbox/sqlbox.phtml b/application/views/scripts/sql/sqlbox/sqlbox.phtml
index 2313a00..6e1300e 100644
--- a/application/views/scripts/sql/sqlbox/sqlbox.phtml
+++ b/application/views/scripts/sql/sqlbox/sqlbox.phtml
@@ -50,7 +50,7 @@ function setShowTableQuery()
jQuery()->javascriptCaptureEnd();
-if (isset($this->resultset)) {
+if (isset($this->resultset) && is_array($this->resultset)) {
$res = $this->resultset;
if (count($res)>0) {
$fieldNames = array_keys($res[0]);
@@ -85,11 +85,42 @@ if (isset($this->resultset)) {
?>
' . $this->lang->L_NO_ENTRIES . '
lang->L_RESULT;?>: | +||
---|---|---|
# | +lang->L_QUERY_TYPE;?> | +lang->L_NR_OF_QUERIES;?> | +
numberFormat($i);?>. | ++ | numberFormat($count);?> | +
+ | lang->L_SUM_TOTAL;;?> | +numberFormat($totalQueries);?> | +