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