From b5aba646d86a7bf22ee64d7aa84b61d186ea5c6c Mon Sep 17 00:00:00 2001 From: Pedro Date: Tue, 6 Jan 2015 19:20:52 +0100 Subject: [PATCH] support for execute without parameter list added --- Makefile | 2 +- frontend-hyrise/sample-queries.sql | 15 +++++++++++++++ frontend-hyrise/ui.js | 3 +++ src/parser/bison_parser.y | 7 ++++++- {test => src/tests}/valid_queries.sql | 3 ++- 5 files changed, 27 insertions(+), 3 deletions(-) rename {test => src/tests}/valid_queries.sql (97%) diff --git a/Makefile b/Makefile index c3492b5..4f1f177 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/frontend-hyrise/sample-queries.sql b/frontend-hyrise/sample-queries.sql index 9b1184f..1ee10d2 100644 --- a/frontend-hyrise/sample-queries.sql +++ b/frontend-hyrise/sample-queries.sql @@ -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) diff --git a/frontend-hyrise/ui.js b/frontend-hyrise/ui.js index ea9d65a..ae1ed46 100644 --- a/frontend-hyrise/ui.js +++ b/frontend-hyrise/ui.js @@ -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.append(createElement('td', data.id)) diff --git a/src/parser/bison_parser.y b/src/parser/bison_parser.y index ae5d6d0..2b5261b 100644 --- a/src/parser/bison_parser.y +++ b/src/parser/bison_parser.y @@ -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; diff --git a/test/valid_queries.sql b/src/tests/valid_queries.sql similarity index 97% rename from test/valid_queries.sql rename to src/tests/valid_queries.sql index 2ffbacd..fde3ab3 100644 --- a/test/valid_queries.sql +++ b/src/tests/valid_queries.sql @@ -33,4 +33,5 @@ UPDATE students SET grade = 1.0; DROP TABLE students; # PREPARE PREPARE prep_inst: INSERT INTO test VALUES (?, ?, ?); -EXECUTE prep_inst(1, 2, 3); \ No newline at end of file +EXECUTE prep_inst(1, 2, 3); +EXECUTE prep; \ No newline at end of file