diff options
Diffstat (limited to 'connectivity/source/drivers/file')
-rw-r--r-- | connectivity/source/drivers/file/FCatalog.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FDriver.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FPreparedStatement.cxx | 15 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 84 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FStatement.cxx | 39 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FTable.cxx | 35 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fanalyzer.cxx | 18 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcode.cxx | 115 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcomp.cxx | 134 |
9 files changed, 327 insertions, 135 deletions
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx index c8e3ee7149ec..f75f462eeaad 100644 --- a/connectivity/source/drivers/file/FCatalog.cxx +++ b/connectivity/source/drivers/file/FCatalog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FCatalog.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:21 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -154,5 +154,7 @@ Sequence< Type > SAL_CALL OFileCatalog::getTypes( ) throw(RuntimeException) return aRet; } // ----------------------------------------------------------------------------- - +void OFileCatalog::refreshViews(){} +void OFileCatalog::refreshGroups(){} +void OFileCatalog::refreshUsers(){} diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index c57c7d7fcd7f..ff571c25565c 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDriver.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-04-27 10:08:10 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -207,18 +207,12 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection return xTab; } -//------------------------------------------------------------------ -Any SAL_CALL OFileDriver::queryInterface( const Type & rType ) throw(RuntimeException) -{ - Any aRet = ::cppu::queryInterface(rType, static_cast<XDataDefinitionSupplier*>(this)); - if(aRet.hasValue()) - return aRet; - return ODriver_BASE::queryInterface(rType); -} // -------------------------------------------------------------------------------- Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { return getDataDefinitionByConnection(connect(url,info)); } +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index d6557a2d55be..21986788cf51 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FPreparedStatement.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-04-06 14:03:08 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -602,4 +602,15 @@ Reference<XResultSet> OPreparedStatement::initResultSet() return xRs; } // ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::acquire() throw(::com::sun::star::uno::RuntimeException) +{ + OStatement_BASE2::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::release() throw(::com::sun::star::uno::RuntimeException) +{ + OStatement_BASE2::release(); +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index e6f5f3ecf4d2..3292ea89cf61 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.45 $ + * $Revision: 1.46 $ * - * last change: $Author: fs $ $Date: 2001-04-19 07:07:28 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2831,6 +2831,37 @@ UINT32 OResultSet::AddParameter(OSQLParseNode * pParameter, const Reference<XPro m_xParamColumns->push_back(xParaColumn); return nParameter; } +// ----------------------------------------------------------------------------- +void OResultSet::describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable) +{ + Reference<XPropertySet> xProp; + if(SQL_ISRULE(_pNode,column_ref)) + { + ::rtl::OUString sColumnName,sTableRange; + m_aSQLIterator.getColumnRange(_pNode,sColumnName,sTableRange); + if(sColumnName.getLength()) + { + Reference<XNameAccess> xNameAccess = _xTable->getColumns(); + if(xNameAccess->hasByName(sColumnName)) + xNameAccess->getByName(sColumnName) >>= xProp;; + AddParameter(_pParameter,xProp); + } + } + else + AddParameter(_pParameter,xProp); +// else if(SQL_ISRULE(_pNode,num_value_exp)) +// { +// describeColumn(*aIter,_pNode->getChild(),_xTable); +// } +// else if(SQL_ISRULE(_pNode,term)) +// { +// describeColumn(*aIter,,_xTable); +// } +// else +// { +// describeColumn(*aIter,,_xTable); +// } +} // ------------------------------------------------------------------------- void OResultSet::describeParameter() { @@ -2840,22 +2871,27 @@ void OResultSet::describeParameter() { m_xParamColumns = new OSQLColumns(); const OSQLTables& xTabs = m_aSQLIterator.getTables(); - OSQLTable xTable = xTabs.begin()->second; - - ::rtl::OUString aTabName,aTmp,aColName,aParameterName; - ::std::vector< OSQLParseNode*>::iterator aIter = aParseNodes.begin(); - for(;aIter != aParseNodes.end();++aIter) + if(xTabs.size()) { - BOOL bNotFound(TRUE); - OSQLParseNode* pParseNode = *aIter; - pParseNode = pParseNode->getParent(); - pParseNode = pParseNode->getChild(0); - - m_aSQLIterator.getColumnRange(pParseNode,aColName,aTabName); - Reference<XPropertySet> xCol; - ::cppu::extractInterface(xCol,xTable->getColumns()->getByName(aColName)); - m_xParamColumns->push_back(xCol); + OSQLTable xTable = xTabs.begin()->second; + ::std::vector< OSQLParseNode*>::const_iterator aIter = aParseNodes.begin(); + for (;aIter != aParseNodes.end();++aIter ) + { + describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable); + } } + +// ::vos::ORef<OSQLColumns> xColumns = m_aSQLIterator.getParameters(); +// if(xColumns.isValid()) +// { +// OSL_ENSURE(aParseNodes.size() == xColumns->size(),"Not all parameters found!"); +// ::rtl::OUString aTabName,aColName,aParameterName; +// OSQLColumns::iterator aIter = xColumns->begin(); +// for(;aIter != xColumns->end();++aIter) +// { +// m_xParamColumns->push_back(*aIter); +// } +// } } } //------------------------------------------------------------------ @@ -2952,4 +2988,20 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, } } // ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +void SAL_CALL OResultSet::acquire() throw(::com::sun::star::uno::RuntimeException) +{ + OResultSet_BASE::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OResultSet::release() throw(::com::sun::star::uno::RuntimeException) +{ + OResultSet_BASE::release(); +} +// ----------------------------------------------------------------------------- +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index ba58aec6d262..aea96f370917 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FStatement.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-02-23 10:51:03 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -181,6 +181,11 @@ void OStatement_BASE2::disposing() dispose_ChildImpl(); OStatement_Base::disposing(); } +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::acquire() throw(::com::sun::star::uno::RuntimeException) +{ + OStatement_BASE::acquire(); +} //----------------------------------------------------------------------------- void SAL_CALL OStatement_BASE2::release() throw(RuntimeException) { @@ -404,6 +409,34 @@ OResultSet* OStatement::createResultSet() } // ------------------------------------------------------------------------- IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbc.driver.file.Statement","com.sun.star.sdbc.Statement"); +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement::acquire() throw(::com::sun::star::uno::RuntimeException) +{ + OStatement_BASE2::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement::release() throw(::com::sun::star::uno::RuntimeException) +{ + OStatement_BASE2::release(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::disposing(void) +{ + OStatement_BASE::disposing(); +} +// ----------------------------------------------------------------------------- +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); +} +// ----------------------------------------------------------------------------- +::com::sun::star::uno::Any SAL_CALL OStatement::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + return OStatement_BASE2::queryInterface( rType); +} +// ----------------------------------------------------------------------------- + } -}
\ No newline at end of file +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index 89e0a96870cf..e9e03bb38463 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FTable.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2000-12-06 15:48:47 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,7 @@ #include <com/sun/star/sdbc/ColumnValue.hpp> #endif +using namespace connectivity; using namespace connectivity::file; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -218,5 +219,35 @@ void OFileTable::FileClose() } } // ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +void SAL_CALL OFileTable::acquire() throw(::com::sun::star::uno::RuntimeException) +{ + OTable_TYPEDEF::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OFileTable::release() throw(::com::sun::star::uno::RuntimeException) +{ + OTable_TYPEDEF::release(); +} +// ----------------------------------------------------------------------------- +BOOL OFileTable::InsertRow(OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols) +{ + return sal_False; +} +// ----------------------------------------------------------------------------- +BOOL OFileTable::DeleteRow(const OSQLColumns& _rCols) +{ + return sal_False; +} +// ----------------------------------------------------------------------------- +BOOL OFileTable::UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols) +{ + return sal_False; +} +// ----------------------------------------------------------------------------- +void OFileTable::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& descriptor) +{ +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index bd0370d9b5b7..84bf194e1eea 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.7 $ + * $Revision: 1.8 $ * - * last change: $Author: jl $ $Date: 2001-03-20 16:49:26 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -274,7 +274,7 @@ void OSQLAnalyzer::describeParam(::vos::ORef<OSQLColumns> rParameterColumns) if (pLeft) { ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCol; - ::cppu::extractInterface(xCol,Reference< XIndexAccess>(m_aCompiler.getOrigColumns(),UNO_QUERY)->getByIndex(pLeft->getRowPos())); + Reference< XIndexAccess>(m_aCompiler.getOrigColumns(),UNO_QUERY)->getByIndex(pLeft->getRowPos()) >>= xCol; OSL_ENSURE(xCol.is(), "Ungltige Struktur"); pParam->describe(xCol, aNewParamColumns); } @@ -300,5 +300,17 @@ void OSQLAnalyzer::clean() { m_aCompiler.Clean(); } +// ----------------------------------------------------------------------------- +OOperandAttr* OSQLAnalyzer::createOperandAttr(sal_Int32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol) +{ + 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 cd2804bc147a..9b2abbd73b4c 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.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-04-10 08:51:14 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,16 +148,21 @@ void OOperandRow::bindValue(OValueRow _pRow) (*m_pRow)[m_nRowPos].setBound(sal_True); } // ----------------------------------------------------------------------------- -void OOperandRow::setValue(const ::com::sun::star::uno::Any& _rVal) +void OOperandRow::setValue(const ORowSetValue& _rVal) { OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->size(),"Invalid RowPos is >= vector.size()"); (*m_pRow)[m_nRowPos] = _rVal; } //------------------------------------------------------------------ -Any OOperandRow::getValue() const +ORowSetValue OOperandRow::getValue() const { OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->size(),"Invalid RowPos is >= vector.size()"); - return (*m_pRow)[m_nRowPos].makeAny(); + return (*m_pRow)[m_nRowPos]; +} +// ----------------------------------------------------------------------------- +void OOperandValue::setValue(const ORowSetValue& _rVal) +{ + m_aValue = _rVal; } //------------------------------------------------------------------ OOperandAttr::OOperandAttr(sal_uInt16 _nPos,const Reference< XPropertySet>& _xColumn) @@ -238,19 +243,25 @@ void OOperandParam::describe(const Reference< XPropertySet>& rColumn, ::vos::ORe Reference< XPropertySet> xColumn = (*rParameterColumns)[getRowPos()]; - xColumn->setPropertyValue(PROPERTY_TYPENAME,rColumn->getPropertyValue(PROPERTY_TYPENAME)); - xColumn->setPropertyValue(PROPERTY_DEFAULTVALUE,rColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)); - xColumn->setPropertyValue(PROPERTY_PRECISION,rColumn->getPropertyValue(PROPERTY_PRECISION)); - xColumn->setPropertyValue(PROPERTY_TYPE,rColumn->getPropertyValue(PROPERTY_TYPE)); - xColumn->setPropertyValue(PROPERTY_SCALE,rColumn->getPropertyValue(PROPERTY_SCALE)); - xColumn->setPropertyValue(PROPERTY_ISNULLABLE,rColumn->getPropertyValue(PROPERTY_ISNULLABLE)); - xColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT,rColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)); + try + { + xColumn->setPropertyValue(PROPERTY_TYPENAME,rColumn->getPropertyValue(PROPERTY_TYPENAME)); + xColumn->setPropertyValue(PROPERTY_DEFAULTVALUE,rColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)); + xColumn->setPropertyValue(PROPERTY_PRECISION,rColumn->getPropertyValue(PROPERTY_PRECISION)); + xColumn->setPropertyValue(PROPERTY_TYPE,rColumn->getPropertyValue(PROPERTY_TYPE)); + xColumn->setPropertyValue(PROPERTY_SCALE,rColumn->getPropertyValue(PROPERTY_SCALE)); + xColumn->setPropertyValue(PROPERTY_ISNULLABLE,rColumn->getPropertyValue(PROPERTY_ISNULLABLE)); + xColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT,rColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)); + } + catch(const Exception&) + { + } m_eDBType = getINT32(rColumn->getPropertyValue(PROPERTY_TYPE)); } //------------------------------------------------------------------ -Any OOperandValue::getValue() const +ORowSetValue OOperandValue::getValue() const { return m_aValue; } @@ -261,13 +272,13 @@ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUStrin switch (rColumnRef.getNodeType()) { case SQL_NODE_STRING: - m_aValue <<= aStrValue; + m_aValue = aStrValue; m_eDBType = DataType::VARCHAR; return; case SQL_NODE_INTNUM: case SQL_NODE_APPROXNUM: { - m_aValue <<= aStrValue.toDouble(); + m_aValue = aStrValue.toDouble(); m_eDBType = DataType::DOUBLE; return; @@ -276,12 +287,12 @@ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUStrin if (SQL_ISTOKEN(&rColumnRef,TRUE)) { - m_aValue <<= 1.0; + m_aValue = 1.0; m_eDBType = DataType::BIT; } else if (SQL_ISTOKEN(&rColumnRef,FALSE)) { - m_aValue <<= 0.0; + m_aValue = 0.0; m_eDBType = DataType::BIT; } else @@ -344,8 +355,8 @@ void OOp_ISNULL::Exec(OCodeStack& rCodeStack) //------------------------------------------------------------------ sal_Bool OOp_ISNULL::operate(const OOperand* pOperand, const OOperand*) const { - Any aRet(pOperand->getValue()); - return !aRet.hasValue(); + ORowSetValue aRet(pOperand->getValue()); + return aRet.isNull(); } //------------------------------------------------------------------ @@ -358,14 +369,14 @@ sal_Bool OOp_ISNOTNULL::operate(const OOperand* pOperand, const OOperand*) const sal_Bool OOp_LIKE::operate(const OOperand* pLeft, const OOperand* pRight) const { sal_Bool bMatch; - Any aLH(pLeft->getValue()); - Any aRH(pRight->getValue()); + ORowSetValue aLH(pLeft->getValue()); + ORowSetValue aRH(pRight->getValue()); - if (!aLH.hasValue() || !aRH.hasValue()) + if (aLH.isNull() || aRH.isNull()) bMatch = sal_False; else { - bMatch = match(getString(aRH), getString(aLH), cEscape); + bMatch = match(aRH.getString(), aLH.getString(), cEscape); } return bMatch; } @@ -379,13 +390,10 @@ sal_Bool OOp_NOTLIKE::operate(const OOperand* pLeft, const OOperand* pRight) con //------------------------------------------------------------------ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const { - Any aLH(pLeft->getValue()); - Any aRH(pRight->getValue()); + ORowSetValue aLH(pLeft->getValue()); + ORowSetValue aRH(pRight->getValue()); -// if (!aLH.hasValue() || !aRH.hasValue()) -// return TRUE; - - if (!aLH.hasValue() || !aRH.hasValue()) // if (!aLH.getValue() || !aRH.getValue()) + if (aLH.isNull() || aRH.isNull()) // if (!aLH.getValue() || !aRH.getValue()) return sal_False; sal_Bool bResult = sal_False; @@ -404,7 +412,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con static rtl::OLocale aLocale = rtl::OLocale::registerLocale(sLanguage, sCountry); - INT32 nRes = compareIgnoreCase(getString(aLH), getString(aRH), aLocale); + INT32 nRes = compareIgnoreCase(aLH, aRH, aLocale); switch(aPredicateType) { case SQL_PRED_EQUAL: bResult = (nRes == 0); break; @@ -428,9 +436,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con case DataType::DATE: case DataType::TIME: { - double n,m; - aLH >>= n; - aRH >>= m; + double n = aLH ,m = aRH; switch (aPredicateType) { @@ -446,8 +452,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con } } break; default: - DBG_ERROR("OFILECursor::ExecuteRow: Vergleich mit diesem Datentyp nicht implementiert"); - bResult = sal_False; + bResult = aLH == aRH; } return bResult; } @@ -461,21 +466,47 @@ void ONumOperator::Exec(OCodeStack& rCodeStack) OOperand *pLeft = rCodeStack.top(); rCodeStack.pop(); - rCodeStack.push(new OOperandResultNUM(operate(getDouble(pLeft->getValue()), getDouble(pRight->getValue())))); - if (IS_TYPE(OOperandResult,pLeft)) delete pLeft; - if (IS_TYPE(OOperandResult,pRight)) delete pRight; + rCodeStack.push(new OOperandResultNUM(operate(pLeft->getValue(), pRight->getValue()))); + if (IS_TYPE(OOperandResult,pLeft)) + delete pLeft; + if (IS_TYPE(OOperandResult,pRight)) + delete pRight; } //------------------------------------------------------------------ -double OOp_ADD::operate(double fLeft, double fRight) const {return fLeft + fRight;}; +double OOp_ADD::operate(const double& fLeft,const double& fRight) const +{ + return fLeft + fRight; +} //------------------------------------------------------------------ -double OOp_SUB::operate(double fLeft, double fRight) const {return fLeft - fRight;}; +double OOp_SUB::operate(const double& fLeft,const double& fRight) const +{ + return fLeft - fRight; +} //------------------------------------------------------------------ -double OOp_MUL::operate(double fLeft, double fRight) const {return fLeft * fRight;}; +double OOp_MUL::operate(const double& fLeft,const double& fRight) const +{ + return fLeft * fRight; +} //------------------------------------------------------------------ -double OOp_DIV::operate(double fLeft, double fRight) const {return fLeft / fRight;}; +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 1058b1ca3bf6..26e3253afbea 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.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-04-10 08:51:14 $ + * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -188,7 +188,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) { // Die Where Clause ist meistens optional, d. h. es koennte sich auch // um "optional_where_clause" handeln. - DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OFILECursor: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OPredicateCompiler: Fehler im Parse Tree"); } } @@ -218,7 +218,7 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) m_aCodeList.push_back(new OOp_AND()); else { - DBG_ERROR("OFILECursor: Fehler im Parse Tree"); + DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree"); } } else if (SQL_ISRULE(pPredicateNode,comparison_predicate)) @@ -233,6 +233,36 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) { execute_ISNULL(pPredicateNode); } + else if(SQL_ISRULE(pPredicateNode,num_value_exp)) + { + execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs + execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"+")) + { + m_aCodeList.push_back(new OOp_ADD()); + } + else if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"-")) + m_aCodeList.push_back(new OOp_SUB()); + else + { + DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); + } + } + else if(SQL_ISRULE(pPredicateNode,term)) + { + execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs + execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"*")) + { + m_aCodeList.push_back(new OOp_MUL()); + } + else if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"/")) + m_aCodeList.push_back(new OOp_DIV()); + else + { + DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); + } + } else pOperand = execute_Operand(pPredicateNode); // jetzt werden nur einfache Operanden verarbeitet @@ -284,44 +314,42 @@ OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) th // wenn es sich um eine Vergleichsoperation auf datum/Zeit handelt, dann // erfolgt jetzt bereits eine Umwandlung fuer die Konstante - if (pOb) - { - switch (pPredicateNode->getChild(2)->getNodeType()) - { - case SQL_NODE_STRING: - { - OOperandConst* pConst = PTR_CAST(OOperandConst,m_aCodeList[m_aCodeList.size() - 2]); - switch (pOb->getDBType()) - { - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::REAL: - case DataType::DOUBLE: - case DataType::TIMESTAMP: - case DataType::DATE: - case DataType::TIME: - { - try - { - ::rtl::OUString aVal; - pConst->getValue() >>= aVal; - pConst->setValue(makeAny(aVal.toDouble())); - } - catch( Exception&) - { - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); - } - } break; - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - case DataType::BIT: - ; - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); - } - } - } - } +// if (pOb) +// { +// switch (pPredicateNode->getChild(2)->getNodeType()) +// { +// case SQL_NODE_STRING: +// { +// OOperandConst* pConst = PTR_CAST(OOperandConst,m_aCodeList[m_aCodeList.size() - 2]); +// switch (pOb->getDBType()) +// { +// case DataType::DECIMAL: +// case DataType::NUMERIC: +// case DataType::REAL: +// case DataType::DOUBLE: +// case DataType::TIMESTAMP: +// case DataType::DATE: +// case DataType::TIME: +// { +// try +// { +// pConst->setValue(makeAny(pConst->getValue().getDouble())); +// } +// catch( Exception&) +// { +// ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); +// } +// } break; +// case DataType::TINYINT: +// case DataType::SMALLINT: +// case DataType::INTEGER: +// case DataType::BIT: +// ; +// ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); +// } +// } +// } +// } return NULL; } @@ -485,18 +513,16 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr { pOperand = new OOperandConst(*pODBCNode->getChild(1), pODBCNode->getChild(1)->getTokenValue()); - // setting the Date - try - { - ::rtl::OUString aVal; - pOperand->getValue() >>= aVal; - pOperand->setValue(makeAny(aVal.toDouble())); - } - catch( Exception & ) - { - OSL_ENSURE(0,"OPredicateCompiler::execute_Operand Exception"); - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); - } +// // setting the Date +// try +// { +// pOperand->setValue(makeAny(pOperand->getValue().getDouble())); +// } +// catch( Exception & ) +// { +// OSL_ENSURE(0,"OPredicateCompiler::execute_Operand Exception"); +// ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); +// } } else ; |