casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
casa::TaQLNodeHandler Class Reference

Class to handle the nodes in the raw TaQL parse tree. More...

#include <TaQLNodeHandler.h>

Inheritance diagram for casa::TaQLNodeHandler:
casa::TaQLNodeVisitor

List of all members.

Public Member Functions

virtual ~TaQLNodeHandler ()
TaQLNodeResult handleTree (const TaQLNode &tree, const std::vector< const Table * > &)
 Handle and process the raw parse tree.
virtual TaQLNodeResult visitConstNode (const TaQLConstNodeRep &node)
 Define the functions to visit each node type.
virtual TaQLNodeResult visitRegexNode (const TaQLRegexNodeRep &node)
virtual TaQLNodeResult visitUnaryNode (const TaQLUnaryNodeRep &node)
virtual TaQLNodeResult visitBinaryNode (const TaQLBinaryNodeRep &node)
virtual TaQLNodeResult visitMultiNode (const TaQLMultiNodeRep &node)
virtual TaQLNodeResult visitFuncNode (const TaQLFuncNodeRep &node)
virtual TaQLNodeResult visitRangeNode (const TaQLRangeNodeRep &node)
virtual TaQLNodeResult visitIndexNode (const TaQLIndexNodeRep &node)
virtual TaQLNodeResult visitKeyColNode (const TaQLKeyColNodeRep &node)
virtual TaQLNodeResult visitTableNode (const TaQLTableNodeRep &node)
virtual TaQLNodeResult visitColNode (const TaQLColNodeRep &node)
virtual TaQLNodeResult visitColumnsNode (const TaQLColumnsNodeRep &node)
virtual TaQLNodeResult visitJoinNode (const TaQLJoinNodeRep &node)
virtual TaQLNodeResult visitSortKeyNode (const TaQLSortKeyNodeRep &node)
virtual TaQLNodeResult visitSortNode (const TaQLSortNodeRep &node)
virtual TaQLNodeResult visitLimitOffNode (const TaQLLimitOffNodeRep &node)
virtual TaQLNodeResult visitGivingNode (const TaQLGivingNodeRep &node)
virtual TaQLNodeResult visitUpdExprNode (const TaQLUpdExprNodeRep &node)
virtual TaQLNodeResult visitSelectNode (const TaQLSelectNodeRep &node)
virtual TaQLNodeResult visitUpdateNode (const TaQLUpdateNodeRep &node)
virtual TaQLNodeResult visitInsertNode (const TaQLInsertNodeRep &node)
virtual TaQLNodeResult visitDeleteNode (const TaQLDeleteNodeRep &node)
virtual TaQLNodeResult visitCountNode (const TaQLCountNodeRep &node)
virtual TaQLNodeResult visitCalcNode (const TaQLCalcNodeRep &node)
virtual TaQLNodeResult visitCreTabNode (const TaQLCreTabNodeRep &node)
virtual TaQLNodeResult visitColSpecNode (const TaQLColSpecNodeRep &node)
virtual TaQLNodeResult visitRecFldNode (const TaQLRecFldNodeRep &node)
virtual TaQLNodeResult visitUnitNode (const TaQLUnitNodeRep &node)

Static Public Member Functions

static const TaQLNodeHRValuegetHR (const TaQLNodeResult &)
 Get the actual result object from the result.

Private Member Functions

TableParseSelectpushStack (TableParseSelect::CommandType)
 Push a new TableParseSelect on the stack.
TableParseSelecttopStack () const
 Get the top of the TableParseSelect stack.
void popStack ()
 Pop the top from the TableParseSelect stack.
void clearStack ()
 Clear the select stack.
TaQLNodeResult handleSelect (const TaQLSelectNodeRep &node, Bool doExec)
 Handle the select command.
void handleTables (const TaQLMultiNode &)
 Handle a MultiNode containing table info.
void handleWhere (const TaQLNode &)
 Handle the WHERE clause.
void handleUpdate (const TaQLMultiNode &)
 Handle the UPDATE SET clause.
