minor changes
This commit is contained in:
parent
dfbc50ed27
commit
f983757018
|
@ -28,6 +28,11 @@ HyriseSqlConnector.prototype.executeQuery = function(query, callback, error_call
|
|||
sql: query
|
||||
},
|
||||
success: function(result) {
|
||||
if (typeof result.real_size === "undefined") {
|
||||
result.real_size = 0;
|
||||
result.rows = [];
|
||||
result.header = [];
|
||||
}
|
||||
callback(result);
|
||||
},
|
||||
error: error_callback
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
<!-- Sample Queries -->
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-sm-12" id="sampleQueries"></div>
|
||||
<div class="col-sm-8" id="sampleQueries"></div>
|
||||
<div class="col-sm-4" id="buggyQueries"></div>
|
||||
</div>
|
||||
|
||||
<!-- Input -->
|
||||
|
@ -36,7 +37,7 @@
|
|||
<!-- Submit -->
|
||||
<div class="row" style="margin: 10px 0px;">
|
||||
<div class="col-sm-12">
|
||||
<button type="button" class="btn btn-primary" id="submitBtn">Submit Query</button>
|
||||
<button type="button" class="btn btn-primary" id="submitBtn">Submit Query (Shift + Enter)</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -74,10 +75,15 @@
|
|||
<script type="text/javascript">
|
||||
$(function() {
|
||||
function addSampleQuery(name, query) {
|
||||
var btn = $('<button type="button" class="btn btn-default">' + name + '</button>');
|
||||
var btn = $('<button type="button" class="btn btn-success">' + name + '</button>');
|
||||
btn.click(function() { $('#queryInput').val(query); });
|
||||
$('#sampleQueries').append(btn);
|
||||
}
|
||||
function addBuggyQuery(name, query) {
|
||||
var btn = $('<button type="button" class="btn btn-danger">' + name + '</button>');
|
||||
btn.click(function() { $('#queryInput').val(query); });
|
||||
$('#buggyQueries').append(btn);
|
||||
}
|
||||
|
||||
function createElement(tag, value) {
|
||||
return $('<' + tag + '>' + value + '</' + tag + '>');
|
||||
|
@ -158,11 +164,17 @@ $(function() {
|
|||
return true;
|
||||
});
|
||||
|
||||
addSampleQuery('CREATE & SELECT', 'CREATE TABLE students FROM TBL FILE \'test/students.tbl\';\nSELECT name, city, grade FROM students WHERE grade <= 2.0;')
|
||||
addSampleQuery('SELECT', 'SELECT name, city, grade FROM (SELECT * FROM students WHERE city = \'Potsdam\') t1 WHERE grade <= 1.5 OR grade >= 3.5;');
|
||||
addSampleQuery('GROUP', 'SELECT AVG(grade) FROM students GROUP BY city');
|
||||
addSampleQuery('Load Tables', '\
|
||||
CREATE TABLE students FROM TBL FILE \'test/students.tbl\';\n\
|
||||
CREATE TABLE test FROM TBL FILE \'test/lin_xxs.tbl\';');
|
||||
|
||||
addSampleQuery('SELECT 1', 'SELECT * FROM students;')
|
||||
addSampleQuery('SELECT 2', 'SELECT name, city, grade FROM (SELECT * FROM students WHERE city = \'Potsdam\') t1 WHERE grade <= 1.5 OR grade >= 3.5;');
|
||||
addSampleQuery('GROUP', 'SELECT city, AVG(grade) AS average|, MIN(grade) AS best, MAX(grade) AS worst FROM students GROUP BY city;');
|
||||
addSampleQuery('UNION', 'SELECT * FROM students WHERE grade = 1.3 UNION SELECT * FROM students WHERE grade = 3.7;');
|
||||
addSampleQuery('JOIN', 'SELECT * FROM students t1 JOIN students t2 ON t1.student_number = t2.student_number');
|
||||
addSampleQuery('GROUP ERROR', 'SELECT AVG(grade) FROM (SELECT city, AVG(grade) FROM students GROUP BY city) t1');
|
||||
addBuggyQuery('GROUP', 'SELECT AVG(grade) FROM (SELECT city, AVG(grade) FROM students GROUP BY city) t1');
|
||||
addBuggyQuery('UNION', 'SELECT name FROM students WHERE grade > 2.0 UNION SELECT name FROM students');
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -13,6 +13,11 @@ div {
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-left: 1px;
|
||||
margin-right: 1px;
|
||||
}
|
||||
|
||||
/*
|
||||
#resultTable td {
|
||||
border: 1px solid #333;
|
||||
|
|
|
@ -56,9 +56,9 @@ struct SelectStatement : Statement {
|
|||
select_list(NULL),
|
||||
where_clause(NULL),
|
||||
group_by(NULL),
|
||||
union_select(NULL),
|
||||
order(NULL),
|
||||
limit(NULL),
|
||||
union_select(NULL) {};
|
||||
limit(NULL) {};
|
||||
|
||||
virtual ~SelectStatement(); // defined in destructors.cpp
|
||||
|
||||
|
|
|
@ -244,6 +244,7 @@ select_no_paren:
|
|||
| select_ref UNION select_ref opt_order opt_limit {
|
||||
$$ = $1;
|
||||
$$->union_select = $3;
|
||||
// TODO: might overwrite order and limit of first select here
|
||||
$$->order = $4;
|
||||
$$->limit = $5;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue