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

LcgInfo::SQLQueryTranslator Class Reference

This class (actually, extending ones, since this is not instantiable) is used to translate a query posed to a canonical relational schema into a new query that can be posed to an equivalent schema (i.e.: containing the same actual information), in order to retrieve the same information. More...

#include <SQLQueryTranslator.h>

Inheritance diagram for LcgInfo::SQLQueryTranslator:

LcgInfo::QueryTranslator LcgInfo::SQLtoLDAPQueryTranslator LcgInfo::SQLtoSQLQueryTranslator List of all members.

Public Methods

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

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

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

virtual ~SQLQueryTranslator ()
 Destructor of the class.

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

void translateSemantic (std::string const &pQueryCanonical, SQLPredicateTree &pPred, std::vector< std::string > &pRowsToReturn, std::set< std::string > &pNewTableList)
 Makes the semantic translation of the specified query (intended to be posed to the canonical schema). More...


Static Protected Attributes

std::string const CHARS_TO_DIVIDE_SQL_WORDS = "\t ,"
std::string const CHARS_POSSIBLY_ESCAPED = "%"

Detailed Description

This class (actually, extending ones, since this is not instantiable) is used to translate a query posed to a canonical relational schema into a new query that can be posed to an equivalent schema (i.e.: containing the same actual information), in order to retrieve the same information.

The equivalent schema is mapped to the canonical one using a mapping file (whose syntax must conform to that defined in ...) The query language used to express the original query must be SQL and the one for the resulting query will be defined in classes extending this one. For instance a SQLtoLDAPQueryTranslator would implement the virtual methods here defined for the SQL query language as input an LDAP query language as output.

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

Definition at line 32 of file SQLQueryTranslator.h.


Constructor & Destructor Documentation

SQLQueryTranslator::SQLQueryTranslator  
 

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 16 of file SQLQueryTranslator.cpp.

SQLQueryTranslator::SQLQueryTranslator 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 20 of file SQLQueryTranslator.cpp.

SQLQueryTranslator::SQLQueryTranslator 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 24 of file SQLQueryTranslator.cpp.


Member Function Documentation

virtual std::vector<std::string> LcgInfo::SQLQueryTranslator::translateQuery std::string const &    pQueryCanonical [pure virtual]
 

Translates the specified query (intended to be posed to the canonical schema) into some new queries that can be posed to the implementation specific schema (in order) to retrieve the same information.

Several queries may be needed for cases where the output language does not support joins. In that case, queries refer to the results of the other by "n#", where "n" is the query number. It may throw a QueryTranslationException if there are problems parsing the specified predicate

Parameters:
pQueryCanonical  the query to be translated
Returns:
the resulting translated queries

Implements LcgInfo::QueryTranslator.

Implemented in LcgInfo::SQLtoLDAPQueryTranslator.

void SQLQueryTranslator::translateSemantic std::string const &    pQueryCanonical,
SQLPredicateTree   pPred,
std::vector< std::string > &    pRowsToReturn,
std::set< std::string > &    pNewTableList
 

Makes the semantic translation of the specified query (intended to be posed to the canonical schema).

It alters some parameter variables, so that the translateQuery() method can complete the query translation (adding the syntactic one, if applicable). It may throw a QueryTranslationException if there are problems parsing the specified predicate

See also:
translateQuery
Parameters:
pQueryCanonical  the query to be translated
pPred  reference to store the translated predicate tree
pRowsToReturn  list of rows to be returned (SELECT part of the query)
pNewTableList  list of tables to complete the talbe.row names (FROM part of the query)

Definition at line 31 of file SQLQueryTranslator.cpp.

References LcgInfo::escapeLiterals, LcgInfo::extractTable, LcgInfo::int2str, LcgInfo::QueryTranslator::mTRowT, LcgInfo::nocaseCompare, LcgInfo::tokenizeStrWithIndices, and LcgInfo::unescapeLiterals.

Referenced by LcgInfo::SQLtoSQLQueryTranslator::translateQuery, and LcgInfo::SQLtoLDAPQueryTranslator::translateQuery.


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