示例#1
0
void Parser::delete_stmt(){
    match("DELETE");
    match("FROM");
    match("ID");
    where_clause();
    match(";");
}
示例#2
0
void Parser::query_stmt() {
    match("SELECT");
    select_list();
    match("FROM");
    match("ID");
    where_clause();
    match(";");
}
示例#3
0
 const Delete &delete_stmt() {
     if (lookahead == DELETE) {
         // delete_stmt -> DELETE FROM id where_clause SEMICOLON
         match(DELETE); match(FROM);
         string table_id = id();
         Expr where = where_clause();
         match(SEMICOLON);
         return Delete(table_id, where);
     } else {
         throw ParseError("Syntax error");
     }
 }
示例#4
0
 const Query &query_stmt() {
     if (lookahead == SELECT) {
         // query_stmt -> SELECT select_list FROM id where_clause SEMICOLON
         vector<string> columns;
         match(SELECT); select_list(columns); match(FROM);
         string table_id = id();
         Expr where = where_clause();
         match(SEMICOLON);
         return Query(table_id, columns, where);
     } else {
         throw ParseError("Syntax error");
     }
 }
示例#5
0
 where_clause &select_query::where(const string &value)
 {
     where_ = where_clause(value);
     return where_;
 }