1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_connectivity.hxx"
30 #include "file/FCatalog.hxx"
31 #include "file/fcomp.hxx"
32 #include "file/fanalyzer.hxx"
33 #include "file/FResultSet.hxx"
34 #include "file/FPreparedStatement.hxx"
35 #include <connectivity/FValue.hxx>
36 #include <tools/debug.hxx>
37 #include "TKeyValue.hxx"
38 #include <rtl/logfile.hxx>
39 
40 using namespace connectivity;
41 using namespace connectivity::file;
42 // -----------------------------------------------------------------------------
43 void OFileCatalog::refreshViews()
44 {}
45 void OFileCatalog::refreshGroups()
46 {}
47 void OFileCatalog::refreshUsers()
48 {
49 }
50 // -----------------------------------------------------------------------------
51 OPredicateInterpreter::~OPredicateInterpreter()
52 {
53 	while(!m_aStack.empty())
54 	{
55 		delete m_aStack.top();
56 		m_aStack.pop();
57 	}
58 	//	m_aStack.clear();
59 }
60 // -----------------------------------------------------------------------------
61 void OPredicateCompiler::Clean()
62 {
63 	for(OCodeList::reverse_iterator aIter = m_aCodeList.rbegin(); aIter != m_aCodeList.rend();++aIter)
64 	{
65 		delete *aIter;
66 	}
67 	m_aCodeList.clear();
68 }
69 // -----------------------------------------------------------------------------
70 void OSQLAnalyzer::clean()
71 {
72 	m_aCompiler->Clean();
73 }
74 // -----------------------------------------------------------------------------
75 void OSQLAnalyzer::bindParameterRow(OValueRefRow& _pRow)
76 {
77 	OCodeList& rCodeList	= m_aCompiler->m_aCodeList;
78 	for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end();++aIter)
79 	{
80 		OOperandParam* pParam = PTR_CAST(OOperandParam,(*aIter));
81 		if ( pParam )
82 			pParam->bindValue(_pRow);
83 	}
84 }
85 // -----------------------------------------------------------------------------
86 void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
87 {
88     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::scanParameter" );
89 	DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
90 
91 	// Parameter Name-Regel gefunden?
92 	if (SQL_ISRULE(pParseNode,parameter))
93 	{
94 		DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft");
95 		DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft");
96 
97 		_rParaNodes.push_back(pParseNode);
98 		// Weiterer Abstieg nicht erforderlich
99 		return;
100 	}
101 
102 	// Weiter absteigen im Parse Tree
103 	for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
104 		scanParameter(pParseNode->getChild(i),_rParaNodes);
105 }
106 // -----------------------------------------------------------------------------
107 OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow)
108 {
109     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::GetOrderbyKeyValue" );
110 	sal_uInt32 nBookmarkValue = Abs((sal_Int32)(_rRow->get())[0]->getValue());
111 
112 	OKeyValue* pKeyValue = OKeyValue::createKeyValue((sal_uInt32)nBookmarkValue);
113 
114 	::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
115 	for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
116 	{
117 		OSL_ENSURE(*aIter < static_cast<sal_Int32>(_rRow->get().size()),"Invalid index for orderkey values!");
118 		pKeyValue->pushKey(new ORowSetValueDecorator((_rRow->get())[*aIter]->getValue()));
119 	}
120 
121 	return pKeyValue;
122 }
123 // -----------------------------------------------------------------------------
124 
125 
126 
127 
128 
129 
130 
131 
132