support for execute without parameter list added

This commit is contained in:
Pedro 2015-01-06 19:20:52 +01:00
parent fed174a892
commit b5aba646d8
5 changed files with 27 additions and 3 deletions

View File

@ -6,7 +6,7 @@ test: FORCE
@make tests -C src/ >/dev/null || exit 1
@make grammar_test -C src/ >/dev/null || exit 1
@echo "Running tests:"
@./bin/grammar_test -f "test/valid_queries.sql"
@./bin/grammar_test -f "src/tests/valid_queries.sql"
@./bin/tests

View File

@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS students FROM TBL FILE 'test/students.tbl';
CREATE TABLE IF NOT EXISTS test_big FROM TBL FILE 'test/lin_xxs.tbl';
CREATE TABLE IF NOT EXISTS companies FROM TBL FILE 'test/tables/companies.tbl';
CREATE TABLE IF NOT EXISTS employees FROM TBL FILE 'test/tables/employees.tbl';
CREATE TABLE IF NOT EXISTS test (v1 INTEGER, v2 INTEGER, v3 INTEGER);
# SELECT
SELECT * FROM students WHERE grade <= 2.0;
# SUB-SELECT
@ -26,6 +27,20 @@ SELECT * FROM test;
CREATE TABLE IF NOT EXISTS test (v1 INTEGER, v2 INTEGER, v3 INTEGER);
INSERT INTO test VALUES (1, 12, 43);
SELECT * FROM test;
# PREPARE 1
PREPARE select_test: SELECT * FROM students WHERE grade = ?;
# EXECUTE 1
EXECUTE select_test(2.0);
# PREPARE 2
PREPARE insert_test:
INSERT INTO test VALUES (?, 0, 0);
INSERT INTO test VALUES (?, 0, 0);
INSERT INTO test VALUES (?, 0, 0);
INSERT INTO test VALUES (?, 0, 0);
INSERT INTO test VALUES (?, 0, 0);
SELECT * FROM test;
# EXECUTE 2
EXECUTE insert_test(1, 2, 3, 4, 5);
#! GROUP
SELECT AVG(grade) FROM (SELECT city, AVG(grade) FROM students GROUP BY city) t1
#! UNION (kills hyrise)

View File

@ -121,6 +121,9 @@ function updatePerformanceData(result) {
var tbody = $('#performanceDataTable tbody');
tbody.html('');
result.performanceData.sort(function(a, b) {
return a.startTime - b.startTime;
});
$.each(result.performanceData, function(i, data) {
var tr = $('<tr>');
tr.append(createElement('td', data.id))

View File

@ -267,7 +267,12 @@ prepare_statement:
;
execute_statement:
EXECUTE IDENTIFIER '(' literal_list ')' {
EXECUTE IDENTIFIER {
$$ = new ExecuteStatement();
$$->name = $2;
$$->parameters = NULL;
}
| EXECUTE IDENTIFIER '(' literal_list ')' {
$$ = new ExecuteStatement();
$$->name = $2;
$$->parameters = $4;

View File

@ -34,3 +34,4 @@ DROP TABLE students;
# PREPARE
PREPARE prep_inst: INSERT INTO test VALUES (?, ?, ?);
EXECUTE prep_inst(1, 2, 3);
EXECUTE prep;