1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9b5730f6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9b5730f6SAndrew Rist * distributed with this work for additional information
6*9b5730f6SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9b5730f6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist * with the License. You may obtain a copy of the License at
10*9b5730f6SAndrew Rist *
11*9b5730f6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*9b5730f6SAndrew Rist *
13*9b5730f6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist * KIND, either express or implied. See the License for the
17*9b5730f6SAndrew Rist * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist * under the License.
19*9b5730f6SAndrew Rist *
20*9b5730f6SAndrew Rist *************************************************************/
21*9b5730f6SAndrew Rist
22*9b5730f6SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir #include "file/FCatalog.hxx"
27cdf0e10cSrcweir #include "file/fcomp.hxx"
28cdf0e10cSrcweir #include "file/fanalyzer.hxx"
29cdf0e10cSrcweir #include "file/FResultSet.hxx"
30cdf0e10cSrcweir #include "file/FPreparedStatement.hxx"
31cdf0e10cSrcweir #include <connectivity/FValue.hxx>
32cdf0e10cSrcweir #include <tools/debug.hxx>
33cdf0e10cSrcweir #include "TKeyValue.hxx"
34cdf0e10cSrcweir #include <rtl/logfile.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir using namespace connectivity;
37cdf0e10cSrcweir using namespace connectivity::file;
38cdf0e10cSrcweir // -----------------------------------------------------------------------------
refreshViews()39cdf0e10cSrcweir void OFileCatalog::refreshViews()
40cdf0e10cSrcweir {}
refreshGroups()41cdf0e10cSrcweir void OFileCatalog::refreshGroups()
42cdf0e10cSrcweir {}
refreshUsers()43cdf0e10cSrcweir void OFileCatalog::refreshUsers()
44cdf0e10cSrcweir {
45cdf0e10cSrcweir }
46cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OPredicateInterpreter()47cdf0e10cSrcweir OPredicateInterpreter::~OPredicateInterpreter()
48cdf0e10cSrcweir {
49cdf0e10cSrcweir while(!m_aStack.empty())
50cdf0e10cSrcweir {
51cdf0e10cSrcweir delete m_aStack.top();
52cdf0e10cSrcweir m_aStack.pop();
53cdf0e10cSrcweir }
54cdf0e10cSrcweir // m_aStack.clear();
55cdf0e10cSrcweir }
56cdf0e10cSrcweir // -----------------------------------------------------------------------------
Clean()57cdf0e10cSrcweir void OPredicateCompiler::Clean()
58cdf0e10cSrcweir {
59cdf0e10cSrcweir for(OCodeList::reverse_iterator aIter = m_aCodeList.rbegin(); aIter != m_aCodeList.rend();++aIter)
60cdf0e10cSrcweir {
61cdf0e10cSrcweir delete *aIter;
62cdf0e10cSrcweir }
63cdf0e10cSrcweir m_aCodeList.clear();
64cdf0e10cSrcweir }
65cdf0e10cSrcweir // -----------------------------------------------------------------------------
clean()66cdf0e10cSrcweir void OSQLAnalyzer::clean()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir m_aCompiler->Clean();
69cdf0e10cSrcweir }
70cdf0e10cSrcweir // -----------------------------------------------------------------------------
bindParameterRow(OValueRefRow & _pRow)71cdf0e10cSrcweir void OSQLAnalyzer::bindParameterRow(OValueRefRow& _pRow)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir OCodeList& rCodeList = m_aCompiler->m_aCodeList;
74cdf0e10cSrcweir for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end();++aIter)
75cdf0e10cSrcweir {
76cdf0e10cSrcweir OOperandParam* pParam = PTR_CAST(OOperandParam,(*aIter));
77cdf0e10cSrcweir if ( pParam )
78cdf0e10cSrcweir pParam->bindValue(_pRow);
79cdf0e10cSrcweir }
80cdf0e10cSrcweir }
81cdf0e10cSrcweir // -----------------------------------------------------------------------------
scanParameter(OSQLParseNode * pParseNode,::std::vector<OSQLParseNode * > & _rParaNodes)82cdf0e10cSrcweir void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::scanParameter" );
85cdf0e10cSrcweir DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
86cdf0e10cSrcweir
87cdf0e10cSrcweir // Parameter Name-Regel gefunden?
88cdf0e10cSrcweir if (SQL_ISRULE(pParseNode,parameter))
89cdf0e10cSrcweir {
90cdf0e10cSrcweir DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft");
91cdf0e10cSrcweir DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft");
92cdf0e10cSrcweir
93cdf0e10cSrcweir _rParaNodes.push_back(pParseNode);
94cdf0e10cSrcweir // Weiterer Abstieg nicht erforderlich
95cdf0e10cSrcweir return;
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
98cdf0e10cSrcweir // Weiter absteigen im Parse Tree
99cdf0e10cSrcweir for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
100cdf0e10cSrcweir scanParameter(pParseNode->getChild(i),_rParaNodes);
101cdf0e10cSrcweir }
102cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetOrderbyKeyValue(OValueRefRow & _rRow)103cdf0e10cSrcweir OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow)
104cdf0e10cSrcweir {
105cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::GetOrderbyKeyValue" );
106cdf0e10cSrcweir sal_uInt32 nBookmarkValue = Abs((sal_Int32)(_rRow->get())[0]->getValue());
107cdf0e10cSrcweir
108cdf0e10cSrcweir OKeyValue* pKeyValue = OKeyValue::createKeyValue((sal_uInt32)nBookmarkValue);
109cdf0e10cSrcweir
110cdf0e10cSrcweir ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
111cdf0e10cSrcweir for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
112cdf0e10cSrcweir {
113cdf0e10cSrcweir OSL_ENSURE(*aIter < static_cast<sal_Int32>(_rRow->get().size()),"Invalid index for orderkey values!");
114cdf0e10cSrcweir pKeyValue->pushKey(new ORowSetValueDecorator((_rRow->get())[*aIter]->getValue()));
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
117cdf0e10cSrcweir return pKeyValue;
118cdf0e10cSrcweir }
119cdf0e10cSrcweir // -----------------------------------------------------------------------------
120cdf0e10cSrcweir
121cdf0e10cSrcweir
122cdf0e10cSrcweir
123cdf0e10cSrcweir
124cdf0e10cSrcweir
125cdf0e10cSrcweir
126cdf0e10cSrcweir
127cdf0e10cSrcweir
128