InfiniSQL
v0.1.2-alpha
Massive Scale Transaction Processing
|
Abstract Syntax Tree. More...
#include <Asts.h>
Public Member Functions | |
Ast () | |
Ast (class Ast *parentarg, operatortypes_e operatortypearg) | |
create abstract syntax tree object More... | |
Ast (class Ast *parentarg, std::string &operandarg) | |
create abstract syntax tree object More... | |
Ast (const Ast &orig) | |
Ast & | operator= (const Ast &orig) |
void | cp (const Ast &orig) |
deep copy of Ast More... | |
virtual | ~Ast () |
bool | evaluate (class Ast **nextAstNode, class Statement *statementPtr) |
void | evaluateAssignment (std::vector< fieldValue_s > &fieldValues, class Statement *statementPtr) |
void | normalizeSetAssignmentOperand (vector< fieldValue_s > &fieldValues, class Statement *statementPtr) |
convert More... | |
Static Public Member Functions | |
static void | toFloat (const string &inoperand, fieldValue_s &outField) |
static void | toFloat (const string &inoperand, string &outoperand) |
Public Attributes | |
class Ast * | parent |
class Ast * | rightchild |
class Ast * | leftchild |
bool | isoperator |
operatortypes_e | operatortype |
std::string | operand |
boost::unordered_map < uuRecord_s, returnRow_s > | predicateResults |
Ast::Ast | ( | class Ast * | parentarg, |
operatortypes_e | operatortypearg | ||
) |
create abstract syntax tree object
parentarg | parent Ast (NULL if root) |
operatortypearg | operator type |
Definition at line 39 of file Asts.cc.
References leftchild, OPERATOR_EXISTS, OPERATOR_FALSE, OPERATOR_IN, OPERATOR_ISNOTNULL, OPERATOR_ISNULL, OPERATOR_NEGATION, OPERATOR_NOT, OPERATOR_NOTIN, OPERATOR_TRUE, OPERATOR_UNIQUE, OPERATOR_UNKNOWN, and operatortype.
Ast::Ast | ( | class Ast * | parentarg, |
std::string & | operandarg | ||
) |
Ast::Ast | ( | const Ast & | orig) |
|
virtual |
void Ast::cp | ( | const Ast & | orig) |
deep copy of Ast
orig | source Ast |
Definition at line 74 of file Asts.cc.
References isoperator, leftchild, operand, operatortype, parent, predicateResults, and rightchild.
Referenced by Ast(), and operator=().
evaluate Ast as part of continuation. returns the next Ast node to evaluate in 1st param, or NULL if finished. if both children (left only for unary operator) are not operators then return false so caller resolves it. Evaluate each child, convert self to resulting operand, return true
nextAstNode | next Ast node to evaluate by subsequent call |
statementPtr | current Ast node to evaluate |
Definition at line 122 of file Asts.cc.
References Statement::andPredicate(), BOOL, fieldInput_u::boolean, CHAR, fieldInput_u::character, CHARX, Statement::currentQuery, Statement::inobject_s::expressionlist, FLOAT, Statement::query_s::inobject, INT, fieldInput_u::integer, Statement::results_s::inValues, fieldValue_s::isnull, isoperator, rowOrField_s::isrow, Statement::inobject_s::issubquery, leftchild, Statement::query_s::locktype, operand, OPERAND_FLOAT, OPERAND_INTEGER, OPERAND_NULL, 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_ISNOTNULL, OPERATOR_ISNULL, OPERATOR_LIKE, OPERATOR_LT, OPERATOR_LTE, OPERATOR_MULTIPLICATION, OPERATOR_NE, OPERATOR_NEGATION, OPERATOR_NOT, OPERATOR_NOTBETWEEN, OPERATOR_NOTIN, OPERATOR_NOTLIKE, OPERATOR_OR, OPERATOR_SUBTRACTION, OPERATOR_TRUE, OPERATOR_UNIQUE, OPERATOR_UNKNOWN, operatortype, Statement::parameters, parent, PAYLOADCOMMITROLLBACK, predicateResults, Statement::query_s::results, rightchild, MessageCommitRollback::rofs, ROLLBACKCMD, rowOrField_s::rowid, Statement::schemaPtr, Statement::searchExpression(), Transaction::sendTransaction(), Transaction::sqlPredicate(), Statement::stagedPredicate(), Transaction::stagedRows, fieldValue_s::str, Statement::subqueryExists(), Statement::subqueryIn(), Statement::subqueryScalar(), Statement::subqueryUnique(), Statement::query_s::tableid, rowOrField_s::tableid, Schema::tables, toFloat(), Statement::transactionPtr, UINT, fieldInput_u::uinteger, fieldValue_s::value, and VARCHAR.
Referenced by Statement::searchExpression().
void Ast::evaluateAssignment | ( | std::vector< fieldValue_s > & | fieldValues, |
class Statement * | statementPtr | ||
) |
evaluate assignments in UPDATE queries
fieldValues | list of values to set each row to |
statementPtr | associated statement |
Definition at line 1521 of file Asts.cc.
References evaluateAssignment(), isoperator, leftchild, normalizeSetAssignmentOperand(), operand, OPERAND_FLOAT, OPERAND_INTEGER, OPERAND_STRING, OPERATOR_ADDITION, OPERATOR_CONCATENATION, OPERATOR_DIVISION, OPERATOR_MULTIPLICATION, OPERATOR_NEGATION, OPERATOR_SUBTRACTION, operatortype, rightchild, and toFloat().
Referenced by evaluateAssignment().
void Ast::normalizeSetAssignmentOperand | ( | vector< fieldValue_s > & | fieldValues, |
class Statement * | statementPtr | ||
) |
convert
fieldValues | |
statementPtr |
Definition at line 1851 of file Asts.cc.
References BOOL, CHAR, CHARX, Statement::currentQuery, FLOAT, INT, operand, OPERAND_FIELDID, OPERAND_FLOAT, OPERAND_INTEGER, OPERAND_PARAMETER, OPERAND_STRING, OPERAND_SUBQUERY, Statement::parameters, Statement::schemaPtr, Statement::subqueryScalar(), Statement::query_s::tableid, Schema::tables, UINT, and VARCHAR.
Referenced by evaluateAssignment().
|
static |
converts INTEGER to FLOAT (or leaves float alone). Supports arithmetic between numbers. Parser doesn't determine type based on context, but on content. So, "35+15.7" is parsed as INTEGER + FLOAT. While "35.0+15.7" is parsed as FLOAT + FLOAT. This function casts INTEGER to FLOAT so math can be performed.
inoperand | operand to convert |
outField | converted to fieldValue_s type |
Definition at line 1941 of file Asts.cc.
References fieldInput_u::floating, OPERAND_FLOAT, OPERAND_INTEGER, and fieldValue_s::value.
Referenced by Statement::andPredicate(), Statement::branchtotype(), Statement::continueUpdate(), evaluate(), evaluateAssignment(), and Statement::stagedPredicate().
|
static |
converts INTEGER to FLOAT (or leaves float alone). Supports arithmetic between numbers. Parser doesn't determine type based on context, but on content. So, "35+15.7" is parsed as INTEGER + FLOAT. While "35.0+15.7" is parsed as FLOAT + FLOAT. This function casts INTEGER to FLOAT so math can be performed.
inoperand | operand to convert |
outoperand | output operand |
Definition at line 1962 of file Asts.cc.
References OPERAND_FLOAT, and OPERAND_INTEGER.
bool Ast::isoperator |
Definition at line 142 of file Asts.h.
Referenced by cp(), evaluate(), evaluateAssignment(), Statement::resolveFieldNames(), and ~Ast().
class Ast* Ast::leftchild |
Definition at line 140 of file Asts.h.
Referenced by Ast(), Larxer::consumeExpression(), cp(), evaluate(), evaluateAssignment(), Statement::resolveFieldNames(), and ~Ast().
std::string Ast::operand |
Definition at line 144 of file Asts.h.
Referenced by Statement::branchtotype(), Larxer::consumeExpression(), cp(), evaluate(), evaluateAssignment(), normalizeSetAssignmentOperand(), Statement::resolveFieldNames(), Statement::subqueryExists(), Statement::subqueryIn(), Statement::subqueryScalar(), and Statement::subqueryUnique().
operatortypes_e Ast::operatortype |
Definition at line 143 of file Asts.h.
Referenced by Ast(), cp(), evaluate(), and evaluateAssignment().
class Ast* Ast::parent |
Definition at line 138 of file Asts.h.
Referenced by Larxer::consumeExpression(), cp(), evaluate(), and Statement::resolveFieldNames().
boost::unordered_map<uuRecord_s, returnRow_s> Ast::predicateResults |
Definition at line 145 of file Asts.h.
Referenced by cp(), evaluate(), and Statement::searchExpression().
class Ast* Ast::rightchild |
Definition at line 139 of file Asts.h.
Referenced by Larxer::consumeExpression(), cp(), evaluate(), evaluateAssignment(), Statement::resolveFieldNames(), and ~Ast().