PSSql92Generator Class Reference

Implementation for a SQL-92 generator, which generates a SQL-92 statement from a parse tree. More...

Inherits Simba::SQLEngine::ISqlGenerator.

Inherited by PSTransactSqlGenerator.

List of all members.

Public Member Functions

virtual simba_wstring GenerateSqlFragment (PSParseNode *in_parseNode)
 Given a parse tree subtree, generates semantically-equivalent SQL-92.
simba_wstring GenerateSqlStatement ()
 Generates a semantically-equivalent SQL-92 statement from the parse tree.
virtual simba_wstring GenerateSqlStatement (PSParseNode *in_parseNode)
 Generates a semantically-equivalent SQL-92 statement from the parse tree.
 PSSql92Generator (bool in_wrapInParentheses=true, bool in_useLimit=false)
 Constructor.
void SetRootNode (PSRootParseNode *in_root)
 Sets the root parse node to use.
virtual ~PSSql92Generator ()
 Destructor.

Protected Member Functions

void AddWord (simba_wstring &io_string, const simba_wstring &in_word)
 Helper function to add the given word to io_string.
void AddWordWithComma (simba_wstring &io_string, const simba_wstring &in_word)
 Helper function to add the given word to io_string, with a 'comma' character and a 'space' character added after the given word.
void AddWordWithPeriod (simba_wstring &io_string, const simba_wstring &in_word)
 Helper function to add the given word to io_string, with a 'period' character added after the word.
void AddWordWithSpace (simba_wstring &io_string, const simba_wstring &in_word)
 Helper function to add the given word to io_string, with a space character added after the word.
