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

LcgInfo::SQLtoLDAPPredicateTree Class Reference

This class implements a binary tree of nodes that stores a SQL "WHERE predicate". More...

#include <SQLtoLDAPPredicateTree.h>

Inheritance diagram for LcgInfo::SQLtoLDAPPredicateTree:

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

Public Methods

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

virtual ~SQLtoLDAPPredicateTree ()
 Destructor of the class.

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

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

virtual std::string evaluate (std::vector< std::string > &pQueries)
 Returns a vector of strings with the predicate that would result of the evaluation this node and all its descendents (last position), and all the necessary intermediate ldapsearch calls that would be needed to complete the predicate. More...


Detailed Description

This class implements a binary tree of nodes that stores a SQL "WHERE predicate".

Each object is a node linked to its two children nodes (left and right). This class extends the PredicateTree, and overloads the evaluate() and translate() methods, so that the first returns a query in SQL-format and the second one makes the appropriate table.row name translations and adds the necessary AND sub-predicates.

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

Definition at line 24 of file SQLtoLDAPPredicateTree.h.


Constructor & Destructor Documentation

SQLtoLDAPPredicateTree::SQLtoLDAPPredicateTree  
 

Constructor of the class.

It just creates an empty object.

Definition at line 14 of file SQLtoLDAPPredicateTree.cpp.

Referenced by clone, and create.


Member Function Documentation

SQLtoLDAPPredicateTree * SQLtoLDAPPredicateTree::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 25 of file SQLtoLDAPPredicateTree.cpp.

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

SQLtoLDAPPredicateTree * SQLtoLDAPPredicateTree::create   [virtual]
 

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

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 SQLtoLDAPPredicate node with default values

Implements LcgInfo::SQLPredicateTree.

Definition at line 21 of file SQLtoLDAPPredicateTree.cpp.

References SQLtoLDAPPredicateTree.

Referenced by clone.

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

Returns a vector of strings with the predicate that would result of the evaluation this node and all its descendents (last position), and all the necessary intermediate ldapsearch calls that would be needed to complete the predicate.

The results of one query in position "n" should be included in another query as indicated by the macro "n#", which can be escaped by using "\" before the "#". It composes a global predicate ordering the predicates in a prefix expression for BOOLEAN nodes and an infix one for COMPARISON nodes (LDAP like). It may throw a QueryTranslationException if the node (or one of its children) cannot be parsed properly.

Parameters:
pQueries  necessary intermediate ldapsearches
Returns:
LDAP predicate represented by this node

Implements LcgInfo::SQLPredicateTree.

Definition at line 46 of file SQLtoLDAPPredicateTree.cpp.

References LcgInfo::PredicateTree::depth, LcgInfo::int2str, LcgInfo::isLiteral, LcgInfo::isNumber, 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