diff options
-rw-r--r-- | connectivity/source/drivers/calc/CTable.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DResultSet.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 20 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/dindexnode.cxx | 39 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/makefile.mk | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 49 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fanalyzer.cxx | 49 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcode.cxx | 58 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcomp.cxx | 18 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/ETable.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/DResultSet.hxx | 5 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/dindexnode.hxx | 36 | ||||
-rw-r--r-- | connectivity/source/inc/file/FResultSet.hxx | 8 | ||||
-rw-r--r-- | connectivity/source/inc/file/fanalyzer.hxx | 19 | ||||
-rw-r--r-- | connectivity/source/inc/file/fcode.hxx | 26 | ||||
-rw-r--r-- | connectivity/source/inc/file/fcomp.hxx | 8 | ||||
-rw-r--r-- | connectivity/source/parse/sqliterator.cxx | 12 |
17 files changed, 193 insertions, 192 deletions
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 6c6e48fde37f..6b64ac6781ee 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CTable.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:41 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -708,14 +708,7 @@ void SAL_CALL OCalcTable::disposing(void) { OFileTable::disposing(); ::osl::MutexGuard aGuard(m_aMutex); -#ifdef DEBUG - for(OSQLColumns::const_iterator aIter = m_aColumns->begin();aIter != m_aColumns->end();++aIter) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp = *aIter; - xProp = NULL; - } -#endif - m_aColumns->clear(); + m_aColumns = NULL; } // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL OCalcTable::getTypes( ) throw(RuntimeException) diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx index 14a45466e2d4..e63ea8ddaccb 100644 --- a/connectivity/source/drivers/dbase/DResultSet.cxx +++ b/connectivity/source/drivers/dbase/DResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DResultSet.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,9 @@ #ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ #include "dbase/DIndexIter.hxx" #endif +#ifndef CONNECTIVITY_DBASE_DCODE_HXX +#include "dbase/DCode.hxx" +#endif using namespace connectivity::dbase; using namespace connectivity::file; @@ -241,6 +244,7 @@ sal_Bool ODbaseResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_x // m_bFileSetFrozen = sal_True; // if(!bDistinct) // SetRowCount(pFileSet->count()); + delete pIter; return sal_True; } delete pIter; @@ -260,7 +264,6 @@ cppu::IPropertyArrayHelper* ODbaseResultSet::createArrayHelper() const describeProperties(aProps); return new cppu::OPropertyArrayHelper(aProps); } -// ------------------------------------------------------------------------- // ----------------------------------------------------------------------------- void SAL_CALL ODbaseResultSet::acquire() throw(::com::sun::star::uno::RuntimeException) { @@ -277,5 +280,10 @@ void SAL_CALL ODbaseResultSet::release() throw(::com::sun::star::uno::RuntimeExc return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- +OSQLAnalyzer* ODbaseResultSet::createAnalyzer() +{ + return new OFILEAnalyzer(); +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 13e558aa902c..92ddf1fffd42 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.41 $ + * $Revision: 1.42 $ * - * last change: $Author: oj $ $Date: 2001-05-03 07:14:11 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -218,7 +218,7 @@ void ODbaseTable::fillColumns() m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); m_pFileStream->Seek(32L); - m_aColumns->clear(); + m_aColumns = new OSQLColumns(); m_aTypes.clear(); m_aPrecisions.clear(); m_aScales.clear(); @@ -494,8 +494,9 @@ void ODbaseTable::refreshColumns() aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName()); if(m_pColumns) - delete m_pColumns; - m_pColumns = new ODbaseColumns(this,m_aMutex,aVector); + m_pColumns->reFill(aVector); + else + m_pColumns = new ODbaseColumns(this,m_aMutex,aVector); } // ------------------------------------------------------------------------- void ODbaseTable::refreshIndexes() @@ -546,14 +547,7 @@ void SAL_CALL ODbaseTable::disposing(void) { OFileTable::disposing(); ::osl::MutexGuard aGuard(m_aMutex); -#ifdef DEBUG - for(OSQLColumns::const_iterator aIter = m_aColumns->begin();aIter != m_aColumns->end();++aIter) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp = *aIter; - xProp = NULL; - } -#endif - m_aColumns->clear(); + m_aColumns = NULL; } // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException) diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 92a320866853..28a7075aacd0 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dindexnode.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-04-30 13:38:23 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,39 @@ using namespace connectivity; using namespace connectivity::dbase; using namespace connectivity::file; using namespace com::sun::star::sdbc; +// ----------------------------------------------------------------------------- +ONDXKey::ONDXKey(UINT32 nRec) + :nRecord(nRec) +{ +} +// ----------------------------------------------------------------------------- +ONDXKey::ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec) + : ONDXKey_BASE(eType) + , nRecord(nRec) + , xValue(rVal) +{ +} +// ----------------------------------------------------------------------------- +ONDXKey::ONDXKey(const rtl::OUString& aStr, UINT32 nRec) + : ONDXKey_BASE(::com::sun::star::sdbc::DataType::VARCHAR) + ,nRecord(nRec) +{ + if (aStr.getLength()) + { + xValue = aStr; + xValue.setBound(sal_True); + } +} +// ----------------------------------------------------------------------------- + +ONDXKey::ONDXKey(double aVal, UINT32 nRec) + : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE) + ,nRecord(nRec) + ,xValue(aVal) +{ +} +// ----------------------------------------------------------------------------- + //================================================================== // Index Seite //================================================================== @@ -892,7 +925,7 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) aBuf.EraseTrailingChars(); // aKey = ONDXKey((aBuf,rIndex.GetDBFConnection()->GetCharacterSet()) ,aKey.nRecord); - aKey = ONDXKey((aBuf,rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord); + aKey = ONDXKey(::rtl::OUString(aBuf.GetBuffer(),aBuf.Len(),rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord); } rStream >> aChild; } diff --git a/connectivity/source/drivers/dbase/makefile.mk b/connectivity/source/drivers/dbase/makefile.mk index 025718d7d9fd..7830d605fb57 100644 --- a/connectivity/source/drivers/dbase/makefile.mk +++ b/connectivity/source/drivers/dbase/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.14 $ +# $Revision: 1.15 $ # -# last change: $Author: oj $ $Date: 2001-03-19 09:35:31 $ +# last change: $Author: oj $ $Date: 2001-05-07 10:37:51 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -78,6 +78,7 @@ ENVCFLAGS+=/FR$(SLO)$/ # --- Files ------------------------------------- SLOFILES=\ + $(SLO)$/DCode.obj \ $(SLO)$/DResultSet.obj \ $(SLO)$/DStatement.obj \ $(SLO)$/DPreparedStatement.obj \ diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index b3d624094d60..a4877e4d198f 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSet.cxx,v $ * - * $Revision: 1.47 $ + * $Revision: 1.48 $ * - * last change: $Author: oj $ $Date: 2001-05-03 07:14:12 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -121,6 +121,9 @@ #ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #endif +#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XIndexesSupplier.hpp> +#endif #include <algorithm> @@ -219,7 +222,8 @@ void OResultSet::disposing(void) m_xColumns = NULL; m_xParamColumns = NULL; - m_aSQLAnalyzer.dispose(); + if(m_pSQLAnalyzer) + m_pSQLAnalyzer->dispose(); if(m_pTable) { m_pTable->release(); @@ -237,8 +241,6 @@ void OResultSet::disposing(void) m_aInsertRow->clear(); if(m_aAssignValues.isValid()) m_aAssignValues->clear(); - if(m_xParamColumns.isValid()) - m_xParamColumns->clear(); m_aBookmarkToPos.clear(); } // ------------------------------------------------------------------------- @@ -729,8 +731,9 @@ sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeExcep // ------------------------------------------------------------------------- sal_Bool OResultSet::evaluate() { + OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::evaluate: Analyzer isn't set!"); sal_Bool bRet = sal_True; - while(!m_aSQLAnalyzer.evaluateRestriction()) + while(!m_pSQLAnalyzer->evaluateRestriction()) { if(m_pEvaluationKeySet) { @@ -1176,6 +1179,7 @@ BOOL OResultSet::ExecuteRow(OFileTable::FilePosition eFirstCursorPosition, BOOL bEvaluate, BOOL bRetrieveData) { + OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!"); // Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ... OFileTable::FilePosition eCursorPosition = eFirstCursorPosition; @@ -1208,8 +1212,8 @@ again: m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), sal_True,TRUE); if (m_aEvaluateRow->isDeleted() || - (m_aSQLAnalyzer.hasRestriction() && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Stzen - !m_aSQLAnalyzer.evaluateRestriction())) // Auswerten der Bedingungen + (m_pSQLAnalyzer->hasRestriction() && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Stzen + !m_pSQLAnalyzer->evaluateRestriction())) // Auswerten der Bedingungen { // naechsten Satz auswerten // aktuelle Zeile loeschen im Keyset OSL_ENSURE(!m_pFileSet || @@ -1947,6 +1951,7 @@ connectivity::file::OFILEKeyCompare(const void * elem1, const void * elem2) //------------------------------------------------------------------ BOOL OResultSet::OpenImpl() { + m_pSQLAnalyzer = createAnalyzer(); const OSQLTables& xTabs = m_aSQLIterator.getTables(); OSL_ENSURE(xTabs.begin() != xTabs.end(),"NO table in statement!"); @@ -1976,7 +1981,8 @@ BOOL OResultSet::OpenImpl() if(!m_xParamColumns.isValid()) m_xParamColumns = new OSQLColumns(); - m_aSQLAnalyzer.clean(); + OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::OpenImpl: Analyzer isn't set!"); + m_pSQLAnalyzer->clean(); Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTable,UNO_QUERY); if(xTunnel.is()) @@ -1986,13 +1992,16 @@ BOOL OResultSet::OpenImpl() m_pTable->acquire(); } OSL_ENSURE(m_pTable,"We need a table object!"); + Reference<XIndexesSupplier> xIndexSup(xTable,UNO_QUERY); + if(xIndexSup.is()) + m_pSQLAnalyzer->setIndexes(xIndexSup->getIndexes()); m_nResultSetConcurrency = (m_pTable->isReadOnly() || isCount()) ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE; GetAssignValues(); // assign values and describe parameter columns - m_aSQLAnalyzer.setParameterColumns(m_xParamColumns); + m_pSQLAnalyzer->setParameterColumns(m_xParamColumns); anylizeSQL(); if (m_xParamColumns->size()) - m_aSQLAnalyzer.describeParam(m_xParamColumns); + m_pSQLAnalyzer->describeParam(m_xParamColumns); sal_Int32 i=0; // initialize the column index map (mapping select columns to table columns) @@ -2028,7 +2037,7 @@ BOOL OResultSet::OpenImpl() if (m_aParameterRow.isValid() && nParaCount < m_aParameterRow->size()) { setBoundedColumns(m_aEvaluateRow,m_xParamColumns,xNames,sal_False); - m_aSQLAnalyzer.bindParameterRow(m_aParameterRow); + m_pSQLAnalyzer->bindParameterRow(m_aParameterRow); } } @@ -2042,7 +2051,7 @@ BOOL OResultSet::OpenImpl() // (*aEvaluateRow)[0] = new ODbVariant(); // Row zur Auswertung binden, wenn Preprocessing erfolg, dann bereits ein Keyset - m_pEvaluationKeySet = m_aSQLAnalyzer.bindResultRow(m_aEvaluateRow); // Werte im Code des Compilers setzen + m_pEvaluationKeySet = m_pSQLAnalyzer->bindResultRow(m_aEvaluateRow); // Werte im Code des Compilers setzen // (Verbindung zur ResultRow herstellen) } @@ -2165,7 +2174,7 @@ BOOL OResultSet::OpenImpl() // dabei den "Key", nach dem sortiert werden soll, in den Index eintragen: if (IsSorted()) { - if (!m_aSQLAnalyzer.hasRestriction() && m_nOrderbyColumnNumber[1] == SQL_COLUMN_NOTFOUND) + if (!m_pSQLAnalyzer->hasRestriction() && m_nOrderbyColumnNumber[1] == SQL_COLUMN_NOTFOUND) { // Ist nur ein Feld fuer die Sortierung angegeben // Und diese Feld ist indiziert, dann den Index ausnutzen @@ -2232,7 +2241,7 @@ BOOL OResultSet::OpenImpl() { m_pFileSet = new OKeySet(); - if (!m_aSQLAnalyzer.hasRestriction()) + if (!m_pSQLAnalyzer->hasRestriction()) // jetzt kann das Keyset schon gefuellt werden! // Aber Achtung: es wird davon ausgegangen, das die FilePositionen als Folge 1..n // abgelegt werden! @@ -2386,9 +2395,10 @@ BOOL OResultSet::OpenImpl() //------------------------------------------------------------------ void OResultSet::anylizeSQL() { + OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::anylizeSQL: Analyzer isn't set!"); // start analysing the statement - m_aSQLAnalyzer.setOrigColumns(m_xColNames); - m_aSQLAnalyzer.start(m_pParseTree); + m_pSQLAnalyzer->setOrigColumns(m_xColNames); + m_pSQLAnalyzer->start(m_pParseTree); const OSQLParseNode* pOrderbyClause = m_aSQLIterator.getOrderTree(); if(pOrderbyClause) @@ -3004,4 +3014,9 @@ void SAL_CALL OResultSet::release() throw(::com::sun::star::uno::RuntimeExceptio return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- +OSQLAnalyzer* OResultSet::createAnalyzer() +{ + return new OSQLAnalyzer(); +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index 84bf194e1eea..dc82271c06bd 100644 --- a/connectivity/source/drivers/file/fanalyzer.cxx +++ b/connectivity/source/drivers/file/fanalyzer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fanalyzer.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,20 +67,24 @@ #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ -#include <com/sun/star/container/XIndexAccess.hpp> -#endif #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif +//#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +//#include "file/FTable.hxx" +//#endif +#ifndef _CONNECTIVITY_SQLNODE_HXX +#include "connectivity/sqlnode.hxx" +#endif -using namespace connectivity; -using namespace connectivity::file; +using namespace ::connectivity; +using namespace ::connectivity::file; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; @@ -89,17 +93,23 @@ typedef ::std::list<OEvaluateSet*> OEvaluateSetList; OSQLAnalyzer::OSQLAnalyzer() : m_aCompiler(this) , m_aInterpreter(m_aCompiler) - // ,m_rCursor(rCurs) -{} +{ +} +// ----------------------------------------------------------------------------- +void OSQLAnalyzer::setIndexes(const Reference< XNameAccess>& _xIndexes) +{ + m_aCompiler.m_xIndexes = _xIndexes; +} //------------------------------------------------------------------ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) { - if (!pSQLParseNode) return; + if (!pSQLParseNode) + return; // Parse Tree analysieren (je nach Statement-Typ) // und Zeiger auf WHERE-Klausel setzen: - OSQLParseNode * pWhereClause = NULL; - OSQLParseNode * pOrderbyClause = NULL; + OSQLParseNode* pWhereClause = NULL; + OSQLParseNode* pOrderbyClause = NULL; if (SQL_ISRULE(pSQLParseNode,select_statement)) { @@ -183,13 +193,13 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode1)); } + pAttr->bindValue(_pRow); + if (pEvaluateSet) { aEvaluateSetList.push_back(pEvaluateSet); pEvaluateSet = NULL; } - else - pAttr->bindValue(_pRow); } } @@ -273,7 +283,7 @@ void OSQLAnalyzer::describeParam(::vos::ORef<OSQLColumns> rParameterColumns) OOperandAttr *pLeft = PTR_CAST(OOperandAttr,*(rCodeList.end() - 2)); if (pLeft) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCol; + Reference< XPropertySet> xCol; Reference< XIndexAccess>(m_aCompiler.getOrigColumns(),UNO_QUERY)->getByIndex(pLeft->getRowPos()) >>= xCol; OSL_ENSURE(xCol.is(), "Ungltige Struktur"); pParam->describe(xCol, aNewParamColumns); @@ -301,16 +311,13 @@ void OSQLAnalyzer::clean() m_aCompiler.Clean(); } // ----------------------------------------------------------------------------- -OOperandAttr* OSQLAnalyzer::createOperandAttr(sal_Int32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol) +OOperandAttr* OSQLAnalyzer::createOperandAttr(sal_Int32 _nPos, + const Reference< XPropertySet>& _xCol, + const Reference< XNameAccess>& _xIndexes) { return new OOperandAttr(_nPos,_xCol); } // ----------------------------------------------------------------------------- -OOperandAttr* OFILEAnalyzer::createOperandAttr(sal_Int32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol) -{ - return new OFILEOperandAttr(_nPos,_xCol); -} -// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 9b2abbd73b4c..2648f9eb6d8e 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fcode.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,19 +91,19 @@ #include "propertyids.hxx" #endif - using namespace connectivity; using namespace connectivity::file; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; TYPEINIT0(OCode); TYPEINIT1(OOperand, OCode); TYPEINIT1(OOperandRow, OOperand); TYPEINIT1(OOperandAttr, OOperandRow); -TYPEINIT1(OFILEOperandAttr, OOperandAttr); TYPEINIT1(OOperandParam, OOperandRow); TYPEINIT1(OOperandValue, OOperand); TYPEINIT1(OOperandConst, OOperandValue); @@ -170,40 +170,11 @@ OOperandAttr::OOperandAttr(sal_uInt16 _nPos,const Reference< XPropertySet>& _xCo , m_xColumn(_xColumn) { } -//------------------------------------------------------------------ -OFILEOperandAttr::OFILEOperandAttr(sal_uInt16 _nPos,const Reference< XPropertySet>& _xColumn) - :OOperandAttr(_nPos,_xColumn) -{ -} // ------------------------------------------------------------------------- -sal_Bool OFILEOperandAttr::isIndexed() const -{ - return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>(m_xColumn,::com::sun::star::uno::UNO_QUERY)->getPropertySetInfo()->hasPropertyByName(connectivity::file::PROPERTY_ISASCENDING); -} -//------------------------------------------------------------------ -OEvaluateSet* OFILEOperandAttr::preProcess(OBoolOperator* pOp, OOperand* pRight) +sal_Bool OOperandAttr::isIndexed() const { - OEvaluateSet* pEvaluateSet = NULL; - if (isIndexed()) - { - OSL_ENSURE(0,"TODO: OFILEOperandAttr::preProcess"); -// OFILEIndexIterator* pIter = pCol->GetIndex()->CreateIterator(pOp,pRight); -// -// if (pIter->Status().IsSuccessful()) -// { -// pEvaluateSet = new OEvaluateSet(); -// ULONG nRec = pIter->First(); -// while (nRec != SQL_INDEX_ENTRY_NOTFOUND) -// { -// pEvaluateSet->Insert(nRec); -// nRec = pIter->Next(); -// } -// } -// delete pIter; - } - return pEvaluateSet; + return sal_False; } - //------------------------------------------------------------------ OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) : OOperandRow(_nPos, DataType::VARCHAR) // Standard-Typ @@ -272,15 +243,16 @@ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUStrin switch (rColumnRef.getNodeType()) { case SQL_NODE_STRING: - m_aValue = aStrValue; - m_eDBType = DataType::VARCHAR; + m_aValue = aStrValue; + m_eDBType = DataType::VARCHAR; + m_aValue.setBound(sal_True); return; case SQL_NODE_INTNUM: case SQL_NODE_APPROXNUM: { - m_aValue = aStrValue.toDouble(); - - m_eDBType = DataType::DOUBLE; + m_aValue = aStrValue.toDouble(); + m_eDBType = DataType::DOUBLE; + m_aValue.setBound(sal_True); return; } } @@ -299,6 +271,7 @@ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUStrin { OSL_ASSERT("Parse Error"); } + m_aValue.setBound(sal_True); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -496,11 +469,6 @@ double OOp_DIV::operate(const double& fLeft,const double& fRight) const return fLeft / fRight; } // ----------------------------------------------------------------------------- -sal_Bool OOperandAttr::isIndexed() const -{ - return sal_False; -} -// ----------------------------------------------------------------------------- OEvaluateSet* OOperandAttr::preProcess(OBoolOperator* pOp, OOperand* pRight) { return NULL; diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 26e3253afbea..6dcb96c7dfbf 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fcomp.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,9 +109,9 @@ OPredicateCompiler::~OPredicateCompiler() void OPredicateCompiler::dispose() { Clean(); - m_orgColumns = NULL; - if(m_aParameterColumns.isValid()) - m_aParameterColumns->clear(); + m_orgColumns = NULL; + m_aParameterColumns = NULL; + m_xIndexes = NULL; } //------------------------------------------------------------------ // inline OCursor& OPredicateCompiler::Cursor() const {return m_rCursor;} @@ -466,10 +466,12 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCol; try { - if (m_orgColumns->getByName(aColumnName) >>= xCol) // Column existiert nicht im Resultset - pOperand = m_pAnalyzer->createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol); //new OOperandAttr(pCol); - else + if (m_orgColumns->getByName(aColumnName) >>= xCol) { + pOperand = m_pAnalyzer->createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol,m_xIndexes); + } + else + {// Column existiert nicht im Resultset ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement"),NULL); } } diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 4155e14856a5..6f475358903e 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ETable.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:43 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -602,7 +602,7 @@ void SAL_CALL OFlatTable::disposing(void) { OFileTable::disposing(); ::osl::MutexGuard aGuard(m_aMutex); - m_aColumns->clear(); + m_aColumns = NULL; } // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL OFlatTable::getTypes( ) throw(RuntimeException) diff --git a/connectivity/source/inc/dbase/DResultSet.hxx b/connectivity/source/inc/dbase/DResultSet.hxx index 0db320791da9..3a0a15b409bd 100644 --- a/connectivity/source/inc/dbase/DResultSet.hxx +++ b/connectivity/source/inc/dbase/DResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DResultSet.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:09:03 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,7 @@ namespace connectivity // OPropertySetHelper virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); virtual sal_Bool fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex); + virtual file::OSQLAnalyzer* createAnalyzer(); public: DECLARE_SERVICE_INFO(); diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx index 9313ed0a177a..11f34bed7dba 100644 --- a/connectivity/source/inc/dbase/dindexnode.hxx +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dindexnode.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:09:03 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,27 +92,11 @@ namespace connectivity ORowSetValue xValue; /* Schluesselwert */ public: - ONDXKey():nRecord(0){} - inline ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec) - : ONDXKey_BASE(eType) - , nRecord(nRec) - , xValue(rVal) - {} - ONDXKey(const rtl::OUString& aStr, UINT32 nRec = 0) - : ONDXKey_BASE(::com::sun::star::sdbc::DataType::VARCHAR) - ,nRecord(nRec) - { - if (aStr.len()) - xValue = aStr; - } - ONDXKey(double aVal, UINT32 nRec = 0) - : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE) - ,nRecord(nRec) - ,xValue(aVal) - { - } - ONDXKey(UINT32 nRec) - : nRecord(nRec){} + ONDXKey(UINT32 nRec=0); + ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec); + ONDXKey(const rtl::OUString& aStr, UINT32 nRec = 0); + ONDXKey(double aVal, UINT32 nRec = 0); + inline ONDXKey(const ONDXKey& rKey); inline ONDXKey& operator= (const ONDXKey& rKey); @@ -347,12 +331,16 @@ namespace connectivity inline ONDXKey::ONDXKey(const ONDXKey& rKey) : ONDXKey_BASE(rKey.getDBType()) - ,nRecord(rKey.nRecord),xValue(rKey.xValue) + ,nRecord(rKey.nRecord) + ,xValue(rKey.xValue) { } inline ONDXKey& ONDXKey::operator=(const ONDXKey& rKey) { + if(&rKey == this) + return *this; + xValue = rKey.xValue; nRecord = rKey.nRecord; m_eDBType = rKey.getDBType(); diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx index 3c409f73e422..ff6ab9754026 100644 --- a/connectivity/source/inc/file/FResultSet.hxx +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSet.hxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:56 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -275,7 +275,7 @@ OFILEKeyCompare(const void * elem1, const void * elem2); OFileTable* m_pTable; connectivity::OSQLParseNode* m_pParseTree; - OFILEAnalyzer m_aSQLAnalyzer; + OSQLAnalyzer* m_pSQLAnalyzer; connectivity::OSQLParseTreeIterator& m_aSQLIterator; sal_Int32 m_nFetchSize; @@ -344,6 +344,8 @@ OFILEKeyCompare(const void * elem1, const void * elem2); BOOL Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData); BOOL SkipDeleted(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData); + // create the analyzer + virtual OSQLAnalyzer* createAnalyzer(); virtual sal_Bool fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex) { return sal_False; } diff --git a/connectivity/source/inc/file/fanalyzer.hxx b/connectivity/source/inc/file/fanalyzer.hxx index 397d6d68a70f..0e80085528a7 100644 --- a/connectivity/source/inc/file/fanalyzer.hxx +++ b/connectivity/source/inc/file/fanalyzer.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fanalyzer.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:56 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,8 +75,6 @@ namespace connectivity OPredicateCompiler m_aCompiler; OPredicateInterpreter m_aInterpreter; - // OCursor& m_rCursor; - public: OSQLAnalyzer(); @@ -84,6 +82,8 @@ namespace connectivity ::std::vector<sal_Int32>* bindResultRow(OValueRow _pRow); // Anbinden einer Ergebniszeile an die Restrictions void bindParameterRow(OValueRow _pRow); // Anbinden einer Parameterzeile an die Restrictions + void setIndexes(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes); + void dispose() { m_aCompiler.dispose(); @@ -94,14 +94,9 @@ namespace connectivity BOOL evaluateRestriction() {return m_aInterpreter.start();} void setOrigColumns(const OFileColumns& rCols) { m_aCompiler.setOrigColumns(rCols); } void setParameterColumns(::vos::ORef< connectivity::OSQLColumns > _rParaCols) { m_aCompiler.setParameterColumns(_rParaCols); } - virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol); - }; - - class OFILEAnalyzer : public OSQLAnalyzer - { - public: - OFILEAnalyzer() : OSQLAnalyzer(){} - virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol); + virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes=NULL); }; } } diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx index 4e5907382b1d..8b884a177337 100644 --- a/connectivity/source/inc/file/fcode.hxx +++ b/connectivity/source/inc/file/fcode.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fcode.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:56 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,9 @@ #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> #endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include <com/sun/star/container/XIndexAccess.hpp> +#endif #ifndef _CONNECTIVITY_FILE_VALUE_HXX_ #include "FValue.hxx" #endif @@ -89,6 +92,10 @@ namespace connectivity { class OSQLParseNode; + namespace dbase + { + class ODbaseIndex; + } namespace file { @@ -152,7 +159,8 @@ namespace connectivity ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xColumn; public: - OOperandAttr(sal_uInt16 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn); + OOperandAttr(sal_uInt16 _nPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn); ~OOperandAttr() { m_xColumn = NULL; @@ -163,18 +171,6 @@ namespace connectivity TYPEINFO(); }; - // Attribute aus einer Ergebniszeile - class OFILEOperandAttr : public OOperandAttr - { - public: - OFILEOperandAttr(sal_uInt16 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn); - - virtual sal_Bool isIndexed() const; - virtual OEvaluateSet* preProcess(OBoolOperator* pOp, OOperand* pRight = 0); - TYPEINFO(); - }; - - // Parameter fr ein Prdikat class OOperandParam : public OOperandRow { diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx index 7dec066e600a..5486f23041ab 100644 --- a/connectivity/source/inc/file/fcomp.hxx +++ b/connectivity/source/inc/file/fcomp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fcomp.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-04-10 08:51:30 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,7 @@ namespace connectivity OFileColumns m_orgColumns; // in filecurs this are the filecolumns ::vos::ORef< connectivity::OSQLColumns> m_aParameterColumns; OSQLAnalyzer* m_pAnalyzer; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xIndexes; sal_Int32 m_nParamCounter; sal_Bool m_bORCondition; @@ -115,9 +116,6 @@ namespace connectivity OOperand* execute_LIKE(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); OOperand* execute_ISNULL(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); OOperand* execute_Operand(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - private: - // OCursor& Cursor() const; }; diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 95717200e8ff..95a20e492b0a 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sqliterator.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:55 $ + * last change: $Author: oj $ $Date: 2001-05-07 10:37:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -150,8 +150,8 @@ OSQLParseTreeIterator::~OSQLParseTreeIterator() void OSQLParseTreeIterator::dispose() { m_aTables.clear(); - m_aSelectColumns->clear(); - m_aParameters->clear(); + m_aSelectColumns = NULL; + m_aParameters = NULL; m_xTables = NULL; m_xDatabaseMetaData = NULL; m_pParser = NULL; @@ -161,8 +161,8 @@ void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) { m_aTables.clear(); - m_aSelectColumns->clear(); - m_aParameters->clear(); + m_aSelectColumns = new OSQLColumns(); + m_aParameters = new OSQLColumns(); m_pParseTree = pNewParseTree; if (!m_pParseTree) |