Formatting and more tests

This commit is contained in:
Moritz Eyssen 2017-10-12 19:18:38 +02:00
parent cf28f8fdaf
commit 0d0ba53546
4 changed files with 1122 additions and 1075 deletions

File diff suppressed because it is too large Load Diff

View File

@ -237,6 +237,7 @@ union HSQL_STYPE
hsql::ExecuteStatement* exec_stmt; hsql::ExecuteStatement* exec_stmt;
hsql::ShowStatement* show_stmt; hsql::ShowStatement* show_stmt;
hsql::TableName table_name;
hsql::TableRef* table; hsql::TableRef* table;
hsql::Expr* expr; hsql::Expr* expr;
hsql::OrderDescription* order; hsql::OrderDescription* order;
@ -255,7 +256,7 @@ union HSQL_STYPE
std::vector<hsql::Expr*>* expr_vec; std::vector<hsql::Expr*>* expr_vec;
std::vector<hsql::OrderDescription*>* order_vec; std::vector<hsql::OrderDescription*>* order_vec;
#line 259 "bison_parser.h" /* yacc.c:1909 */ #line 260 "bison_parser.h" /* yacc.c:1909 */
}; };
typedef union HSQL_STYPE HSQL_STYPE; typedef union HSQL_STYPE HSQL_STYPE;

View File

@ -186,7 +186,7 @@ int yyerror(YYLTYPE* llocp, SQLParserResult* result, yyscan_t scanner, const cha
%type <update_stmt> update_statement %type <update_stmt> update_statement
%type <drop_stmt> drop_statement %type <drop_stmt> drop_statement
%type <show_stmt> show_statement %type <show_stmt> show_statement
%type <table_name> table_name %type <table_name> table_name
%type <sval> opt_alias alias file_path prepare_target_query %type <sval> opt_alias alias file_path prepare_target_query
%type <bval> opt_not_exists opt_exists opt_distinct %type <bval> opt_not_exists opt_exists opt_distinct
%type <uval> import_file_type opt_join_type column_type %type <uval> import_file_type opt_join_type column_type

View File

@ -3,6 +3,7 @@
# SELECT statement # SELECT statement
SELECT * FROM orders; SELECT * FROM orders;
SELECT a FROM foo WHERE a > 12 OR b > 3 AND NOT c LIMIT 10 SELECT a FROM foo WHERE a > 12 OR b > 3 AND NOT c LIMIT 10
SELECT a FROM some_schema.foo WHERE a > 12 OR b > 3 AND NOT c LIMIT 10
SELECT col1 AS myname, col2, 'test' FROM "table", foo AS t WHERE age > 12 AND zipcode = 12345 GROUP BY col1; SELECT col1 AS myname, col2, 'test' FROM "table", foo AS t WHERE age > 12 AND zipcode = 12345 GROUP BY col1;
SELECT * from "table" JOIN table2 ON a = b WHERE (b OR NOT a) AND a = 12.5 SELECT * from "table" JOIN table2 ON a = b WHERE (b OR NOT a) AND a = 12.5
(SELECT a FROM foo WHERE a > 12 OR b > 3 AND c NOT LIKE 's%' LIMIT 10); (SELECT a FROM foo WHERE a > 12 OR b > 3 AND c NOT LIKE 's%' LIMIT 10);
@ -29,6 +30,7 @@ CREATE TABLE "table" FROM TBL FILE 'students.tbl'; SELECT * FROM "table";
INSERT INTO test_table VALUES (1, 2, 'test'); INSERT INTO test_table VALUES (1, 2, 'test');
INSERT INTO test_table (id, value, name) VALUES (1, 2, 'test'); INSERT INTO test_table (id, value, name) VALUES (1, 2, 'test');
INSERT INTO test_table SELECT * FROM students; INSERT INTO test_table SELECT * FROM students;
INSERT INTO some_schema.test_table SELECT * FROM another_schema.students;
# DELETE # DELETE
DELETE FROM students WHERE grade > 3.0 DELETE FROM students WHERE grade > 3.0
DELETE FROM students DELETE FROM students
@ -37,6 +39,7 @@ TRUNCATE students
UPDATE students SET grade = 1.3 WHERE name = 'Max Mustermann'; UPDATE students SET grade = 1.3 WHERE name = 'Max Mustermann';
UPDATE students SET grade = 1.3, name='Felix Fürstenberg' WHERE name = 'Max Mustermann'; UPDATE students SET grade = 1.3, name='Felix Fürstenberg' WHERE name = 'Max Mustermann';
UPDATE students SET grade = 1.0; UPDATE students SET grade = 1.0;
UPDATE some_schema.students SET grade = 1.0;
# DROP # DROP
DROP TABLE students; DROP TABLE students;
DROP TABLE IF EXISTS students; DROP TABLE IF EXISTS students;