InfiniSQL
v0.1.2-alpha
Massive Scale Transaction Processing
|
create object to tokenize, parse, and compile SQL statement More...
#include <Larxer.h>
Classes | |
struct | stackmember_s |
data populatng pre- Ast stack. SQL token and associated value. More... | |
Public Member Functions | |
Larxer (char *instr, class TransactionAgent *taPtr, class Schema *schemaPtr) | |
tokenize, parse, and compile SQL statement More... | |
virtual | ~Larxer () |
void | pushstack (stacktypes_e type) |
put item on stack More... | |
void | pushstack (stacktypes_e type, int64_t val) |
put item on stack More... | |
void | pushstack (stacktypes_e type, long double val) |
put item on stack More... | |
void | pushstack (stacktypes_e type, const char *val) |
put item on stack More... | |
void | pushstack (stacktypes_e type, string &val) |
put item on stack More... | |
void | pushoperand (char operandtype) |
push operand onto stack More... | |
void | pushoperand (char operandtype, int64_t val) |
push operand onto stack More... | |
void | pushoperand (char operandtype, long double val) |
push operand onto stack More... | |
void | pushoperand (char operandtype, const char *val) |
push operand onto stack More... | |
void | pushaggregate (char aggregatetype, const char *val) |
push aggregate and associated field onto stack More... | |
stackmember_s | popstack () |
take item off stack More... | |
int64_t | getintval (string &val) |
convert string to integer More... | |
long double | getfloatval (string &val) |
convert string to float More... | |
void | eatstack (class TransactionAgent *taPtr, class Schema *schemaPtr) |
consume entire stack More... | |
void | printstack () |
show stack entries, for debugging More... | |
void | consumeSelect (string &columns) |
extract SELECT query from stack More... | |
void | consumeInsert () |
extract INSERT query from stack More... | |
void | consumeUpdate () |
extract UPDATE query from stack More... | |
void | consumeDelete () |
extract DELETE query from stack More... | |
void | consumeStoredProcedure () |
extract stored procedure call query from stack More... | |
class Ast * | consumeExpression () |
extract expression from stack More... | |
int64_t | consumeSubquery () |
extract subquery from stack More... | |
void | consumeInobject () |
extract list of IN values from stack More... | |
void | consumeColumns (int64_t numcolumns) |
extract columns from stack More... | |
void | consumeFrom () |
extract FROM clause from stack More... | |
void | consumeWhere () |
extract WHERE clause from stack More... | |
void | consumeGroupby () |
extract GROUP BY clause from stack More... | |
void | consumeHaving () |
extract HAVING clause from stack More... | |
void | consumeOrderby () |
extract ORDER BY clause from stack More... | |
Public Attributes | |
std::stack< stackmember_s > | parsedStack |
class Statement::query_s * | currentQuery |
class Statement * | statementPtr |
create object to tokenize, parse, and compile SQL statement
many of these functions are called by the lexer.ll and parser.yy generated code
instr | SQL query |
taPtr | TransactionAgent |
schemaPtr | Schema |
enum Larxer::stacktypes_e |
SQL tokens for pre- Ast stack.
Definition at line 56 of file Larxer.h.
Larxer::Larxer | ( | char * | instr, |
class TransactionAgent * | taPtr, | ||
class Schema * | schemaPtr | ||
) |
tokenize, parse, and compile SQL statement
many of these functions are called by the lexer.ll and parser.yy generated code
instr | SQL statement |
taPtr | TransactionAgent |
schemaPtr | Schema |
Definition at line 34 of file Larxer.cc.
References eatstack(), flexbuffer(), flexdestroy(), flexinit(), perlarxer::larxerPtr, parsedStack, perlarxer::scaninfo, statementPtr, and yyparse().
void Larxer::consumeColumns | ( | int64_t | numcolumns) |
extract columns from stack
numcolumns | number of columns |
Definition at line 699 of file Larxer.cc.
References currentQuery, Statement::query_s::fromColumns, parsedStack, popstack(), Larxer::stackmember_s::type, TYPE_ASTERISK, TYPE_operand, and Larxer::stackmember_s::val.
Referenced by consumeSelect().
void Larxer::consumeDelete | ( | ) |
extract DELETE query from stack
Definition at line 678 of file Larxer.cc.
References CMD_DELETE, consumeFrom(), consumeWhere(), currentQuery, Statement::query_s::locktype, parsedStack, popstack(), Larxer::stackmember_s::type, Statement::query_s::type, TYPE_WHERE, and WRITELOCK.
Referenced by eatstack().
class Ast * Larxer::consumeExpression | ( | ) |
extract expression from stack
create Ast, return its root node
Definition at line 206 of file Larxer.cc.
References consumeInobject(), consumeSubquery(), Ast::leftchild, Ast::operand, OPERAND_SUBQUERY, Ast::parent, parsedStack, popstack(), Ast::rightchild, Larxer::stackmember_s::type, TYPE_EXPRESSION, TYPE_inbegin, TYPE_inobject, TYPE_operand, and TYPE_operator.
Referenced by consumeHaving(), consumeInobject(), consumeInsert(), consumeUpdate(), and consumeWhere().
void Larxer::consumeFrom | ( | ) |
extract FROM clause from stack
Definition at line 727 of file Larxer.cc.
References currentQuery, parsedStack, popstack(), Statement::query_s::table, Larxer::stackmember_s::type, TYPE_operand, and Larxer::stackmember_s::val.
Referenced by consumeDelete(), consumeInsert(), consumeSelect(), and consumeUpdate().
void Larxer::consumeGroupby | ( | ) |
extract GROUP BY clause from stack
Definition at line 771 of file Larxer.cc.
References currentQuery, Statement::query_s::groupByList, Statement::query_s::hasgroupby, OPERAND_IDENTIFIER, parsedStack, popstack(), Larxer::stackmember_s::type, TYPE_operand, and Larxer::stackmember_s::val.
Referenced by consumeSelect().
void Larxer::consumeHaving | ( | ) |
extract HAVING clause from stack
Definition at line 800 of file Larxer.cc.
References consumeExpression(), currentQuery, Statement::query_s::hashaving, parsedStack, popstack(), Statement::query_s::searchCondition, Larxer::stackmember_s::type, and TYPE_search_condition.
Referenced by consumeSelect().
void Larxer::consumeInobject | ( | ) |
extract list of IN values from stack
Definition at line 352 of file Larxer.cc.
References consumeExpression(), consumeSubquery(), currentQuery, Statement::inobject_s::expressionlist, Statement::query_s::inobject, Statement::inobject_s::issubquery, parsedStack, Statement::inobject_s::subquery, TYPE_EXPRESSION, and TYPE_SUBQUERY.
Referenced by consumeExpression().
void Larxer::consumeInsert | ( | ) |
extract INSERT query from stack
Definition at line 627 of file Larxer.cc.
References CMD_INSERT, consumeExpression(), consumeFrom(), currentQuery, Statement::query_s::insertColumns, Statement::query_s::locktype, parsedStack, popstack(), Larxer::stackmember_s::type, Statement::query_s::type, TYPE_EXPRESSION, and WRITELOCK.
Referenced by eatstack().
void Larxer::consumeOrderby | ( | ) |
extract ORDER BY clause from stack
Definition at line 823 of file Larxer.cc.
References currentQuery, Statement::query_s::hasorderby, Statement::query_s::orderbylist, parsedStack, popstack(), Larxer::stackmember_s::type, TYPE_ASC, TYPE_SORTSPECIFICATION, and Larxer::stackmember_s::val.
Referenced by consumeSelect().
void Larxer::consumeSelect | ( | string & | columns) |
extract SELECT query from stack
columns | quantity of columns |
Definition at line 565 of file Larxer.cc.
References CMD_SELECT, consumeColumns(), consumeFrom(), consumeGroupby(), consumeHaving(), consumeOrderby(), consumeWhere(), currentQuery, getintval(), Statement::query_s::hasnolock, Statement::query_s::isforupdate, Statement::query_s::locktype, NOLOCK, parsedStack, popstack(), READLOCK, Larxer::stackmember_s::type, Statement::query_s::type, TYPE_COLUMNS, TYPE_FORUPDATE, TYPE_FROM, TYPE_GROUPBY, TYPE_HAVING, TYPE_NOLOCK, TYPE_ORDERBY, TYPE_WHERE, and WRITELOCK.
Referenced by consumeSubquery(), and eatstack().
void Larxer::consumeStoredProcedure | ( | ) |
extract stored procedure call query from stack
Definition at line 851 of file Larxer.cc.
References CMD_STOREDPROCEDURE, currentQuery, parsedStack, popstack(), Statement::query_s::storedProcedure, Statement::query_s::storedProcedureArgs, Statement::query_s::type, and Larxer::stackmember_s::val.
Referenced by eatstack().
int64_t Larxer::consumeSubquery | ( | ) |
extract subquery from stack
Definition at line 330 of file Larxer.cc.
References consumeSelect(), currentQuery, Statement::query_s::instance, popstack(), Statement::queries, statementPtr, Larxer::stackmember_s::type, TYPE_SELECT, and Larxer::stackmember_s::val.
Referenced by consumeExpression(), and consumeInobject().
void Larxer::consumeUpdate | ( | ) |
extract UPDATE query from stack
Definition at line 648 of file Larxer.cc.
References Statement::query_s::assignments, CMD_UPDATE, consumeExpression(), consumeFrom(), consumeWhere(), currentQuery, Statement::query_s::locktype, parsedStack, popstack(), Larxer::stackmember_s::type, Statement::query_s::type, TYPE_assignment, TYPE_WHERE, Larxer::stackmember_s::val, and WRITELOCK.
Referenced by eatstack().
void Larxer::consumeWhere | ( | ) |
extract WHERE clause from stack
Definition at line 748 of file Larxer.cc.
References consumeExpression(), currentQuery, Statement::query_s::haswhere, parsedStack, popstack(), Statement::query_s::searchCondition, Larxer::stackmember_s::type, and TYPE_search_condition.
Referenced by consumeDelete(), consumeSelect(), and consumeUpdate().
void Larxer::eatstack | ( | class TransactionAgent * | taPtr, |
class Schema * | schemaPtr | ||
) |
consume entire stack
taPtr | TransactionAgent |
schemaPtr | Schema |
Definition at line 154 of file Larxer.cc.
References CMD_BEGIN, CMD_COMMIT, CMD_ROLLBACK, consumeDelete(), consumeInsert(), consumeSelect(), consumeStoredProcedure(), consumeUpdate(), currentQuery, Statement::query_s::instance, parsedStack, popstack(), Statement::queries, statementPtr, Larxer::stackmember_s::type, Statement::query_s::type, TYPE_BEGIN, TYPE_COMMIT, TYPE_DELETE, TYPE_INSERT, TYPE_ROLLBACK, TYPE_SELECT, TYPE_storedprocedure, TYPE_UPDATE, and Larxer::stackmember_s::val.
Referenced by Larxer().
long double Larxer::getfloatval | ( | string & | val) |
int64_t Larxer::getintval | ( | string & | val) |
convert string to integer
val | string input |
Definition at line 140 of file Larxer.cc.
Referenced by consumeSelect().
Larxer::stackmember_s Larxer::popstack | ( | ) |
take item off stack
Definition at line 133 of file Larxer.cc.
References parsedStack.
Referenced by consumeColumns(), consumeDelete(), consumeExpression(), consumeFrom(), consumeGroupby(), consumeHaving(), consumeInsert(), consumeOrderby(), consumeSelect(), consumeStoredProcedure(), consumeSubquery(), consumeUpdate(), consumeWhere(), and eatstack().
void Larxer::printstack | ( | ) |
show stack entries, for debugging
Definition at line 373 of file Larxer.cc.
References OPERAND_BOOLEAN, OPERAND_FLOAT, OPERAND_IDENTIFIER, OPERAND_INTEGER, OPERAND_PARAMETER, OPERAND_STRING, OPERAND_SUBQUERY, OPERATOR_ADDITION, OPERATOR_AND, OPERATOR_BETWEEN, OPERATOR_BETWEENAND, OPERATOR_CONCATENATION, OPERATOR_DIVISION, OPERATOR_EQ, OPERATOR_EXISTS, OPERATOR_FALSE, OPERATOR_GT, OPERATOR_GTE, OPERATOR_IN, OPERATOR_ISNULL, OPERATOR_LIKE, OPERATOR_LT, OPERATOR_LTE, OPERATOR_MULTIPLICATION, OPERATOR_NE, OPERATOR_NEGATION, OPERATOR_NONE, OPERATOR_NOT, OPERATOR_OR, OPERATOR_SUBTRACTION, OPERATOR_TRUE, OPERATOR_UNIQUE, OPERATOR_UNKNOWN, parsedStack, TYPE_operand, and TYPE_operator.
void Larxer::pushaggregate | ( | char | aggregatetype, |
const char * | val | ||
) |
push aggregate and associated field onto stack
aggregatetype | type of aggregate |
val | associated field |
Definition at line 124 of file Larxer.cc.
References OPERAND_AGGREGATE, pushstack(), and TYPE_operand.
void Larxer::pushoperand | ( | char | operandtype) |
push operand onto stack
operandtype | type of operand |
Definition at line 94 of file Larxer.cc.
References pushstack(), and TYPE_operand.
void Larxer::pushoperand | ( | char | operandtype, |
int64_t | val | ||
) |
push operand onto stack
operandtype | type of operand |
val | associated value |
Definition at line 100 of file Larxer.cc.
References pushstack(), and TYPE_operand.
void Larxer::pushoperand | ( | char | operandtype, |
long double | val | ||
) |
push operand onto stack
operandtype | type of operand |
val | associated value |
Definition at line 108 of file Larxer.cc.
References pushstack(), and TYPE_operand.
void Larxer::pushoperand | ( | char | operandtype, |
const char * | val | ||
) |
push operand onto stack
operandtype | type of operand |
val | associated value |
Definition at line 116 of file Larxer.cc.
References pushstack(), and TYPE_operand.
void Larxer::pushstack | ( | stacktypes_e | type) |
put item on stack
stack is intermediary between parsing and Statement object
type | stack entry |
Definition at line 63 of file Larxer.cc.
References parsedStack.
Referenced by pushaggregate(), and pushoperand().
void Larxer::pushstack | ( | stacktypes_e | type, |
int64_t | val | ||
) |
put item on stack
stack is intermediary between parsing and Statement object
type | stack entry |
val | value associated with entry |
Definition at line 69 of file Larxer.cc.
References parsedStack.
void Larxer::pushstack | ( | stacktypes_e | type, |
long double | val | ||
) |
put item on stack
stack is intermediary between parsing and Statement object
type | stack entry |
val | value associated with entry |
Definition at line 76 of file Larxer.cc.
References parsedStack.
void Larxer::pushstack | ( | stacktypes_e | type, |
const char * | val | ||
) |
put item on stack
stack is intermediary between parsing and Statement object
type | stack entry |
val | value associated with entry |
Definition at line 84 of file Larxer.cc.
References parsedStack.
void Larxer::pushstack | ( | stacktypes_e | type, |
string & | val | ||
) |
put item on stack
stack is intermediary between parsing and Statement object
type | stack entry |
val | value associated with entry |
Definition at line 89 of file Larxer.cc.
References parsedStack.
class Statement::query_s* Larxer::currentQuery |
Definition at line 345 of file Larxer.h.
Referenced by consumeColumns(), consumeDelete(), consumeFrom(), consumeGroupby(), consumeHaving(), consumeInobject(), consumeInsert(), consumeOrderby(), consumeSelect(), consumeStoredProcedure(), consumeSubquery(), consumeUpdate(), consumeWhere(), and eatstack().
std::stack<stackmember_s> Larxer::parsedStack |
Definition at line 344 of file Larxer.h.
Referenced by consumeColumns(), consumeDelete(), consumeExpression(), consumeFrom(), consumeGroupby(), consumeHaving(), consumeInobject(), consumeInsert(), consumeOrderby(), consumeSelect(), consumeStoredProcedure(), consumeUpdate(), consumeWhere(), eatstack(), Larxer(), popstack(), printstack(), and pushstack().
class Statement* Larxer::statementPtr |
Definition at line 346 of file Larxer.h.
Referenced by TransactionAgent::compile(), consumeSubquery(), Pg::cont(), eatstack(), Pg::executeStatement(), Larxer(), and TransactionAgent::newstatement().