virtual simba_wstring GenerateAnd (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_AND node.
virtual simba_wstring GenerateArithmeticLiteral (PSLiteralParseNode *in_node)
 Generates the SQL syntax for a PSLiteralParseNode with an arithmetic type. This includes PS_LITERAL_APPROXNUM, PS_LITERAL_DECIMAL, and PS_LITERAL_USINT.
virtual simba_wstring GenerateAvg (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_AVG node.
virtual simba_wstring GenerateBetweenPredicate (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_BETWEEN node.
virtual simba_wstring GenerateBinaryMinus (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_BINARY_MINUS_SIGN node.
virtual simba_wstring GenerateBinaryPlus (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_BINARY_PLUS_SIGN node.
virtual simba_wstring GenerateCastScalarFn (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SCALAR_OR_AGGR_FN node of type CAST.
virtual simba_wstring GenerateCharacterLiteral (PSLiteralParseNode *in_node)
 Generates the SQL syntax for a PSLiteralParseNode with type PS_LITERAL_CHARSTR.
virtual simba_wstring GenerateCoalesce (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_COALESCE node.
virtual simba_wstring GenerateColumnReference (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_COLUMN_REFERENCE node.
virtual simba_wstring GenerateConcat (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_CONCAT_SIGN node.
virtual simba_wstring GenerateConvertScalarFn (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SCALAR_OR_AGGR_FN node of type CONVERT.
virtual simba_wstring GenerateCount (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_COUNT node.
virtual simba_wstring GenerateCrossJoin (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_CROSS_JOIN node.
virtual simba_wstring GenerateDataTypeLiteral (PSLiteralParseNode *in_node)
 Generates the SQL syntax for a PSLiteralParseNode with type PS_LITERAL_DATATYPE.
virtual simba_wstring GenerateDateLiteral (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_DATE_LITERAL node.
virtual simba_wstring GenerateDerivedColumn (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_DERIVED_COLUMN node.
virtual simba_wstring GenerateDivision (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_DIVISION_SIGN node.
virtual simba_wstring GenerateEqualsOp (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_EQUALS_OP node.
virtual simba_wstring GenerateExcept (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_EXCEPT node.
virtual simba_wstring GenerateExceptAll (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_EXCEPT_ALL node.
virtual simba_wstring GenerateExistsPredicate (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_EXISTS node.
virtual simba_wstring GenerateExtractScalarFn (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SCALAR_FN node of type EXTRACT.
virtual simba_wstring GenerateFullOuterJoin (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_FULL_OUTER_JOIN node.
virtual simba_wstring GenerateGreaterThanOp (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_GREATER_THAN_OP node.
virtual simba_wstring GenerateGreaterThanOrEqualsOp (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_GREATER_THAN_OR_EQUALS_OP node.
virtual simba_wstring GenerateGroupByClause (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_GROUP_BY node.
virtual simba_wstring GenerateGroupingColumnList (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_GROUPBY_EXPRESSION_LIST node.
virtual simba_wstring GenerateHavingClause (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_HAVING node.
virtual simba_wstring GenerateIdentifier (PSIdentifierParseNode *in_node)
 Generates the SQL syntax for a PS_DT_IDENTIFIER node.
virtual simba_wstring GenerateIf (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_IF node.
virtual simba_wstring GenerateInnerJoin (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_INNER_JOIN node.
virtual simba_wstring GenerateInPredicate (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_IN node.
virtual simba_wstring GenerateIntervalLiteral (PSIntervalLiteralParseNode *in_node)
 Generates the SQL syntax for a PSIntervalLiteralParseNode.
virtual simba_wstring GenerateLeftOuterJoin (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_LEFT_OUTER_JOIN node.
virtual simba_wstring GenerateLessThanOp (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_LESS_THAN_OP node.
virtual simba_wstring GenerateLessThanOrEqualsOp (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_LESS_THAN_OR_EQUALS_OP node.
virtual simba_wstring GenerateLikePredicate (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_LIKE node.
virtual simba_wstring GenerateMax (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_MAX node.
virtual simba_wstring GenerateMin (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_MIN node.
virtual simba_wstring GenerateMultiplication (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_MULTIPLICATION_SIGN node.
virtual simba_wstring GenerateNot (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_NOT node.
virtual simba_wstring GenerateNotEqualsOp (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_NOT_EQUALS_OP node.
virtual simba_wstring GenerateNullIf (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_NULLIF node.
virtual simba_wstring GenerateNullLiteral (PSLiteralParseNode *in_node)
 Generates the SQL syntax for a NULL literal.
virtual simba_wstring GenerateNullPredicate (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_NULL node.
virtual simba_wstring GenerateOr (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_OR node.
virtual simba_wstring GenerateOrderByClause (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_ORDER_BY_CLAUSE node.
virtual simba_wstring GenerateOuterJoinEscapeSequence (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_OUTER_JOIN_VT node.
virtual simba_wstring GenerateParameterList (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_PARAMETER_LIST node.
virtual simba_wstring GenerateProcedureCall (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_PROCEDURE_CALL node.
virtual simba_wstring GenerateProcedureName (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_PROCEDURE_NAME node.
virtual simba_wstring GenerateProcedureParamList (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_PARAMETER_LIST for a PS_NT_PROCEDURE node.
virtual simba_wstring GenerateQuantifiedComparisonPredicate (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_QUANTIFIED_COMPARISON_PREDICATE node.
virtual simba_wstring GenerateRightOuterJoin (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_RIGHT_OUTER_JOIN node.
virtual simba_wstring GenerateRowValueConstructor (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_ROW_VALUE_LIST node.
virtual simba_wstring GenerateScalarFn (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SCALAR_OR_AGGR_FN node.
virtual simba_wstring GenerateSearchedCase (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SEARCHED_CASE node.
virtual simba_wstring GenerateSelectLimit (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a SELECT LIMIT node.
virtual simba_wstring GenerateSelectList (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a SELECT LIST node.
virtual simba_wstring GenerateSelectStmt (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a SELECT node.
virtual simba_wstring GenerateSetQuantifier (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SET_QUANTIFIER_OPT node.
virtual simba_wstring GenerateSimpleCase (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SIMPLE_CASE node.
virtual simba_wstring GenerateSortSpecification (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SORT_SPECIFICATION node.
virtual simba_wstring GenerateSortSpecificationList (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SORT_SPECIFICATION_LIST node.
virtual simba_wstring GenerateStdDev (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_STDDEV node.
virtual simba_wstring GenerateStdDevPop (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_STDDEV_POP node.
virtual simba_wstring GenerateSum (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_SUM node.
virtual simba_wstring GenerateTableName (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_TABLE_NAME node.
virtual simba_wstring GenerateTableReference (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_TABLE_REFERENCE node.
virtual simba_wstring GenerateTableRefList (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_TABLE_REFERENCE_LIST node.
virtual simba_wstring GenerateTimeLiteral (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_TIME_LITERAL node.
virtual simba_wstring GenerateTimestampLiteral (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_TIMESTAMP_LITERAL node.
virtual simba_wstring GenerateUnaryMinus (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_UNARY_MINUS_SIGN node.
virtual simba_wstring GenerateUnaryPlus (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_UNARY_PLUS_SIGN node.
virtual simba_wstring GenerateUnion (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_UNION node.
virtual simba_wstring GenerateUnionAll (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_UNION_ALL node.
virtual simba_wstring GenerateValueList (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_VALUE_LIST node.
virtual simba_wstring GenerateVariance (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_VAR node.
virtual simba_wstring GenerateVariancePop (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_VAR_POP node.
virtual simba_wstring GenerateWhereClause (PSNonTerminalParseNode *in_node)
 Generates the SQL syntax for a PS_NT_WHERE_CLAUSE node.

Protected Attributes

PSRootParseNodem_root
 The root node of the parse tree. (NOT OWN).
AutoPtr< PSParseTreeSqlVisitorm_visitor
 The parse tree visitor to use for visiting parse nodes.

Friends

class PSParseTreeSqlVisitor

Detailed Description

Implementation for a SQL-92 generator, which generates a SQL-92 statement from a parse tree.

Sub-classes may derive from PSSql92Generator and override 1 or more of the protected Generate*() functions. The syntax that is generated for each of the functions is described in the comments. If the syntax for your SQL engine differs from what is described, then override the appropriate function(s).

Public and Private functions _SHOULD NOT_ be overridden.

You may use the AcceptVisitor(*m_visitor) method on each of the node types in your overridden implementation.

For example: in_node->GetChild(1)->GetChild(1)->AcceptVisitor(*m_visitor); You can access the string that is generated from the visit method by using m_string.

Each function describes the syntax that is generated. The convention is as follows:

The SQL-92 grammar can be found online at: http://savage.net.au/SQL/


Constructor & Destructor Documentation

PSSql92Generator ( bool  in_wrapInParentheses = true,
bool  in_useLimit = false 
)

Constructor.

MAINTENANCE NOTE: SetRootNode() _MUST_ be called prior to GenerateSqlStatement().

Parameters:
in_wrapInParentheses Indicates if expressions should be wrapped in parentheses. The default is true.
in_useLimit Indicates if LIMIT should be used instead of TOP. Default is false (use TOP).
virtual ~PSSql92Generator (  )  [virtual]

Destructor.


Member Function Documentation

void AddWord ( simba_wstring io_string,
const simba_wstring in_word 
) [inline, protected]

Helper function to add the given word to io_string.

io_string _MUST_ be a valid string of length >= 0.

Parameters:
io_string The string to concatenate the given word.
in_word The word to add to the given string.
void AddWordWithComma ( simba_wstring io_string,
const simba_wstring in_word 
) [inline, protected]

Helper function to add the given word to io_string, with a 'comma' character and a 'space' character added after the given word.

io_string _MUST_ be a valid string of length >= 0.

Parameters:
io_string The string to concatenate the given word followed by 'comma' and 'space' characters.
in_word The word to add to the given string.
void AddWordWithPeriod ( simba_wstring io_string,
const simba_wstring in_word 
) [inline, protected]

Helper function to add the given word to io_string, with a 'period' character added after the word.

The given word will only be added if it is non-empty.

io_string _MUST_ be a valid string of length >= 0.

Parameters:
io_string The string to concatenate the given word and a 'period' character.
in_word The word to add to the given string.
void AddWordWithSpace ( simba_wstring io_string,
const simba_wstring in_word 
) [inline, protected]

Helper function to add the given word to io_string, with a space character added after the word.

Helpers io_string _MUST_ be a valid string of length >= 0.

Parameters:
io_string The string to concatenate the given word and a space character.
in_word The word to add to the given string.
virtual simba_wstring GenerateAnd ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_AND node.

Compound Filters Generates the following syntax:

  • Filter1 AND Filter2

where Filter1 and Filter2 are any boolean filters.

Parameters:
in_node A PS_NT_AND node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_AND.
Returns:
The SQL syntax for the PS_NT_AND node.
virtual simba_wstring GenerateArithmeticLiteral ( PSLiteralParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PSLiteralParseNode with an arithmetic type. This includes PS_LITERAL_APPROXNUM, PS_LITERAL_DECIMAL, and PS_LITERAL_USINT.

Returns in_node->ToString().

Parameters:
in_node A PSLiteralParseNode with an arithmetic type. (NOT OWN)
Returns:
The SQL syntax for a PSLiteralParseNode with with an arithmetic type.
virtual simba_wstring GenerateAvg ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_AVG node.

Set Functions Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is AVG.

Generates the following syntax:

  • AVG([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_AVG node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_AVG.
Returns:
The SQL syntax for the PS_NT_AVG node.
virtual simba_wstring GenerateBetweenPredicate ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_BETWEEN node.

Corresponds to the <between predicate> rule in the SQL-92 grammar.

Generates the following syntax:

  • RowValueConstructor [NOT] BETWEEN RowValueConstructor AND RowValueConstructor
Parameters:
in_node A PS_NT_BETWEEN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_BETWEEN.
Returns:
The SQL syntax for the PS_NT_BETWEEN node.
virtual simba_wstring GenerateBinaryMinus ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_BINARY_MINUS_SIGN node.

Arithmetic Corresponds to the SQL-92 rule:

  • <numeric value expression> ::= <numeric value expression> <minus sign> <term>

Generates the following syntax:

  • Expression - Expression
Parameters:
in_node A PS_NT_BINARY_MINUS_SIGN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_BINARY_MINUS_SIGN.
Returns:
The SQL syntax for a PS_NT_BINARY_PLUS_SIGN.
virtual simba_wstring GenerateBinaryPlus ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_BINARY_PLUS_SIGN node.

Corresponds to the SQL-92 rule:

  • <numeric value expression> ::= <numeric value expression> <plus sign> <term>

Generates the following syntax:

  • Expression + Expression
Parameters:
in_node A PS_NT_BINARY_PLUS_SIGN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_BINARY_PLUS_SIGN.
Returns:
The SQL syntax for a PS_NT_BINARY_PLUS_SIGN.
virtual simba_wstring GenerateCastScalarFn ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SCALAR_OR_AGGR_FN node of type CAST.

CAST is a special case as its syntax differs in Transact-SQL.

Generates the following syntax:

  • CAST(expression AS datatype)
Exceptions:
SEInvalidArgumentException if the given PS_NT_SCALAR_OR_AGGR_FN node is not of type CAST or if the parameter list does not contain exactly 2 children.
Parameters:
in_node A PS_NT_SCALAR_OR_AGGR_FN node of type CAST. (NOT OWN)
Returns:
The SQL syntax for a CAST scalar function node.
virtual simba_wstring GenerateCharacterLiteral ( PSLiteralParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PSLiteralParseNode with type PS_LITERAL_CHARSTR.

Quotes the string with ' and replaces embedded ' with ''.

Parameters:
in_node A PSLiteralParseNode of type PS_LITERAL_CHARSTR. (NOT OWN)
Returns:
The SQL syntax for a PSLiteralParseNode with type PS_LITERAL_CHARSTR.
virtual simba_wstring GenerateCoalesce ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_COALESCE node.

Corresponds to the SQL-92 rule: <case abbreviation> ::= COALESCE <left paren> <value expression> { <comma> <value expression> }... <right paren>

Generates the following syntax:

  • COALESCE(Expression, Expression...)
Parameters:
in_node A PS_NT_COALESCE node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_COALESCE.
Returns:
The SQL syntax for a PS_NT_COALESCE.
virtual simba_wstring GenerateColumnReference ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_COLUMN_REFERENCE node.

Columns Corresponds to the <column reference> rule in the SQL-92 grammar.

Generates the following syntax:

  • [Catalog.][Schema.][Table.]ColumnName

where the Catalog, schema, and table names are only generated if the given column reference has a catalog, schema, and/or table name.

Parameters:
in_node A PS_NT_COLUMN_REFERENCE node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_COLUMN_REFERENCE.
Returns:
The SQL syntax for the PS_NT_COLUMN_REFERENCE node.
virtual simba_wstring GenerateConcat ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_CONCAT_SIGN node.

Corresponds to the <concatenation> rule in the SQL-92 grammar.

Generates the following syntax:

  • Expression || Expression
Parameters:
in_node A PS_NT_CONCAT_SIGN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_CONCAT_SIGN.
Returns:
The SQL syntax for a PS_NT_CONCAT_SIGN.
virtual simba_wstring GenerateConvertScalarFn ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SCALAR_OR_AGGR_FN node of type CONVERT.

CONVERT is a special case as its syntax differs in Transact-SQL.

Generates the following syntax:

  • CONVERT(expression, datatype)
Exceptions:
SEInvalidArgumentException if the given PS_NT_SCALAR_OR_AGGR_FN node is not of type CONVERT or if the parameter list does not contain exactly 2 children.
Parameters:
in_node A PS_NT_SCALAR_OR_AGGR_FN node of type CONVERT. (NOT OWN)
Returns:
The SQL syntax for a CONVERT scalar function node.

Reimplemented in PSTransactSqlGenerator.

virtual simba_wstring GenerateCount ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_COUNT node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is COUNT.

Generates the following syntax:

  • COUNT([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_COUNT node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_COUNT.
Returns:
The SQL syntax for the PS_NT_COUNT node.
virtual simba_wstring GenerateCrossJoin ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_CROSS_JOIN node.

Joins Corresponds to the <cross join> rule in the SQL-92 grammar.

Generates the following syntax:

  • TableRef CROSS JOIN TableRef
Parameters:
in_node A PS_NT_CROSS_JOIN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_CROSS_JOIN.
Returns:
The SQL syntax for the PS_NT_CROSS_JOIN node.
virtual simba_wstring GenerateDataTypeLiteral ( PSLiteralParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PSLiteralParseNode with type PS_LITERAL_DATATYPE.

Returns in_node->ToString().

Parameters:
in_node A PSLiteralParseNode of type PS_LITERAL_DATATYPE. (NOT OWN)
Returns:
The SQL syntax for a PSLiteralParseNode with type PS_LITERAL_DATATYPE.
virtual simba_wstring GenerateDateLiteral ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_DATE_LITERAL node.

Corresponds to the SQL-92 rule: <date literal> ::= DATE <date string>

Generates the following syntax:

  • DATE '1999-01-01'
Parameters:
in_node A PS_NT_DATE_LITERAL node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_DATE_LITERAL.
Returns:
The SQL syntax for a PS_NT_DATE_LITERAL.
virtual simba_wstring GenerateDerivedColumn ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_DERIVED_COLUMN node.

Corresponds to the <derived column> rule in the SQL-92 grammar.

Generates the following syntax:

  • <value expression> [AS Identifier]

where the [AS Identifier] clause is only present if the second child is non-null.

Parameters:
in_node A PS_NT_DERIVED_COLUMN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_DERIVED_COLUMN.
Returns:
The SQL syntax for the PS_NT_DERIVED_COLUMN node.
virtual simba_wstring GenerateDivision ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_DIVISION_SIGN node.

Corresponds to the SQL-92 rule:

  • <term> :: <term> <solidus> <factor>

Generates the following syntax:

  • Expression / Expression
Parameters:
in_node A PS_NT_DIVISION_SIGN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_DIVISION_SIGN.
Returns:
The SQL syntax for a PS_NT_DIVISION_SIGN.
virtual simba_wstring GenerateEqualsOp ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_EQUALS_OP node.

Filters Corresponds to the <comparison predicate> rule in the SQL-92 grammar where the <comp op> is the <equals operator>.

Generates the following syntax:

  • RowValueConstructor = RowValueConstructor
Parameters:
in_node A PS_NT_EQUALS_OP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_EQUALS_OP.
Returns:
The SQL syntax for the PS_NT_EQUALS_OP node.
virtual simba_wstring GenerateExcept ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_EXCEPT node.

Set Operations Corresponds to the <non-join query expression> rule in the SQL-92 grammar with EXCEPT.

Generates the following syntax:

  • <query expression> EXCEPT <query term>
Parameters:
in_node A PS_NT_EXCEPT node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_EXCEPT.
Returns:
The SQL syntax for the PS_NT_EXCEPT node.
virtual simba_wstring GenerateExceptAll ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_EXCEPT_ALL node.

Corresponds to the <non-join query expression> rule in the SQL-92 grammar with EXCEPT ALL.

Generates the following syntax:

  • <query expression> EXCEPT ALL <query term>
Parameters:
in_node A PS_NT_EXCEPT_ALL node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_EXCEPT_ALL.
Returns:
The SQL syntax for the PS_NT_EXCEPT_ALL node.
virtual simba_wstring GenerateExistsPredicate ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_EXISTS node.

Corresponds to the <exists predicate> rule in the SQL-92 grammar.

Generates the following syntax:

  • EXISTS SubQuery
Parameters:
in_node A PS_NT_EXISTS node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_EXISTS.
Returns:
The SQL syntax for the PS_NT_EXISTS node.
virtual simba_wstring GenerateExtractScalarFn ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SCALAR_FN node of type EXTRACT.

EXTRACT is a special case as its syntax differs in Transact-SQL.

Generates the following syntax:

  • EXTRACT(type FROM expression)
Exceptions:
SEInvalidArgumentException if the given PS_NT_SCALAR_FN node is not of type EXTRACT or if the parameter list does not contain exactly 2 children.
Parameters:
in_node A PS_NT_SCALAR_FN node of type EXTRACT. (NOT OWN)
Returns:
The SQL syntax for a EXTRACT scalar function node.
virtual simba_wstring GenerateFullOuterJoin ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_FULL_OUTER_JOIN node.

A FULL OUTER JOIN corresponds to the <qualified join> rule in the SQL-92 grammar.

Generates the following syntax:

  • TableRef FULL OUTER JOIN TableRef [ON SearchCondition]

where TableRef is any table reference (or another join) and [ON SearchCondition] is optional.

Parameters:
in_node A PS_NT_FULL_OUTER_JOIN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_FULL_OUTER_JOIN.
Returns:
The SQL syntax for the FULL OUTER JOIN node.
virtual simba_wstring GenerateGreaterThanOp ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_GREATER_THAN_OP node.

Corresponds to the <comparison predicate> rule in the SQL-92 grammar where the <comp op> is the <greater than operator>.

Generates the following syntax:

  • RowValueConstructor > RowValueConstructor
Parameters:
in_node A PS_NT_GREATER_THAN_OP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_GREATER_THAN_OP.
Returns:
The SQL syntax for the PS_NT_GREATER_THAN_OP node.
virtual simba_wstring GenerateGreaterThanOrEqualsOp ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_GREATER_THAN_OR_EQUALS_OP node.

Corresponds to the <comparison predicate> rule in the SQL-92 grammar where the <comp op> is the <greater than or equals operator>.

Generates the following syntax:

  • RowValueConstructor >= RowValueConstructor
Parameters:
in_node A PS_NT_GREATER_THAN_OR_EQUALS_OP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_GREATER_THAN_OR_EQUALS_OP.
Returns:
The SQL syntax for the PS_NT_GREATER_THAN_OR_EQUALS_OP node.
virtual simba_wstring GenerateGroupByClause ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_GROUP_BY node.

Corresponds to the <group by clause> rule in the SQL-92 grammar.

The syntax generated is:

  • GROUP BY Expr1, Expr2, ...

Refer to GenerateGroupingColumnList() for the Expr1, Expr2, ... syntax.

Parameters:
in_node A PS_NT_GROUP_BY parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_GROUP_BY.
Returns:
The SQL syntax for a PS_NT_GROUP_BY parse node.
virtual simba_wstring GenerateGroupingColumnList ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_GROUPBY_EXPRESSION_LIST node.

Group By Column reference list Corresponds to the <grouping column reference list> rule in the SQL-92 grammar.

Generates the following syntax:

  • Expr1, Expr2, ...

Refer to GenerateGroupByClause().

Parameters:
in_node A PS_NT_GROUPBY_EXPRESSION_LIST node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_GROUPBY_EXPRESSION_LIST node.
Returns:
The SQL syntax for the PS_NT_GROUPBY_EXPRESSION_LIST node.
virtual simba_wstring GenerateHavingClause ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_HAVING node.

Corresponds to the <having clause> rule in the SQL-92 grammar.

The syntax generated is:

  • HAVING SearchCondition
Parameters:
in_node A PS_NT_HAVING parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_HAVING.
Returns:
The SQL syntax for a PS_NT_HAVING parse node.
virtual simba_wstring GenerateIdentifier ( PSIdentifierParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_DT_IDENTIFIER node.

Misc Quotes the identifier with " and replaces embedded " with "".

Parameters:
in_node A PS_DT_IDENTIFIER node. (NOT OWN)
Returns:
The SQL syntax for a PS_DT_IDENTIFIER.
virtual simba_wstring GenerateIf ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_IF node.

Generates the following syntax:

  • CASE WHEN BooleanExpression THEN Expression1 ELSE Expression2 END
Parameters:
in_node A PS_NT_IF node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_IF.
Returns:
The SQL syntax for a PS_NT_IF.
virtual simba_wstring GenerateInnerJoin ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_INNER_JOIN node.

An INNER JOIN corresponds to the <qualified join> rule in the SQL-92 grammar.

Generates the following syntax:

  • TableRef INNER JOIN TableRef [ON SearchCondition]

where TableRef is any table reference (or another join) and [ON SearchCondition] is optional.

Parameters:
in_node A PS_NT_INNER_JOIN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_INNER_JOIN.
Returns:
The SQL syntax for the INNER JOIN node.
virtual simba_wstring GenerateInPredicate ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_IN node.

Corresponds to the <in predicate> rule in the SQL-92 grammar.

Generates the following syntax:

  • RowValueConstructor [NOT] IN <in predicate value>
Parameters:
in_node A PS_NT_IN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_IN.
Returns:
The SQL syntax for the PS_NT_IN node.
virtual simba_wstring GenerateIntervalLiteral ( PSIntervalLiteralParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PSIntervalLiteralParseNode.

Parameters:
in_node A PSIntervalLiteralParseNode. (NOT OWN)
Returns:
The SQL syntax for a PSIntervalLiteralParseNode.
virtual simba_wstring GenerateLeftOuterJoin ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_LEFT_OUTER_JOIN node.

A LEFT OUTER JOIN corresponds to the <qualified join> rule in the SQL-92 grammar.

Generates the following syntax:

  • TableRef LEFT OUTER JOIN TableRef [ON SearchCondition]

where TableRef is any table reference (or another join) and [ON SearchCondition] is optional.

Parameters:
in_node A PS_NT_LEFT_OUTER_JOIN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_LEFT_OUTER_JOIN.
Returns:
The SQL syntax for the LEFT OUTER JOIN node.
virtual simba_wstring GenerateLessThanOp ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_LESS_THAN_OP node.

Corresponds to the <comparison predicate> rule in the SQL-92 grammar where the <comp op> is the <less than operator>.

Generates the following syntax:

  • RowValueConstructor < RowValueConstructor
Parameters:
in_node A PS_NT_LESS_THAN_OP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_LESS_THAN_OP.
Returns:
The SQL syntax for the PS_NT_LESS_THAN_OP node.
virtual simba_wstring GenerateLessThanOrEqualsOp ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_LESS_THAN_OR_EQUALS_OP node.

Corresponds to the <comparison predicate> rule in the SQL-92 grammar where the <comp op> is the <less than or equals operator>.

Generates the following syntax:

  • RowValueConstructor <= RowValueConstructor
Parameters:
in_node A PS_NT_LESS_THAN_OR_EQUALS_OP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_LESS_THAN_OR_EQUALS_OP.
Returns:
The SQL syntax for the PS_NT_LESS_THAN_OR_EQUALS_OP node.
virtual simba_wstring GenerateLikePredicate ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_LIKE node.

Corresponds to the <like predicate> rule in the SQL_92 grammar.

Generates the following syntax:

  • Expr [NOT] LIKE Expr [ESCAPE Expr]
Parameters:
in_node A PS_NT_LIKE node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_LIKE.
Returns:
The SQL syntax for the PS_NT_LIKE node.
virtual simba_wstring GenerateMax ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_MAX node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is MAX.

Generates the following syntax:

  • MAX([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_MAX node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_MAX.
Returns:
The SQL syntax for the PS_NT_MAX node.
virtual simba_wstring GenerateMin ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_MIN node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is MIN.

Generates the following syntax:

  • MIN([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_MIN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_MIN.
Returns:
The SQL syntax for the PS_NT_MIN node.
virtual simba_wstring GenerateMultiplication ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_MULTIPLICATION_SIGN node.

Corresponds to the SQL-92 rule:

  • <term> :: <term> <asterisk> <factor>

Generates the following syntax:

  • Expression * Expression
Parameters:
in_node A PS_NT_MULTIPLICATION_SIGN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_MULTIPLICATION_SIGN.
Returns:
The SQL syntax for a PS_NT_MULTIPLICATION_SIGN.
virtual simba_wstring GenerateNot ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_NOT node.

Generates the following syntax:

  • NOT Filter
Parameters:
in_node A PS_NT_NOT node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_NOT.
Returns:
The SQL syntax for the PS_NT_NOT node.
virtual simba_wstring GenerateNotEqualsOp ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_NOT_EQUALS_OP node.

Corresponds to the <comparison predicate> rule in the SQL-92 grammar where the <comp op> is the <not equals operator>.

Generates the following syntax:

  • RowValueConstructor != RowValueConstructor
Parameters:
in_node A PS_NT_NOT_EQUALS_OP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_NOT_EQUALS_OP.
Returns:
The SQL syntax for the PS_NT_NOT_EQUALS_OP node.
virtual simba_wstring GenerateNullIf ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_NULLIF node.

Corresponds to the SQL-92 rule: <case abbreviation> ::= NULLIF <left paren> <value expression> <comma> <value expression> <right paren>

Generates the following syntax:

  • NULLIF(Expression, Expression)
Parameters:
in_node A PS_NT_NULLIF node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_NULLIF.
Returns:
The SQL syntax for a PS_NT_NULLIF.
virtual simba_wstring GenerateNullLiteral ( PSLiteralParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a NULL literal.

Generates the following syntax:

  • NULL
Parameters:
in_node A PSLiteralParseNode with literal type PS_LITERAL_NULL. (NOT OWN)
Returns:
The SQL syntax for a NULL literal.
virtual simba_wstring GenerateNullPredicate ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_NULL node.

Corresponds to the <null predicate> rule in the SQL-92 grammar.

Generates the following syntax:

  • Expr [IS] NOT NULL
Parameters:
in_node A PS_NT_NULL node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_NULL.
Returns:
The SQL syntax for the PS_NT_NULL node.
virtual simba_wstring GenerateOr ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_OR node.

Generates the following syntax:

  • Filter1 OR Filter2
Parameters:
in_node A PS_NT_OR node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_OR.
Returns:
The SQL syntax for the PS_NT_OR node.
virtual simba_wstring GenerateOrderByClause ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_ORDER_BY_CLAUSE node.

The syntax generated is:

  • ORDER BY i1, i2, i3, ...

where i1, i2, i3 ... are any expressions or integers representing the sort columns.

Parameters:
in_node A PS_NT_ORDER_BY parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_ORDER_BY.
Returns:
The SQL syntax for a PS_NT_ORDER_BY parse node.
virtual simba_wstring GenerateOuterJoinEscapeSequence ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_OUTER_JOIN_VT node.

This corresponds with the ODBC Outer Join Escape Sequence. The specification for this construct can be found at http://msdn.microsoft.com/en-us/library/ms710299(v=VS.85).aspx.

Generates the following syntax:

  • {oj outer-join}
Parameters:
in_node A PS_NT_OUTER_JOIN_VT node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_OUTER_JOIN_VT.
Returns:
The SQL syntax for the PS_NT_OUTER_JOIN_VT node.
virtual simba_wstring GenerateParameterList ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_PARAMETER_LIST node.

Generates the following syntax:

  • Expr1, Expr2, Expr3, ...

where Expr is any expression and the number of expression corresponds with the number of children in the parameter list node.

Parameters:
in_node A PS_NT_PARAMETER_LIST node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_PARAMETER_LIST.
Returns:
The SQL syntax for a PS_NT_PARAMETER_LIST node.
virtual simba_wstring GenerateProcedureCall ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_PROCEDURE_CALL node.

Procedure Calls Corresponds to the 'Procedure Call Escape Sequence' in the ODBC API: http://msdn.microsoft.com/en-us/library/ms710248(v=VS.85).aspx

Generates the following syntax:

  • {[? =] call procedureName[([parameter][,[parameter]]...)]}

NOTE: procedureName() is different than procedureName. () indicates that all default parameters should be used. No brackets indicates no parameters.

The parse tree structure for a PS_NT_PROCEDURE_CALL is:

Parameters:
in_node A PS_NT_PROCEDURE_CALL node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_PROCEDURE_CALL.
Returns:
The SQL syntax for a PS_NT_PROCEDURE_CALL node.
virtual simba_wstring GenerateProcedureName ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_PROCEDURE_NAME node.

Generates the following syntax:

  • [Catalog.][Schema.]Procedure
Parameters:
in_node A PS_NT_PROCEDURE_NAME node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_PROCEDURE_NAME.
Returns:
The SQL syntax for a PS_NT_PROCEDURE_NAME node.
virtual simba_wstring GenerateProcedureParamList ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_PARAMETER_LIST for a PS_NT_PROCEDURE node.

Generates the following syntax:

  • (Expr1, Expr2, Expr3, ...)

where Expr can be '?' or any other value expression.

Parameters:
in_node A PS_NT_PARAMETER_LIST node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_PARAMETER_LIST.
Returns:
The SQL syntax for a PS_NT_PARAMETER_LIST.
virtual simba_wstring GenerateQuantifiedComparisonPredicate ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_QUANTIFIED_COMPARISON_PREDICATE node.

Corresponds to the <quantified comparison predicate> rule in the SQL-92 grammar.

Generates the following syntax:

  • RowValueConstructor ComparisonOp Quantifier SubQuery

where ComparisonOp is the =, !=, <, <=, >, or >= operator; Quantifier is ALL or ANY.

Parameters:
in_node A PS_NT_QUANTIFIED_COMPARISON_PREDICATE node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_QUANTIFIED_COMPARISON_PREDICATE.
Returns:
The SQL syntax for the PS_NT_QUANTIFIED_COMPARISON_PREDICATE node.
virtual simba_wstring GenerateRightOuterJoin ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_RIGHT_OUTER_JOIN node.

A RIGHT OUTER JOIN corresponds to the <qualified join> rule in the SQL-92 grammar.

Generates the following syntax:

  • TableRef RIGHT OUTER JOIN TableRef [ON SearchCondition]

where TableRef is any table reference (or another join) and [ON SearchCondition] is optional.

Parameters:
in_node A PS_NT_RIGHT_OUTER_JOIN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_RIGHT_OUTER_JOIN.
Returns:
The SQL syntax for the RIGHT OUTER JOIN node.
virtual simba_wstring GenerateRowValueConstructor ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_ROW_VALUE_LIST node.

Corresponds to the <row value constructor> rule in the SQL-92 grammar.

Generates the following syntax:

  • (Expr1, Expr2, Expr3, ...)

where Expr is any expression and the number of expressions corresponds with the number of children in the row value list node. Expressions are generated in the order that they are in the child list of in_node.

Parameters:
in_node A PS_NT_ROW_VALUE_LIST node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_ROW_VALUE_LIST.
Returns:
The SQL syntax for a PS_NT_ROW_VALUE_LIST node.
virtual simba_wstring GenerateScalarFn ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SCALAR_OR_AGGR_FN node.

Scalar Functions A PS_NT_SCALAR_OR_AGGR_FN node is generated for the ODBC and SQL-92 Scalar Functions as noted in http://msdn.microsoft.com/en-us/library/ms711813(VS.85).aspx.

Note that this now also represents custom aggregate functions, and that the type of function is determined by the DSII if this doesn't represent a known scalar or aggregate

Generates the following syntax:

  • ScalarFn(...)

where ScalarFn is any of the supported scalar functions, (...) represents a variadic number of arguments corresponding with the particular scalar function.

Parameters:
in_node A PS_NT_SCALAR_OR_AGGR_FN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_SCALAR_OR_AGGR_FN.
Returns:
The SQL syntax for the PS_NT_SCALAR_OR_AGGR_FN node.

Reimplemented in PSTransactSqlGenerator.

virtual simba_wstring GenerateSearchedCase ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SEARCHED_CASE node.

Corresponds to the SQL-92 rule: <searched case> ::= CASE <searched when clause> ... [ <else clause>=""> ] END

Generates the following syntax:

  • CASE WHEN SearchCond THEN Expression ... [ELSE Expression] END
Parameters:
in_node A PS_NT_SEARCHED_CASE node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_SEARCHED_CASE.
Returns:
The SQL syntax for a PS_NT_SEARCHED_CASE.
virtual simba_wstring GenerateSelectLimit ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a SELECT LIMIT node.

Clauses The syntax generated is:

  • TOP N [PERCENT]

where N is any unsigned value specification.

The PERCENT keyword is optional, and will be added only if in_node's second child (Child 1) is non-empty.

Parameters:
in_node A PS_NT_SELECT_LIMIT parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_SELECT_LIMIT.
Returns:
The SQL syntax for a PS_NT_SELECT_LIMIT parse node.
virtual simba_wstring GenerateSelectList ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a SELECT LIST node.

The syntax generated is:

  • c1, c2, c3, ...

where c is any value expression.

Parameters:
in_node A PS_NT_SELECT_LIST parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_SELECT_LIST.
Returns:
The SQL syntax for a PS_NT_SELECT_LIST parse node.
virtual simba_wstring GenerateSelectStmt ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a SELECT node.

The syntax generated is:

  • SELECT x FROM y <where clause> <group by clause> <having clause>

where x is the SelectList, and y is the TableRefList. Refer to GenerateSelectList() for x and GenerateTableRefList() for y.

The <where clause>, <group by clause>, and <having clause> clauses are optional. Refer to GenerateWhereClause(), GenerateGroupByClause(), GenerateHavingClause() for details.

Parameters:
in_node A PS_NT_SELECT_STATEMENT parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_SELECT_STATEMENT.
Returns:
The SQL syntax for a PS_NT_SELECT_STATEMENT parse node.
virtual simba_wstring GenerateSetQuantifier ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SET_QUANTIFIER_OPT node.

Corresponds to the <set quantifier> rule in the SQL-92 grammar.

Generates the following syntax:

  • ALL | DISTINCT
Parameters:
in_node A PS_NT_SET_QUANTIFIER_OPT node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_SET_QUANTIFIER_OPT.
Returns:
The SQL syntax for a PS_NT_SET_QUANTIFIER_OPT node.
virtual simba_wstring GenerateSimpleCase ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SIMPLE_CASE node.

Corresponds to the SQL-92 rule: <simple case> ::= CASE <case operand> <simple when clause> ... [ <else clause>=""> ] END

Generates the following syntax:

  • CASE Expression WHEN Expression THEN Expression ... [ELSE Expression] END
Parameters:
in_node A PS_NT_SIMPLE_CASE node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_SIMPLE_CASE.
Returns:
The SQL syntax for a PS_NT_SIMPLE_CASE.
virtual simba_wstring GenerateSortSpecification ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SORT_SPECIFICATION node.

Corresponds to the <sort specification> rule in the SQL-92 grammar.

Generates the following syntax:

  • Expr [ASC | DESC]
Parameters:
in_node A PS_NT_SORT_SPECIFICATION node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_SORT_SPECIFICATION node.
Returns:
The SQL syntax for the PS_NT_SORT_SPECIFICATION node.
virtual simba_wstring GenerateSortSpecificationList ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SORT_SPECIFICATION_LIST node.

Sort specification Corresponds to the <sort specification list> rule in the SQL-92 grammar.

Generates the following syntax:

  • <sort specification>, <sort specification>, ...

Refer to GenerateSortSpecification() for the <sort specification> syntax.

Parameters:
in_node A PS_NT_SORT_SPECIFICATION_LIST node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_SORT_SPECIFICATION_LIST.
Returns:
The SQL syntax for the PS_NT_SORT_SPECIFICATION_LIST node.
virtual simba_wstring GenerateSqlFragment ( PSParseNode in_parseNode  )  [virtual]

Given a parse tree subtree, generates semantically-equivalent SQL-92.

NOTE: This is only guaranteed to work for valid parse trees, and only for

  • Their root (i.e. a SQL statement)
  • A subquery.
  • An expression.
Parameters:
in_parseNode The root node of a parse tree to generate SQL from. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_parseNode is NULL.
Returns:
Semantically-equivalent SQL to the given parse tree fragment.
simba_wstring GenerateSqlStatement (  )  [virtual]

Generates a semantically-equivalent SQL-92 statement from the parse tree.

MAINTENANCE NOTE: SetRootNode() _MUST_ be called prior to calling this function.

This is the gateway to the Generate* functions for each of the statement types.

This function should not be overridden. Override the specific protected statement or clause generation functions if desired.

Exceptions:
SEInvalidArgumentException if m_root is NULL.
Returns:
A semantically-equivalent SQL-92 statement represented by the parse tree.

Implements ISqlGenerator.

virtual simba_wstring GenerateSqlStatement ( PSParseNode in_parseNode  )  [virtual]

Generates a semantically-equivalent SQL-92 statement from the parse tree.

Given: PSRootParseNode* rootParseNode = GetRootParseNode(); PSParseNode* parseTreeRoot = rootParseNode->GetRootNode();

Then a call to GenerateSqlStatement(parseTreeRoot) is equivalent to the following: SetRootNode(rootParseNode); GenerateSqlStatement();

Parameters:
in_parseNode The root node of a parse tree. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_parseNode is NULL.
Returns:
A semantically-equivalent SQL-92 statement represented by the parse tree.
virtual simba_wstring GenerateStdDev ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_STDDEV node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is STDDEV.

Generates the following syntax:

  • STDDEV([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_STDDEV node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_STDDEV.
Returns:
The SQL syntax for the PS_NT_STDDEV node.
virtual simba_wstring GenerateStdDevPop ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_STDDEV_POP node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is STDDEV_POP.

Generates the following syntax:

  • STDDEV_POP([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_STDDEV_POP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_STDDEV_POP.
Returns:
The SQL syntax for the PS_NT_STDDEV_POP node.
virtual simba_wstring GenerateSum ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_SUM node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is SUM.

Generates the following syntax:

  • SUM([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_SUM node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_SUM.
Returns:
The SQL syntax for the PS_NT_SUM node.
virtual simba_wstring GenerateTableName ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_TABLE_NAME node.

Corresponds to the <table name> rule in the SQL-92 grammar.

Generates the following syntax:

  • [Catalog.][Schema.]TableName

where the Catalog and schema names are only generated if the given table reference has a catalog and/or schema name.

Parameters:
in_node A PS_NT_TABLE_NAME node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_TABLE_NAME.
Returns:
The SQL syntax for the PS_NT_TABLE_NAME node.
virtual simba_wstring GenerateTableReference ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_TABLE_REFERENCE node.

Tables Corresponds to the <table reference> rule in the SQL-92 grammar.

Parameters:
in_node A PS_NT_TABLE_REFERENCE node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_TABLE_REFERENCE.
Returns:
The SQL syntax for the PS_NT_TABLE_REFERENCE node.
virtual simba_wstring GenerateTableRefList ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_TABLE_REFERENCE_LIST node.

The syntax generated is:

  • T1 CROSS JOIN T2 [AS A1] CROSS JOIN ...

where T is any table reference, [AS A1] is an optional alias for each table reference. A table reference can be a table, or a joined table. Refer to GenerateJoinedTable() for the latter case.

Parameters:
in_node A PS_NT_TABLE_REFERENCE_LIST parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_TABLE_REFERENCE_LIST.
Returns:
The SQL syntax for a PS_NT_TABLE_REFERENCE_LIST parse node.
virtual simba_wstring GenerateTimeLiteral ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_TIME_LITERAL node.

Corresponds to the SQL-92 rule: <time literal> ::= TIME <time string>

Generates the following syntax:

  • TIME '12:12:12'
Parameters:
in_node A PS_NT_TIME_LITERAL node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_TIME_LITERAL.
Returns:
The SQL syntax for a PS_NT_TIME_LITERAL.
virtual simba_wstring GenerateTimestampLiteral ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_TIMESTAMP_LITERAL node.

Corresponds to the SQL-92 rule: <timestamp literal> ::= TIMESTAMP <timestamp string>

Generates the following syntax:

  • TIMESTAMP '1999-01-01 12:12:12'
Parameters:
in_node A PS_NT_TIMESTAMP_LITERAL node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_TIMESTAMP_LITERAL.
Returns:
The SQL syntax for a PS_NT_TIMESTAMP_LITERAL.
virtual simba_wstring GenerateUnaryMinus ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_UNARY_MINUS_SIGN node.

Corresponds to the SQL-92 rule:

  • <factor> ::= <minus sign> <numeric primary>

Generates the following syntax:

  • -Expression
Parameters:
in_node A PS_NT_UNARY_MINUS_SIGN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_UNARY_MINUS_SIGN.
Returns:
The SQL syntax for a PS_NT_UNARY_MINUS_SIGN.
virtual simba_wstring GenerateUnaryPlus ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_UNARY_PLUS_SIGN node.

Corresponds to the SQL-92 rule: <factor> ::= <plus sign> <numeric primary>

Generates the following syntax:

  • +Expression
Parameters:
in_node A PS_NT_UNARY_PLUS_SIGN node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_UNARY_PLUS_SIGN.
Returns:
The SQL syntax for a PS_NT_UNARY_PLUS_SIGN.
virtual simba_wstring GenerateUnion ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_UNION node.

Corresponds to the SQL-92 rule:

  • <non-join query expression> ::= <query expression> UNION <query term>

NOTE: SEN does not support the <corresponding spec> clause.

Generates the following syntax:

  • <non-join query expression> UNION <query term>
Parameters:
in_node A PS_NT_UNION node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_UNION.
Returns:
The SQL syntax for a PS_NT_UNION node.
virtual simba_wstring GenerateUnionAll ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_UNION_ALL node.

Corresponds to the SQL-92 rule:

  • <non-join query expression> ::= <query expression> UNION ALL <query term>

NOTE: SEN does not support the <corresponding spec> clause.

Generates the following syntax:

  • <non-join query expression> UNION ALL <query term>
Parameters:
in_node A PS_NT_UNION_ALL node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_UNION_ALL.
Returns:
The SQL syntax for a PS_NT_UNION_ALL node.
virtual simba_wstring GenerateValueList ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_VALUE_LIST node.

Corresponds to the <in value list> rule in the SQL-92 grammar.

Generates the following syntax:

  • ( ValueExpression1, ValueExpression2, ...)
Parameters:
in_node A PS_NT_VALUE_LIST node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_VALUE_LIST.
Returns:
The SQL syntax for the PS_NT_VALUE_LIST node.
virtual simba_wstring GenerateVariance ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_VAR node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is VAR.

Generates the following syntax:

  • VAR([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_VAR node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_VAR.
Returns:
The SQL syntax for the PS_NT_VAR node.
virtual simba_wstring GenerateVariancePop ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_VAR_POP node.

Corresponds to the <general set function rule> in the SQL-92 grammar where the <set function type> is VAR_POP.

Generates the following syntax:

  • VAR_POP([ALL | DISTINCT] Expr)
Parameters:
in_node A PS_NT_VAR_POP node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if the given node is not of type PS_NT_VAR_POP.
Returns:
The SQL syntax for the PS_NT_VAR_POP node.
virtual simba_wstring GenerateWhereClause ( PSNonTerminalParseNode in_node  )  [protected, virtual]

Generates the SQL syntax for a PS_NT_WHERE_CLAUSE node.

Corresponds to the <where clause> rule in the SQL-92 grammar.

The syntax generated is:

  • WHERE (condition)
Parameters:
in_node A PS_NT_WHERE_CLAUSE parse node. (NOT OWN)
Exceptions:
SEInvalidArgumentException if in_node is not of type PS_NT_WHERE_CLAUSE.
Returns:
The SQL syntax for a PS_NT_WHERE_CLAUSE parse node.
void SetRootNode ( PSRootParseNode in_root  )  [virtual]

Sets the root parse node to use.

MAINTENANCE NOTE: The root node _MUST_ be set prior to calling GenerateSqlStatement().

Parameters:
in_root The root node of a parse tree. (NOT OWN)

Implements ISqlGenerator.


Friends And Related Function Documentation

friend class PSParseTreeSqlVisitor [friend]

Member Data Documentation

PSRootParseNode* m_root [protected]

The root node of the parse tree. (NOT OWN).

The parse tree visitor to use for visiting parse nodes.


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

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba