Tag: cws_src680_dba24d User: oj Date: 2007-11-21 12:38:43+0000 Modified: dba/connectivity/source/commontools/FValue.cxx dba/connectivity/source/commontools/TConnection.cxx dba/connectivity/source/commontools/TDatabaseMetaDataBase.cxx dba/connectivity/source/commontools/TPrivilegesResultSet.cxx dba/connectivity/source/commontools/makefile.mk
Log: #i68854# impl TypeSettingInfo for Oracle and some clean up File Changes: Directory: /dba/connectivity/source/commontools/ ================================================ File [changed]: FValue.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/FValue.cxx?r1=1.30&r2=1.30.152.1 Delta lines: +96 -4 -------------------- --- FValue.cxx 2006-09-17 01:58:37+0000 1.30 +++ FValue.cxx 2007-11-21 12:38:41+0000 1.30.152.1 @@ -4,9 +4,9 @@ * * $RCSfile: FValue.cxx,v $ * - * $Revision: 1.30 $ + * $Revision: 1.30.152.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 01:58:37 $ + * last change: $Author: oj $ $Date: 2007/11/21 12:38:41 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1843,4 +1843,96 @@ setNull(); setTypeKind(_nType); } +// ----------------------------------------------------------------------------- +void ORowSetValue::fill(const Any& _rValue) +{ + switch (_rValue.getValueType().getTypeClass()) + { + case TypeClass_VOID: + setNull(); + break; + case TypeClass_BOOLEAN: + { + sal_Bool bDummy; + _rValue >>= bDummy; + (*this) = bDummy; + break; + } + case TypeClass_CHAR: + { + sal_Unicode aDummy(0); + _rValue >>= aDummy; + (*this) = ::rtl::OUString(aDummy); + break; + } + case TypeClass_STRING: + { + ::rtl::OUString sDummy; + _rValue >>= sDummy; + (*this) = sDummy; + break; + } + case TypeClass_FLOAT: + { + float aDummy; + _rValue >>= aDummy; + (*this) = aDummy; + break; + } + case TypeClass_DOUBLE: + { + double aDummy; + _rValue >>= aDummy; + (*this) = aDummy; + break; + } + case TypeClass_BYTE: + { + sal_Int8 aDummy; + _rValue >>= aDummy; + (*this) = aDummy; + break; + } + case TypeClass_SHORT: + { + sal_Int16 aDummy; + _rValue >>= aDummy; + (*this) = aDummy; + break; + } + case TypeClass_LONG: + { + sal_Int32 aDummy; + _rValue >>= aDummy; + (*this) = aDummy; + break; + } + case TypeClass_UNSIGNED_SHORT: + { + sal_uInt16 aDummy; + _rValue >>= aDummy; + (*this) = static_cast<sal_Int32>(aDummy); + setSigned(sal_False); + break; + } + case TypeClass_UNSIGNED_LONG: + { + sal_uInt32 aDummy; + _rValue >>= aDummy; + (*this) = static_cast<sal_Int64>(aDummy); + setSigned(sal_False); + break; + } + case TypeClass_SEQUENCE: + { + Sequence<sal_Int8> aDummy; + if ( _rValue >>= aDummy ) + (*this) = aDummy; + break; + } + default: + OSL_ENSURE(0,"Unknown type"); + break; + } +} File [changed]: TConnection.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/TConnection.cxx?r1=1.7&r2=1.7.152.1 Delta lines: +23 -3 -------------------- --- TConnection.cxx 2006-09-17 01:59:05+0000 1.7 +++ TConnection.cxx 2007-11-21 12:38:41+0000 1.7.152.1 @@ -4,9 +4,9 @@ * * $RCSfile: TConnection.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.7.152.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 01:59:05 $ + * last change: $Author: oj $ $Date: 2007/11/21 12:38:41 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,12 +41,32 @@ #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> #endif +#include <comphelper/types.hxx> using namespace connectivity; using namespace com::sun::star::uno; using namespace com::sun::star::lang; +using namespace com::sun::star::sdbc; using namespace::osl; +//------------------------------------------------------------------------------ +void OMetaConnection::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + m_xMetaData = WeakReference< XDatabaseMetaData>(); + for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) + { + try + { + Reference< XInterface > xStatement( i->get() ); + ::comphelper::disposeComponent( xStatement ); + } + catch (DisposedException) + { + } + } + m_aStatements.clear(); +} //XUnoTunnel sal_Int64 SAL_CALL OMetaConnection::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException) { File [changed]: TDatabaseMetaDataBase.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/TDatabaseMetaDataBase.cxx?r1=1.6&r2=1.6.116.1 Delta lines: +179 -5 --------------------- --- TDatabaseMetaDataBase.cxx 2006-12-13 16:13:09+0000 1.6 +++ TDatabaseMetaDataBase.cxx 2007-11-21 12:38:41+0000 1.6.116.1 @@ -4,9 +4,9 @@ * * $RCSfile: TDatabaseMetaDataBase.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.6.116.1 $ * - * last change: $Author: kz $ $Date: 2006/12/13 16:13:09 $ + * last change: $Author: oj $ $Date: 2007/11/21 12:38:41 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -38,6 +38,9 @@ #ifndef _CONNECTIVITY_ODATABASEMETADATABASE_HXX_ #include "TDatabaseMetaDataBase.hxx" #endif +#include "RowFunctionParser.hxx" + +#include <comphelper/sequenceashashmap.hxx> #ifndef COMPHELPER_EVENTLISTENERHELPER_HXX #include <comphelper/evtlistenerhlp.hxx> #endif @@ -54,8 +57,9 @@ using namespace connectivity; -ODatabaseMetaDataBase::ODatabaseMetaDataBase(const Reference< XConnection >& _rxConnection) +ODatabaseMetaDataBase::ODatabaseMetaDataBase(const Reference< XConnection >& _rxConnection,const Sequence< PropertyValue >& _rInfo) : m_xConnection(_rxConnection) + ,m_aConnectionInfo(_rInfo) { osl_incrementInterlockedCount( &m_refCount ); { @@ -84,4 +88,174 @@ m_xConnection = NULL; m_xListenerHelper = NULL; } +// ----------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_aTypeInfoRows.empty() ) + { + Reference< XResultSet > xRet = impl_getTypeInfo_throw(); + Reference< XRow > xRow(xRet,UNO_QUERY); + ::comphelper::SequenceAsHashMap aMap(m_aConnectionInfo); + Sequence< Any > aTypeInfoSettings; + aTypeInfoSettings = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeInfoSettings")),aTypeInfoSettings); + if ( xRow.is() ) + { + static sal_Int32 pTypes[] = { + DataType::VARCHAR + ,DataType::INTEGER + ,DataType::INTEGER + ,DataType::VARCHAR + ,DataType::VARCHAR + ,DataType::VARCHAR + ,DataType::INTEGER + ,DataType::BOOLEAN + ,DataType::INTEGER + ,DataType::BOOLEAN + ,DataType::BOOLEAN + ,DataType::BOOLEAN + ,DataType::VARCHAR + ,DataType::INTEGER + ,DataType::INTEGER + ,DataType::INTEGER + ,DataType::INTEGER + ,DataType::INTEGER + }; + ::std::vector<ExpressionNodeSharedPtr> aConditions; + if ( aTypeInfoSettings.getLength() > 1 && ((aTypeInfoSettings.getLength() % 2) == 0) ) + { + const Any* pIter = aTypeInfoSettings.getConstArray(); + const Any* pEnd = pIter + aTypeInfoSettings.getLength(); + try + { + for(;pIter != pEnd;++pIter) + aConditions.push_back(FunctionParser::parseFunction(::comphelper::getString(*pIter))); + } + catch(ParseError&) + { + throw SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid Formula for TypeInfoSettings!")),*this,::rtl::OUString(),1000,Any()); + } + } + + while( xRet->next() ) + { + ::connectivity::ODatabaseMetaDataResultSet::ORow aRow; + aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); + sal_Int32* pType = pTypes; + for (sal_Int32 i = 1; i <= sizeof(pTypes)/sizeof(pTypes[0]); ++i,++pType) + { + ORowSetValue aValue; + aValue.fill(i,*pType,xRow); + aRow.push_back(new ORowSetValueDecorator(aValue)); + } + + ::std::vector<ExpressionNodeSharedPtr>::iterator aIter = aConditions.begin(); + ::std::vector<ExpressionNodeSharedPtr>::iterator aEnd = aConditions.end(); + for (; aIter != aEnd; ++aIter) + { + if ( (*aIter)->evaluate(aRow)->getValue().getBool() ) + { + ++aIter; + (*aIter)->fill(aRow); + } + else + ++aIter; + } + m_aTypeInfoRows.push_back(aRow); + } + } + } + ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); + Reference< XResultSet > xRet = pResult; + pResult->setRows(m_aTypeInfoRows); + return xRet; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getExportedKeys( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getImportedKeys( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getPrimaryKeys( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getIndexInfo( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/, + sal_Bool /*unique*/, sal_Bool /*approximate*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getBestRowIdentifier( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/, sal_Int32 /*scope*/, + sal_Bool /*nullable*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getCrossReference( + const Any& /*primaryCatalog*/, const ::rtl::OUString& /*primarySchema*/, + const ::rtl::OUString& /*primaryTable*/, const Any& /*foreignCatalog*/, + const ::rtl::OUString& /*foreignSchema*/, const ::rtl::OUString& /*foreignTable*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference ); +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODatabaseMetaDataBase::getConnection( ) throw(SQLException, RuntimeException) +{ + return m_xConnection; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getProcedureColumns( + const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, + const ::rtl::OUString& /*procedureNamePattern*/, const ::rtl::OUString& /*columnNamePattern*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getProcedures( + const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, + const ::rtl::OUString& /*procedureNamePattern*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getVersionColumns( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eVersionColumns ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getSchemas( ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getColumnPrivileges( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/, + const ::rtl::OUString& /*columnNamePattern*/ ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTablePrivileges( + const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& /*table*/) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getCatalogs( ) throw(SQLException, RuntimeException) +{ + return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs ); +} File [changed]: TPrivilegesResultSet.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/TPrivilegesResultSet.cxx?r1=1.5&r2=1.5.152.1 Delta lines: +5 -5 ------------------- --- TPrivilegesResultSet.cxx 2006-09-17 02:00:54+0000 1.5 +++ TPrivilegesResultSet.cxx 2007-11-21 12:38:41+0000 1.5.152.1 @@ -4,9 +4,9 @@ * * $RCSfile: TPrivilegesResultSet.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.5.152.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 02:00:54 $ + * last change: $Author: oj $ $Date: 2007/11/21 12:38:41 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,7 +52,8 @@ , const Any& catalog , const ::rtl::OUString& schemaPattern , const ::rtl::OUString& tableNamePattern) - : m_bResetValues(sal_True) + : ODatabaseMetaDataResultSet(eTablePrivileges) + , m_bResetValues(sal_True) { osl_incrementInterlockedCount( &m_refCount ); { @@ -77,7 +78,6 @@ { } - setTablePrivilegesMap(); ODatabaseMetaDataResultSet::ORows aRows; static ODatabaseMetaDataResultSet::ORow aRow(8); aRow[5] = new ORowSetValueDecorator(sUserWorkingFor); File [changed]: makefile.mk Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/makefile.mk?r1=1.31&r2=1.31.2.1 Delta lines: +4 -3 ------------------- --- makefile.mk 2007-11-01 14:49:32+0000 1.31 +++ makefile.mk 2007-11-21 12:38:41+0000 1.31.2.1 @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.31 $ +# $Revision: 1.31.2.1 $ # -# last change: $Author: hr $ $Date: 2007/11/01 14:49:32 $ +# last change: $Author: oj $ $Date: 2007/11/21 12:38:41 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -75,6 +75,7 @@ $(SLO)$/FValue.obj \ $(SLO)$/paramwrapper.obj \ $(SLO)$/statementcomposer.obj \ + $(SLO)$/RowFunctionParser.obj \ $(SLO)$/formattedcolumnvalue.obj SLOFILES=\ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
