Column-oriented GPU-accelerated Database Management System
CoGaDB
|
00001 #ifndef SQL_DRIVER_HPP 00002 #define SQL_DRIVER_HPP 00003 00004 #include "sql/server/sql_parsetree.hpp" 00005 #include "sql_parser.hpp" 00006 00007 #include <iostream> 00008 #include <string> 00009 #include <exception> 00010 00011 namespace CoGaDB { 00012 namespace SQL { 00013 00014 namespace Scanner { 00015 typedef void *buffer; 00016 00017 Parser::token_type lex(Parser::semantic_type *yylval_param, 00018 type yyscanner); 00019 } 00020 00021 class Driver { 00022 Scanner::buffer buffer; 00023 /* FIXME: should not be public */ 00024 public: 00025 std::istream *istream; 00026 private: 00027 Scanner::type scanner; 00028 00029 Parser parser; 00030 00031 ParseTree::SequencePtr result; 00032 00033 public: 00034 class ParseError : public std::exception { 00035 public: 00036 const char * 00037 what() const throw() 00038 { 00039 return "Error during parsing"; 00040 } 00041 }; 00042 00043 Driver(); 00044 ~Driver(); 00045 00046 ParseTree::SequencePtr parse(std::istream &is); 00047 ParseTree::SequencePtr parse(const std::string &src); 00048 00049 private: 00050 /* 00051 * defined in sql-scanner.lpp 00052 */ 00053 void init_scan(); 00054 00055 void set_input(std::istream &is); 00056 void set_input(const std::string &src); 00057 00058 void destroy_scan(); 00059 00060 void error(const std::string& m); 00061 00062 inline void 00063 unsupported(void) 00064 { 00065 error("Unsupported language construct"); 00066 } 00067 00068 /* 00069 * Friends 00070 */ 00071 friend Parser::token_type Scanner::lex(Parser::semantic_type *, 00072 Scanner::type); 00073 friend class Parser; 00074 }; 00075 00076 bool commandlineExec(const std::string &input); 00077 00078 } /* namespace SQL */ 00079 } /* namespace CoGaDB */ 00080 00081 #endif