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
|
sql: query
|
||||||
},
|
},
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
|
if (typeof result.real_size === "undefined") {
|
||||||
|
result.real_size = 0;
|
||||||
|
result.rows = [];
|
||||||
|
result.header = [];
|
||||||
|
}
|
||||||
callback(result);
|
callback(result);
|
||||||
},
|
},
|
||||||
error: error_callback
|
error: error_callback
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
|
|
||||||
<!-- Sample Queries -->
|
<!-- Sample Queries -->
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<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>
|
</div>
|
||||||
|
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
<!-- Submit -->
|
<!-- Submit -->
|
||||||
<div class="row" style="margin: 10px 0px;">
|
<div class="row" style="margin: 10px 0px;">
|
||||||
<div class="col-sm-12">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -74,10 +75,15 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
function addSampleQuery(name, query) {
|
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); });
|
btn.click(function() { $('#queryInput').val(query); });
|
||||||
$('#sampleQueries').append(btn);
|
$('#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) {
|
function createElement(tag, value) {
|
||||||
return $('<' + tag + '>' + value + '</' + tag + '>');
|
return $('<' + tag + '>' + value + '</' + tag + '>');
|
||||||
|
@ -158,11 +164,17 @@ $(function() {
|
||||||
return true;
|
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('Load Tables', '\
|
||||||
addSampleQuery('SELECT', 'SELECT name, city, grade FROM (SELECT * FROM students WHERE city = \'Potsdam\') t1 WHERE grade <= 1.5 OR grade >= 3.5;');
|
CREATE TABLE students FROM TBL FILE \'test/students.tbl\';\n\
|
||||||
addSampleQuery('GROUP', 'SELECT AVG(grade) FROM students GROUP BY city');
|
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('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>
|
</script>
|
||||||
|
|
|
@ -13,6 +13,11 @@ div {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-left: 1px;
|
||||||
|
margin-right: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#resultTable td {
|
#resultTable td {
|
||||||
border: 1px solid #333;
|
border: 1px solid #333;
|
||||||
|
|
|
@ -56,9 +56,9 @@ struct SelectStatement : Statement {
|
||||||
select_list(NULL),
|
select_list(NULL),
|
||||||
where_clause(NULL),
|
where_clause(NULL),
|
||||||
group_by(NULL),
|
group_by(NULL),
|
||||||
|
union_select(NULL),
|
||||||
order(NULL),
|
order(NULL),
|
||||||
limit(NULL),
|
limit(NULL) {};
|
||||||
union_select(NULL) {};
|
|
||||||
|
|
||||||
virtual ~SelectStatement(); // defined in destructors.cpp
|
virtual ~SelectStatement(); // defined in destructors.cpp
|
||||||
|
|
||||||
|
|
|
@ -244,6 +244,7 @@ select_no_paren:
|
||||||
| select_ref UNION select_ref opt_order opt_limit {
|
| select_ref UNION select_ref opt_order opt_limit {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->union_select = $3;
|
$$->union_select = $3;
|
||||||
|
// TODO: might overwrite order and limit of first select here
|
||||||
$$->order = $4;
|
$$->order = $4;
|
||||||
$$->limit = $5;
|
$$->limit = $5;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue