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

LcgInfo::SQLtoLDAPQueryTranslator Class Reference

This class implements the translation from a original SQL query to a LDAP one. More...

#include <SQLtoLDAPQueryTranslator.h>

Inheritance diagram for LcgInfo::SQLtoLDAPQueryTranslator:

LcgInfo::SQLQueryTranslator LcgInfo::QueryTranslator List of all members.

Public Methods

 SQLtoLDAPQueryTranslator ()
 Constructor using "./mappingGlueRMA" as the default name for the mapfile. More...

 SQLtoLDAPQueryTranslator (std::string const &pMapFile)
 Constructor passing the name of the file that has to be used for the mapping. More...

 SQLtoLDAPQueryTranslator (LcgConfigBuffer::ConfigBuffer &pMap)
 Constructor passing a reference to the already existing LcgConfigBuffer::ConfigBuffer object that is used for the mapping. More...

virtual ~SQLtoLDAPQueryTranslator ()
 Destructor of the class.

virtual std::vector< std::string > translateQuery (std::string const &pQueryCanonical)
 Translates the specified SQL query (intended to be posed to the canonical schema) into a vector of LDAP queries that can be posed to the implementation specific schema in order to retrieve the same information. More...


Static Protected Attributes

std::string const CHARS_TO_DIVIDE_LDAP_WORDS = " \t=><()!"
 Used to tokenize a resulting LDAP query.


Detailed Description

This class implements the translation from a original SQL query to a LDAP one.

In the translation process, several intermediate LDAP queries may be performed (in order to emulate SQL joins), and so, the class needs access to the LDAP interface. This class extends the more general, but abstract, SQLQueryTranslator class.

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

Definition at line 24 of file SQLtoLDAPQueryTranslator.h.


Constructor & Destructor Documentation

SQLtoLDAPQueryTranslator::SQLtoLDAPQueryTranslator  
 

Constructor using "./mappingGlueRMA" as the default name for the mapfile.

It may throw a QueryTranslationException if the specified mapping file cannot be loaded. Please do not use this constructor.

Definition at line 15 of file SQLtoLDAPQueryTranslator.cpp.

SQLtoLDAPQueryTranslator::SQLtoLDAPQueryTranslator std::string const &    pMapFile
 

Constructor passing the name of the file that has to be used for the mapping.

It may throw a QueryTranslationException if the specified mapping file cannot be loaded.

Parameters:
pMapFile  the name of the mapping file

Definition at line 19 of file SQLtoLDAPQueryTranslator.cpp.

SQLtoLDAPQueryTranslator::SQLtoLDAPQueryTranslator LcgConfigBuffer::ConfigBuffer   pMap
 

Constructor passing a reference to the already existing LcgConfigBuffer::ConfigBuffer object that is used for the mapping.

Using this constructor implies that the LcgConfigBuffer::ConfigBuffer object was instantiated externally, and it requires that it does not go out of scope.

Parameters:
pMap  a reference to the LcgConfigBuffer::ConfigBuffer object used for the mapping

Definition at line 23 of file SQLtoLDAPQueryTranslator.cpp.


Member Function Documentation

vector< string > SQLtoLDAPQueryTranslator::translateQuery std::string const &    pQueryCanonical [virtual]
 

Translates the specified SQL query (intended to be posed to the canonical schema) into a vector of LDAP queries that can be posed to the implementation specific schema in order to retrieve the same information.

Queries can refer to the results of other queries by specifying "n#", where "n" is the query number (if several values are retrieved by a subquery, it is the first one that can be used by others). The last element of the vector is not a query, but a list of results that have been requested as return values of the query (SELECT part of the SQL query). This list is a comma separated subqueries number list. The first result of a subquery (all but the last one) is included as result only if the number is in the list. All the other results (including all of the last one) are always included. It may throw a QueryTranslationException if the specified query cannot be parsed or translated properly.

Parameters:
pQueryCanonical  the query to be translated
Returns:
the resulting translated queries and the list of values to be returned

Implements LcgInfo::SQLQueryTranslator.

Definition at line 30 of file SQLtoLDAPQueryTranslator.cpp.

References LcgInfo::extractRow, LcgInfo::extractTable, LcgInfo::int2str, LcgInfo::tokenizeStrWithIndices, and LcgInfo::SQLQueryTranslator::translateSemantic.


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