void handleInsCol (const TaQLMultiNode &)
 Handle the INSERT columns.
void handleInsVal (const TaQLNode &)
 Handle the INSERT values.
void handleColSpec (const TaQLMultiNode &)
 Handle a column specification in a create table.
Record handleRecord (const TaQLMultiNodeRep *)
 Handle a record specification.
void handleRecFld (const TaQLNode &, Record &)
 Handle a record field and add it to the Record.
void handleMultiRecFld (const String &fldName, const TaQLMultiNodeRep *node, Record &rec)
 Handle a record field with multiple values and add it to the Record.
int checkConstDtype (int dt1, int dt2)
 Determine 'highest' constant data type and check if they match.

Private Attributes

std::vector< TableParseSelect * > itsStack
std::vector< const Table * > itsTempTables

Detailed Description

Class to handle the nodes in the raw TaQL parse tree.

Intended use:

Internal

Review Status

Test programs:
tTableGram

Prerequisite

Synopsis

TaQLNodeHandler is a specialization of class TaQLNodeVisitor . It processes the raw TaQL parse tree generated by TableGram. The processing is done in a recursive way. It starts at the top (which is a SELECT, UPDATE, etc. expression) and the processing results of a query are stored in a TableParseSelect object. These objects are kept in a stack for possible nested queries. After a query is fully processed, it is executed. Usually the result is a table; only a CALC command gives a TableExprNode as result.

Motivation

Separating the raw query parsing from the query processing has several advantages compared to the old situation where parsing and processing were combined.

Definition at line 93 of file TaQLNodeHandler.h.


Constructor & Destructor Documentation


Member Function Documentation

int casa::TaQLNodeHandler::checkConstDtype ( int  dt1,
int  dt2 
) [private]

Determine 'highest' constant data type and check if they match.

Clear the select stack.

const TaQLNodeHRValue & casa::TaQLNodeHandler::getHR ( const TaQLNodeResult res) [inline, static]

Get the actual result object from the result.

Definition at line 301 of file TaQLNodeHandler.h.

References casa::TaQLNodeResult::getRep().

Handle a column specification in a create table.

void casa::TaQLNodeHandler::handleInsCol ( const TaQLMultiNode ) [private]

Handle the INSERT columns.

void casa::TaQLNodeHandler::handleInsVal ( const TaQLNode ) [private]

Handle the INSERT values.

void casa::TaQLNodeHandler::handleMultiRecFld ( const String fldName,
const TaQLMultiNodeRep node,
Record rec 
) [private]

Handle a record field with multiple values and add it to the Record.

The field can be a record or a vector of values.

void casa::TaQLNodeHandler::handleRecFld ( const TaQLNode ,
Record  
) [private]

Handle a record field and add it to the Record.

Handle a record specification.

Handle the select command.

Optionally the command is not executed (needed for the EXISTS operator).

void casa::TaQLNodeHandler::handleTables ( const TaQLMultiNode ) [private]

Handle a MultiNode containing table info.

TaQLNodeResult casa::TaQLNodeHandler::handleTree ( const TaQLNode tree,
const std::vector< const Table * > &   
)

Handle and process the raw parse tree.

The result contains a Table or TableExprNode object.

void casa::TaQLNodeHandler::handleUpdate ( const TaQLMultiNode ) [private]

Handle the UPDATE SET clause.

void casa::TaQLNodeHandler::handleWhere ( const TaQLNode ) [private]

Handle the WHERE clause.

void casa::TaQLNodeHandler::popStack ( ) [private]

Pop the top from the TableParseSelect stack.

Push a new TableParseSelect on the stack.

Get the top of the TableParseSelect stack.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Define the functions to visit each node type.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.

Implements casa::TaQLNodeVisitor.


Member Data Documentation

Definition at line 191 of file TaQLNodeHandler.h.

std::vector<const Table*> casa::TaQLNodeHandler::itsTempTables [private]

Definition at line 193 of file TaQLNodeHandler.h.


The documentation for this class was generated from the following file: