version 1.1.2.10, 2004/10/22 15:08:01
|
version 1.1.2.11, 2004/10/31 16:02:00
|
|
|
| |
#include "QueryContext.h" | #include "QueryContext.h" |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
|
#include <Pegasus/CQL/CQLChainedIdentifier.h> |
| |
#include <iostream> | #include <iostream> |
| |
|
|
QueryContext::QueryContext(const QueryContext& ctx) | QueryContext::QueryContext(const QueryContext& ctx) |
:_NS(ctx._NS), | :_NS(ctx._NS), |
_AliasClassTable(ctx._AliasClassTable), | _AliasClassTable(ctx._AliasClassTable), |
_fromList(ctx._fromList) |
_fromList(ctx._fromList), |
|
_whereList(ctx._whereList) |
{ | { |
| |
} | } |
|
|
_NS = rhs._NS; | _NS = rhs._NS; |
_fromList = rhs._fromList; | _fromList = rhs._fromList; |
_AliasClassTable = rhs._AliasClassTable; | _AliasClassTable = rhs._AliasClassTable; |
|
_whereList = rhs._whereList; |
| |
return *this; | return *this; |
} | } |
|
|
} | } |
} | } |
| |
|
void QueryContext::addWhereIdentifier(const CQLChainedIdentifier& inIdentifier) |
|
{ |
|
// If the identifier is already in the list then don't append. |
|
for (Uint32 i = 0; i < _whereList.size(); i++) |
|
{ |
|
if (inIdentifier.size() == _whereList[i].size()) |
|
{ |
|
Array<CQLIdentifier> subsWhere = _whereList[i].getSubIdentifiers(); |
|
Array<CQLIdentifier> subsIn = inIdentifier.getSubIdentifiers(); |
|
Boolean match = true; |
|
for (Uint32 j = 0; j < subsWhere.size(); j++) |
|
{ |
|
if (subsIn[j] != subsWhere[j]) |
|
{ |
|
match = false; |
|
} |
|
} |
|
|
|
if (match) |
|
return; |
|
} |
|
} |
|
|
|
_whereList.append(inIdentifier); |
|
} |
|
|
|
Array<CQLChainedIdentifier> QueryContext::getWhereList() |
|
{ |
|
return _whereList; |
|
} |
|
|
CQLIdentifier QueryContext::findClass(const String& inAlias) const | CQLIdentifier QueryContext::findClass(const String& inAlias) const |
{ | { |
// look for alias match | // look for alias match |
|
|
| |
void QueryContext::clear(){ | void QueryContext::clear(){ |
_fromList.clear(); | _fromList.clear(); |
|
_whereList.clear(); |
_AliasClassTable.clear(); | _AliasClassTable.clear(); |
} | } |
| |