2001-05-23 08:18:28 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 04:55:54 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2005-09-08 04:55:54 +00:00
|
|
|
* $RCSfile: FNoException.cxx,v $
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2006-01-12 15:59:05 +00:00
|
|
|
* $Revision: 1.9 $
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2006-01-12 15:59:05 +00:00
|
|
|
* last change: $Author: rt $ $Date: 2006-01-12 16:59:05 $
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2005-09-08 04:55:54 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 04:55:54 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2005-09-08 04:55:54 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2005-09-08 04:55:54 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2005-09-08 04:55:54 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_
|
|
|
|
#include "file/FCatalog.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _CONNECTIVITY_FILE_FCOMP_HXX_
|
|
|
|
#include "file/fcomp.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_
|
|
|
|
#include "file/fanalyzer.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _CONNECTIVITY_FILE_FRESULTSET_HXX_
|
|
|
|
#include "file/FResultSet.hxx"
|
|
|
|
#endif
|
2001-08-24 05:19:41 +00:00
|
|
|
#ifndef _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_
|
|
|
|
#include "file/FPreparedStatement.hxx"
|
|
|
|
#endif
|
2001-05-23 08:18:28 +00:00
|
|
|
#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
|
|
|
|
#include "FValue.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
2001-08-29 11:21:08 +00:00
|
|
|
#ifndef CONNECTIVITY_TKEYVALUE_HXX
|
|
|
|
#include "TKeyValue.hxx"
|
|
|
|
#endif
|
2001-05-23 08:18:28 +00:00
|
|
|
|
|
|
|
using namespace connectivity;
|
|
|
|
using namespace connectivity::file;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OFileCatalog::refreshViews()
|
|
|
|
{}
|
|
|
|
void OFileCatalog::refreshGroups()
|
|
|
|
{}
|
|
|
|
void OFileCatalog::refreshUsers()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
OPredicateInterpreter::~OPredicateInterpreter()
|
|
|
|
{
|
|
|
|
while(!m_aStack.empty())
|
|
|
|
{
|
|
|
|
delete m_aStack.top();
|
|
|
|
m_aStack.pop();
|
|
|
|
}
|
|
|
|
// m_aStack.clear();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OPredicateCompiler::Clean()
|
|
|
|
{
|
|
|
|
for(OCodeList::reverse_iterator aIter = m_aCodeList.rbegin(); aIter != m_aCodeList.rend();++aIter)
|
|
|
|
{
|
|
|
|
delete *aIter;
|
|
|
|
}
|
2006-01-12 15:59:05 +00:00
|
|
|
m_aCodeList.clear();
|
2001-05-23 08:18:28 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OSQLAnalyzer::clean()
|
|
|
|
{
|
2003-09-04 07:25:04 +00:00
|
|
|
m_aCompiler->Clean();
|
2001-05-23 08:18:28 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2003-09-04 07:25:04 +00:00
|
|
|
void OSQLAnalyzer::bindParameterRow(OValueRefRow& _pRow)
|
2001-05-23 08:18:28 +00:00
|
|
|
{
|
2003-09-04 07:25:04 +00:00
|
|
|
OCodeList& rCodeList = m_aCompiler->m_aCodeList;
|
2001-05-23 08:18:28 +00:00
|
|
|
for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end();++aIter)
|
|
|
|
{
|
|
|
|
OOperandParam* pParam = PTR_CAST(OOperandParam,(*aIter));
|
2003-09-04 07:25:04 +00:00
|
|
|
if ( pParam )
|
2001-05-23 08:18:28 +00:00
|
|
|
pParam->bindValue(_pRow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool OResultSet::isCount() const
|
|
|
|
{
|
|
|
|
return (m_pParseTree &&
|
2003-03-19 15:38:50 +00:00
|
|
|
m_pParseTree->count() > 2 &&
|
|
|
|
SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) &&
|
|
|
|
SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) &&
|
|
|
|
SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) &&
|
|
|
|
m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4
|
2001-05-23 08:18:28 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-08-24 05:19:41 +00:00
|
|
|
void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
|
2001-05-23 08:18:28 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
|
|
|
|
|
|
|
|
// Parameter Name-Regel gefunden?
|
|
|
|
if (SQL_ISRULE(pParseNode,parameter))
|
|
|
|
{
|
|
|
|
DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft");
|
|
|
|
DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft");
|
|
|
|
|
|
|
|
_rParaNodes.push_back(pParseNode);
|
|
|
|
// Weiterer Abstieg nicht erforderlich
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Weiter absteigen im Parse Tree
|
|
|
|
for (UINT32 i = 0; i < pParseNode->count(); i++)
|
|
|
|
scanParameter(pParseNode->getChild(i),_rParaNodes);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2003-09-04 07:25:04 +00:00
|
|
|
OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow)
|
2001-05-23 08:18:28 +00:00
|
|
|
{
|
2003-09-04 07:25:04 +00:00
|
|
|
UINT32 nBookmarkValue = Abs((sal_Int32)(*_rRow)[0]->getValue());
|
2001-05-23 08:18:28 +00:00
|
|
|
|
2002-07-04 05:39:26 +00:00
|
|
|
OKeyValue* pKeyValue = OKeyValue::createKeyValue((UINT32)nBookmarkValue);
|
2001-08-29 11:21:08 +00:00
|
|
|
|
|
|
|
::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
|
|
|
|
for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
|
2002-07-05 06:46:24 +00:00
|
|
|
{
|
2003-09-04 07:25:04 +00:00
|
|
|
OSL_ENSURE(*aIter < static_cast<sal_Int32>(_rRow->size()),"Invalid index for orderkey values!");
|
|
|
|
pKeyValue->pushKey(new ORowSetValueDecorator((*_rRow)[*aIter]->getValue()));
|
2002-07-05 06:46:24 +00:00
|
|
|
}
|
2001-05-23 08:18:28 +00:00
|
|
|
|
|
|
|
return pKeyValue;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|