2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-05-23 08:18:28 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 07:59:37 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2008-04-10 07:59:37 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2008-04-10 07:59:37 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2008-04-10 07:59:37 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2008-04-10 07:59:37 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
2008-04-10 07:59:37 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-05-23 08:18:28 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 01:33:06 +00:00
|
|
|
|
2001-05-23 08:18:28 +00:00
|
|
|
#include "file/FCatalog.hxx"
|
|
|
|
#include "file/fcomp.hxx"
|
|
|
|
#include "file/fanalyzer.hxx"
|
|
|
|
#include "file/FResultSet.hxx"
|
2001-08-24 05:19:41 +00:00
|
|
|
#include "file/FPreparedStatement.hxx"
|
2007-06-27 13:06:26 +00:00
|
|
|
#include <connectivity/FValue.hxx>
|
2001-05-23 08:18:28 +00:00
|
|
|
#include <tools/debug.hxx>
|
2001-08-29 11:21:08 +00:00
|
|
|
#include "TKeyValue.hxx"
|
2009-04-23 10:42:05 +00:00
|
|
|
#include <rtl/logfile.hxx>
|
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
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
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
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::scanParameter" );
|
2001-05-23 08:18:28 +00:00
|
|
|
DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
|
|
|
|
|
2011-02-15 21:45:45 +01:00
|
|
|
// found parameter Name-Rule?
|
2001-05-23 08:18:28 +00:00
|
|
|
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);
|
2011-02-15 21:45:45 +01:00
|
|
|
// Further descend not nessesary
|
2001-05-23 08:18:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-02-15 21:45:45 +01:00
|
|
|
// Further descend in Parse Tree
|
2011-01-07 18:04:22 +01:00
|
|
|
for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
|
2001-05-23 08:18:28 +00:00
|
|
|
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
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::GetOrderbyKeyValue" );
|
2011-01-07 18:04:22 +01:00
|
|
|
sal_uInt32 nBookmarkValue = Abs((sal_Int32)(_rRow->get())[0]->getValue());
|
2001-05-23 08:18:28 +00:00
|
|
|
|
2011-01-07 18:04:22 +01:00
|
|
|
OKeyValue* pKeyValue = OKeyValue::createKeyValue((sal_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
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
OSL_ENSURE(*aIter < static_cast<sal_Int32>(_rRow->get().size()),"Invalid index for orderkey values!");
|
|
|
|
pKeyValue->pushKey(new ORowSetValueDecorator((_rRow->get())[*aIter]->getValue()));
|
2002-07-05 06:46:24 +00:00
|
|
|
}
|
2001-05-23 08:18:28 +00:00
|
|
|
|
|
|
|
return pKeyValue;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|