Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

LcgInfo::SQLtoSQLPredicateTree Class Reference

This class implements a binary tree of nodes that stores a SQL "WHERE predicate", that can translate it to a new schema, and that can evaluate it, outputing a SQL string. More...

#include <SQLtoSQLPredicateTree.h>

Inheritance diagram for LcgInfo::SQLtoSQLPredicateTree:

LcgInfo::SQLPredicateTree LcgInfo::PredicateTree List of all members.

Public Methods

 SQLtoSQLPredicateTree ()
 Constructor of the class. More...

virtual ~SQLtoSQLPredicateTree ()
 Destructor of the class.

SQLtoSQLPredicateTree * create ()
 Creates a new node of the type of this node (SQLtoSQLPredicateTree). More...

virtual SQLtoSQLPredicateTree * clone ()
 Recursively copies this node and all the nodes below it. More...

virtual std::string evaluate (std::vector< std::string > &pQueries)
 Returns the predicate (and possibly list of necessary subqueries) resulting of evaluating this node and all its descendants. More...


Detailed Description

This class implements a binary tree of nodes that stores a SQL "WHERE predicate", that can translate it to a new schema, and that can evaluate it, outputing a SQL string.

Each object is a node linked to its two children nodes (left and right). This class extends the SQLPredicateTree, and overloads the evaluate() method, so that the evaluation is expressed using SQL.

Author:
LCG's EIS Group. CERN.
Version:
1.0
Date:
2004.

Definition at line 22 of file SQLtoSQLPredicateTree.h.


Constructor & Destructor Documentation

SQLtoSQLPredicateTree::SQLtoSQLPredicateTree  
 

Constructor of the class.

It just creates an empty object.

Definition at line 16 of file SQLtoSQLPredicateTree.cpp.

Referenced by clone, and create.


Member Function Documentation

SQLtoSQLPredicateTree * SQLtoSQLPredicateTree::clone   [virtual]
 

Recursively copies this node and all the nodes below it.

The resulting object's dynamic type will be that of this class. It is a trick (similar to a virtual copy constructor) used to allow the recursive copy of the tree.

See also:
create
Returns:
a pointer to a new Predicate node with the same values as this node

Implements LcgInfo::SQLPredicateTree.

Definition at line 28 of file SQLtoSQLPredicateTree.cpp.

References create, LcgInfo::PredicateTree::depth, LcgInfo::PredicateTree::left, LcgInfo::PredicateTree::right, SQLtoSQLPredicateTree, LcgInfo::PredicateTree::type, and LcgInfo::PredicateTree::value.

SQLtoSQLPredicateTree * SQLtoSQLPredicateTree::create   [virtual]
 

Creates a new node of the type of this node (SQLtoSQLPredicateTree).

It uses some default values (in order to use a template, use the PredicateTree::clone() method). It is a trick (virtual constructor) used to allow the recursive creation of the tree when inserting predicates. It overloads a method of the SQLPredicaTree class.

Returns:
a pointer to a new SQLtoSQLPredicate node with default values

Implements LcgInfo::SQLPredicateTree.

Definition at line 24 of file SQLtoSQLPredicateTree.cpp.

References SQLtoSQLPredicateTree.

Referenced by clone.

string SQLtoSQLPredicateTree::evaluate std::vector< std::string > &    pQueries [virtual]
 

Returns the predicate (and possibly list of necessary subqueries) resulting of evaluating this node and all its descendants.

It just composes a global predicate ordering the predicates in an infix expression (SQL like). It may throw a QueryTranslationException if the node (or one of its children) cannot be parsed properly.

Parameters:
pQueries  to store the list of necessary subqueries (if any)
Returns:
resulting predicate

Implements LcgInfo::SQLPredicateTree.

Definition at line 49 of file SQLtoSQLPredicateTree.cpp.

References LcgInfo::PredicateTree::depth, LcgInfo::int2str, LcgInfo::PredicateTree::left, LcgInfo::nocaseCompare, LcgInfo::PredicateTree::right, LcgInfo::PredicateTree::type, and LcgInfo::PredicateTree::value.


The documentation for this class was generated from the following files:
Generated on Tue Oct 5 14:42:45 2004 for LCG Information System Interface by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002