diff options
author | Ocke Janssen <oj@openoffice.org> | 2000-10-24 14:00:32 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2000-10-24 14:00:32 +0000 |
commit | 1a6409f91bbce418d86782a4676b151ead67277b (patch) | |
tree | a0b6cb82743e48db1d7d86309e3f935f74ce2b03 | |
parent | 40d70bdcec85a57cfafc26238daac84d84a1b2ad (diff) |
make strings unique for lib's
-rw-r--r-- | connectivity/source/commontools/CommonTools.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/commontools/dbconversion.cxx | 21 | ||||
-rw-r--r-- | connectivity/source/commontools/dbexception.cxx | 87 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools.cxx | 447 |
4 files changed, 331 insertions, 229 deletions
diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx index 5b08052c20eb..cc4606cae587 100644 --- a/connectivity/source/commontools/CommonTools.cxx +++ b/connectivity/source/commontools/CommonTools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CommonTools.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-11 10:43:13 $ + * last change: $Author: oj $ $Date: 2000-10-24 15:00:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #endif #include <stdio.h> +#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools #ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ #include "propertyids.hxx" #endif diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index 22b0c679a0c3..c547bfaf2153 100644 --- a/connectivity/source/commontools/dbconversion.cxx +++ b/connectivity/source/commontools/dbconversion.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbconversion.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2000-10-19 11:46:15 $ + * last change: $Author: oj $ $Date: 2000-10-24 15:00:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,7 +119,7 @@ void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant, const ::rtl::OUString& rString, sal_Int32 nKey, sal_Int16 nFieldType, - sal_Int16 nKeyType) throw(starlang::IllegalArgumentException) + sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException) { double fValue = 0; if (rString.len()) @@ -176,9 +176,9 @@ void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant, { switch (nFieldType) { - case starsdbc::DataType::CHAR: - case starsdbc::DataType::VARCHAR: - case starsdbc::DataType::LONGVARCHAR: + case ::com::sun::star::sdbc::DataType::CHAR: + case ::com::sun::star::sdbc::DataType::VARCHAR: + case ::com::sun::star::sdbc::DataType::LONGVARCHAR: xVariant->updateString(rString); break; default: @@ -191,7 +191,7 @@ void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant, void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant, const Date& rNullDate, const double& rValue, - sal_Int16 nKeyType) throw(starlang::IllegalArgumentException) + sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException) { switch (nKeyType & ~NumberFormat::DEFINED) { @@ -228,9 +228,9 @@ double DBTypeConversion::getValue(const Reference<XColumn>& xVariant, } } //------------------------------------------------------------------------------ -::rtl::OUString DBTypeConversion::getValue(const Reference<starbeans::XPropertySet>& _xColumn, +::rtl::OUString DBTypeConversion::getValue(const Reference< ::com::sun::star::beans::XPropertySet>& _xColumn, const Reference<XNumberFormatter>& _xFormatter, - const starlang::Locale& _rLocale, + const ::com::sun::star::lang::Locale& _rLocale, const Date& _rNullDate) { sal_Int32 nKey; @@ -632,6 +632,9 @@ Date DBTypeConversion::getNULLDate(const Reference< XNumberFormatsSupplier > &xS /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.2 2000/10/19 11:46:15 oj + * remove tools from dbtools + * * Revision 1.1 2000/10/05 08:50:32 fs * moved the files from unotools to here * diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx index 37d4b6dfd949..07d291160c0a 100644 --- a/connectivity/source/commontools/dbexception.cxx +++ b/connectivity/source/commontools/dbexception.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbexception.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: fs $ $Date: 2000-10-05 08:50:41 $ + * last change: $Author: oj $ $Date: 2000-10-24 15:00:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,14 +62,25 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> #endif - #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif - #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif +#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_ +#include <com/sun/star/sdb/SQLContext.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +#include <com/sun/star/sdbc/SQLWarning.hpp> +#endif +#ifndef _COM_SUN_STAR_SDB_SQLERROREVENT_HPP_ +#include <com/sun/star/sdb/SQLErrorEvent.hpp> +#endif +#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif using namespace comphelper; @@ -78,6 +89,7 @@ namespace dbtools { //......................................................................... + using namespace connectivity::dbtools; //============================================================================== //= SQLExceptionInfo - encapsulating the type info of an SQLException-derived class //============================================================================== @@ -88,21 +100,21 @@ SQLExceptionInfo::SQLExceptionInfo() } //------------------------------------------------------------------------------ -SQLExceptionInfo::SQLExceptionInfo(const starsdbc::SQLException& _rError) +SQLExceptionInfo::SQLExceptionInfo(const ::com::sun::star::sdbc::SQLException& _rError) { m_aContent <<= _rError; implDetermineType(); } //------------------------------------------------------------------------------ -SQLExceptionInfo::SQLExceptionInfo(const starsdbc::SQLWarning& _rError) +SQLExceptionInfo::SQLExceptionInfo(const ::com::sun::star::sdbc::SQLWarning& _rError) { m_aContent <<= _rError; implDetermineType(); } //------------------------------------------------------------------------------ -SQLExceptionInfo::SQLExceptionInfo(const starsdb::SQLContext& _rError) +SQLExceptionInfo::SQLExceptionInfo(const ::com::sun::star::sdb::SQLContext& _rError) { m_aContent <<= _rError; implDetermineType(); @@ -116,9 +128,9 @@ SQLExceptionInfo::SQLExceptionInfo(const SQLExceptionInfo& _rCopySource) } //------------------------------------------------------------------------------ -SQLExceptionInfo::SQLExceptionInfo(const starsdb::SQLErrorEvent& _rError) +SQLExceptionInfo::SQLExceptionInfo(const ::com::sun::star::sdb::SQLErrorEvent& _rError) { - const staruno::Type& aSQLExceptionType = ::getCppuType(reinterpret_cast<starsdbc::SQLException*>(NULL)); + const staruno::Type& aSQLExceptionType = ::getCppuType(reinterpret_cast< ::com::sun::star::sdbc::SQLException*>(NULL)); staruno::Type aReasonType = _rError.Reason.getValueType(); sal_Bool bValid = isAssignableFrom(aSQLExceptionType, aReasonType); @@ -132,7 +144,7 @@ SQLExceptionInfo::SQLExceptionInfo(const starsdb::SQLErrorEvent& _rError) //------------------------------------------------------------------------------ SQLExceptionInfo::SQLExceptionInfo(const staruno::Any& _rError) { - const staruno::Type& aSQLExceptionType = ::getCppuType(reinterpret_cast<starsdbc::SQLException*>(NULL)); + const staruno::Type& aSQLExceptionType = ::getCppuType(reinterpret_cast< ::com::sun::star::sdbc::SQLException*>(NULL)); sal_Bool bValid = isAssignableFrom(aSQLExceptionType, _rError.getValueType()); if (bValid) m_aContent = _rError; @@ -145,11 +157,11 @@ SQLExceptionInfo::SQLExceptionInfo(const staruno::Any& _rError) void SQLExceptionInfo::implDetermineType() { staruno::Type aContentType = m_aContent.getValueType(); - if (isA(aContentType, static_cast<starsdb::SQLContext*>(NULL))) + if (isA(aContentType, static_cast< ::com::sun::star::sdb::SQLContext*>(NULL))) m_eType = SQL_CONTEXT; - else if (isA(aContentType, static_cast<starsdbc::SQLWarning*>(NULL))) + else if (isA(aContentType, static_cast< ::com::sun::star::sdbc::SQLWarning*>(NULL))) m_eType = SQL_WARNING; - else if (isA(aContentType, static_cast<starsdbc::SQLException*>(NULL))) + else if (isA(aContentType, static_cast< ::com::sun::star::sdbc::SQLException*>(NULL))) m_eType = SQL_EXCEPTION; else m_eType = UNDEFINED; @@ -173,24 +185,24 @@ sal_Bool SQLExceptionInfo::isKindOf(TYPE _eType) const } //------------------------------------------------------------------------------ -SQLExceptionInfo::operator const starsdbc::SQLException*() const +SQLExceptionInfo::operator const ::com::sun::star::sdbc::SQLException*() const { OSL_ENSHURE(isKindOf(SQL_EXCEPTION), "SQLExceptionInfo::operator SQLException* : invalid call !"); - return reinterpret_cast<const starsdbc::SQLException*>(m_aContent.getValue()); + return reinterpret_cast<const ::com::sun::star::sdbc::SQLException*>(m_aContent.getValue()); } //------------------------------------------------------------------------------ -SQLExceptionInfo::operator const starsdbc::SQLWarning*() const +SQLExceptionInfo::operator const ::com::sun::star::sdbc::SQLWarning*() const { OSL_ENSHURE(isKindOf(SQL_WARNING), "SQLExceptionInfo::operator SQLException* : invalid call !"); - return reinterpret_cast<const starsdbc::SQLWarning*>(m_aContent.getValue()); + return reinterpret_cast<const ::com::sun::star::sdbc::SQLWarning*>(m_aContent.getValue()); } //------------------------------------------------------------------------------ -SQLExceptionInfo::operator const starsdb::SQLContext*() const +SQLExceptionInfo::operator const ::com::sun::star::sdb::SQLContext*() const { OSL_ENSHURE(isKindOf(SQL_CONTEXT), "SQLExceptionInfo::operator SQLException* : invalid call !"); - return reinterpret_cast<const starsdb::SQLContext*>(m_aContent.getValue()); + return reinterpret_cast<const ::com::sun::star::sdb::SQLContext*>(m_aContent.getValue()); } //============================================================================== @@ -198,7 +210,7 @@ SQLExceptionInfo::operator const starsdb::SQLContext*() const //============================================================================== //------------------------------------------------------------------------------ -SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const starsdbc::SQLException* _pStart, NODES_INCLUDED _eMask) +SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const ::com::sun::star::sdbc::SQLException* _pStart, NODES_INCLUDED _eMask) :m_pCurrent(_pStart) ,m_eCurrentType(SQLExceptionInfo::SQL_EXCEPTION) // no other chance without RTTI @@ -210,7 +222,7 @@ SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const starsdbc::SQLExcept } //------------------------------------------------------------------------------ -SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const starsdbc::SQLWarning* _pStart, NODES_INCLUDED _eMask) +SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const ::com::sun::star::sdbc::SQLWarning* _pStart, NODES_INCLUDED _eMask) :m_pCurrent(_pStart) ,m_eCurrentType(SQLExceptionInfo::SQL_WARNING) // no other chance without RTTI @@ -222,7 +234,7 @@ SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const starsdbc::SQLWarnin } //------------------------------------------------------------------------------ -SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const starsdb::SQLContext* _pStart, NODES_INCLUDED _eMask) +SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const ::com::sun::star::sdb::SQLContext* _pStart, NODES_INCLUDED _eMask) :m_pCurrent(_pStart) ,m_eCurrentType(SQLExceptionInfo::SQL_CONTEXT) // no other chance without RTTI @@ -234,18 +246,18 @@ SQLExceptionIteratorHelper::SQLExceptionIteratorHelper(const starsdb::SQLContext } //------------------------------------------------------------------------------ -const starsdbc::SQLException* SQLExceptionIteratorHelper::next() +const ::com::sun::star::sdbc::SQLException* SQLExceptionIteratorHelper::next() { OSL_ENSHURE(hasMoreElements(), "SQLExceptionIteratorHelper::next : invalid call (please use hasMoreElements) !"); - const starsdbc::SQLException* pReturn = m_pCurrent; + const ::com::sun::star::sdbc::SQLException* pReturn = m_pCurrent; if (m_pCurrent) { // check for the next element within the chain - const staruno::Type& aSqlExceptionCompare = ::getCppuType(reinterpret_cast<starsdbc::SQLException*>(NULL)); - const staruno::Type& aSqlWarningCompare = ::getCppuType(reinterpret_cast<starsdbc::SQLWarning*>(NULL)); - const staruno::Type& aSqlContextCompare = ::getCppuType(reinterpret_cast<starsdb::SQLContext*>(NULL)); + const staruno::Type& aSqlExceptionCompare = ::getCppuType(reinterpret_cast< ::com::sun::star::sdbc::SQLException*>(NULL)); + const staruno::Type& aSqlWarningCompare = ::getCppuType(reinterpret_cast< ::com::sun::star::sdbc::SQLWarning*>(NULL)); + const staruno::Type& aSqlContextCompare = ::getCppuType(reinterpret_cast< ::com::sun::star::sdb::SQLContext*>(NULL)); - const starsdbc::SQLException* pSearch = m_pCurrent; + const ::com::sun::star::sdbc::SQLException* pSearch = m_pCurrent; SQLExceptionInfo::TYPE eSearchType = m_eCurrentType; sal_Bool bIncludeThis = sal_False; @@ -271,17 +283,17 @@ const starsdbc::SQLException* SQLExceptionIteratorHelper::next() switch (eSearchType) { case SQLExceptionInfo::SQL_CONTEXT: - pSearch = reinterpret_cast<const starsdb::SQLContext*>(pSearch->NextException.getValue()); + pSearch = reinterpret_cast<const ::com::sun::star::sdb::SQLContext*>(pSearch->NextException.getValue()); bIncludeThis = eSearchType >= NI_CONTEXTINFOS; break; case SQLExceptionInfo::SQL_WARNING: - pSearch = reinterpret_cast<const starsdbc::SQLWarning*>(pSearch->NextException.getValue()); + pSearch = reinterpret_cast<const ::com::sun::star::sdbc::SQLWarning*>(pSearch->NextException.getValue()); bIncludeThis = eSearchType >= NI_WARNINGS; break; case SQLExceptionInfo::SQL_EXCEPTION: - pSearch = reinterpret_cast<const starsdbc::SQLException*>(pSearch->NextException.getValue()); + pSearch = reinterpret_cast<const ::com::sun::star::sdbc::SQLException*>(pSearch->NextException.getValue()); bIncludeThis = eSearchType >= NI_EXCEPTIONS; break; @@ -298,6 +310,16 @@ const starsdbc::SQLException* SQLExceptionIteratorHelper::next() return pReturn; } +using namespace ::com::sun::star::uno; +//============================================================ +//= FunctionSequenceException +//============================================================ +FunctionSequenceException::FunctionSequenceException(const Reference< XInterface >& _Context, const Any& _Next) + :SQLException(ERRORMSG_SEQUENCE, + _Context, + SQLSTATE_SEQUENCE, 0, + _Next){}; + //......................................................................... } // namespace dbtools @@ -307,6 +329,9 @@ const starsdbc::SQLException* SQLExceptionIteratorHelper::next() /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.1 2000/10/05 08:50:41 fs + * moved the files from unotools to here + * * * Revision 1.0 29.09.00 08:17:11 fs ************************************************************************/ diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 1f5894860cad..d747f56923b2 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbtools.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: fs $ $Date: 2000-10-05 08:50:51 $ + * last change: $Author: oj $ $Date: 2000-10-24 15:00:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -124,10 +124,25 @@ #ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_ #include <com/sun/star/sdb/XQueriesSupplier.hpp> #endif - +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_ +#include <com/sun/star/sdb/SQLContext.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_ +#include <com/sun/star/sdbc/XRowSet.hpp> +#endif + using namespace ::comphelper; //......................................................................... @@ -135,19 +150,16 @@ namespace dbtools { //......................................................................... - namespace starsdbcx = ::com::sun::star::sdbcx; - namespace starform = ::com::sun::star::form; - //============================================================================== //============================================================================== //------------------------------------------------------------------ -sal_Int32 getDefaultNumberFormat(const staruno::Reference< starbeans::XPropertySet >& _xColumn, - const staruno::Reference< starutil::XNumberFormatTypes >& _xTypes, - const starlang::Locale& _rLocale) +sal_Int32 getDefaultNumberFormat(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes, + const ::com::sun::star::lang::Locale& _rLocale) { OSL_ENSHURE(_xTypes.is() && _xColumn.is(), "dbtools::getDefaultNumberFormat: invalid arg !"); if (!_xTypes.is() || !_xColumn.is()) - return starutil::NumberFormat::UNDEFINED; + return ::com::sun::star::util::NumberFormat::UNDEFINED; sal_Int32 nDataType; try @@ -157,39 +169,39 @@ sal_Int32 getDefaultNumberFormat(const staruno::Reference< starbeans::XPropertyS } catch (...) { - return starutil::NumberFormat::UNDEFINED; + return ::com::sun::star::util::NumberFormat::UNDEFINED; } sal_Int32 nFormat; switch (nDataType) { - case starsdbc::DataType::BIT: - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::LOGICAL, _rLocale); + case ::com::sun::star::sdbc::DataType::BIT: + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::LOGICAL, _rLocale); break; - case starsdbc::DataType::TINYINT: - case starsdbc::DataType::SMALLINT: - case starsdbc::DataType::INTEGER: - case starsdbc::DataType::BIGINT: - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::NUMBER, _rLocale); + case ::com::sun::star::sdbc::DataType::TINYINT: + case ::com::sun::star::sdbc::DataType::SMALLINT: + case ::com::sun::star::sdbc::DataType::INTEGER: + case ::com::sun::star::sdbc::DataType::BIGINT: + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::NUMBER, _rLocale); break; - case starsdbc::DataType::FLOAT: - case starsdbc::DataType::REAL: - case starsdbc::DataType::DOUBLE: - case starsdbc::DataType::NUMERIC: - case starsdbc::DataType::DECIMAL: + case ::com::sun::star::sdbc::DataType::FLOAT: + case ::com::sun::star::sdbc::DataType::REAL: + case ::com::sun::star::sdbc::DataType::DOUBLE: + case ::com::sun::star::sdbc::DataType::NUMERIC: + case ::com::sun::star::sdbc::DataType::DECIMAL: { try { if (getBOOL(_xColumn->getPropertyValue(::rtl::OUString::createFromAscii("IsCurrency")))) - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::CURRENCY, _rLocale); + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::CURRENCY, _rLocale); else { sal_Int32 nScale = 2; - if (starsdbc::DataType::NUMERIC == nDataType || starsdbc::DataType::DECIMAL == nDataType) + if (::com::sun::star::sdbc::DataType::NUMERIC == nDataType || ::com::sun::star::sdbc::DataType::DECIMAL == nDataType) _xColumn->getPropertyValue(::rtl::OUString::createFromAscii("Scale")) >>= nScale; // generate a new format if necessary - staruno::Reference< starutil::XNumberFormats > xFormats(_xTypes, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > xFormats(_xTypes, ::com::sun::star::uno::UNO_QUERY); ::rtl::OUString sNewFormat = xFormats->generateFormat( 0L, _rLocale, sal_False, sal_False, nScale, sal_True); // and add it to the formatter if necessary @@ -200,49 +212,49 @@ sal_Int32 getDefaultNumberFormat(const staruno::Reference< starbeans::XPropertyS } catch (...) { - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::NUMBER, _rLocale); + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::NUMBER, _rLocale); } } break; - case starsdbc::DataType::CHAR: - case starsdbc::DataType::VARCHAR: - case starsdbc::DataType::LONGVARCHAR: - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::TEXT, _rLocale); + case ::com::sun::star::sdbc::DataType::CHAR: + case ::com::sun::star::sdbc::DataType::VARCHAR: + case ::com::sun::star::sdbc::DataType::LONGVARCHAR: + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::TEXT, _rLocale); break; - case starsdbc::DataType::DATE: - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::DATE, _rLocale); + case ::com::sun::star::sdbc::DataType::DATE: + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, _rLocale); break; - case starsdbc::DataType::TIME: - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::TIME, _rLocale); + case ::com::sun::star::sdbc::DataType::TIME: + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::TIME, _rLocale); break; - case starsdbc::DataType::TIMESTAMP: - nFormat = _xTypes->getStandardFormat(starutil::NumberFormat::DATETIME, _rLocale); + case ::com::sun::star::sdbc::DataType::TIMESTAMP: + nFormat = _xTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATETIME, _rLocale); break; - case starsdbc::DataType::BINARY: - case starsdbc::DataType::VARBINARY: - case starsdbc::DataType::LONGVARBINARY: - case starsdbc::DataType::SQLNULL: - case starsdbc::DataType::OTHER: - case starsdbc::DataType::OBJECT: - case starsdbc::DataType::DISTINCT: - case starsdbc::DataType::STRUCT: - case starsdbc::DataType::ARRAY: - case starsdbc::DataType::BLOB: - case starsdbc::DataType::CLOB: - case starsdbc::DataType::REF: + case ::com::sun::star::sdbc::DataType::BINARY: + case ::com::sun::star::sdbc::DataType::VARBINARY: + case ::com::sun::star::sdbc::DataType::LONGVARBINARY: + case ::com::sun::star::sdbc::DataType::SQLNULL: + case ::com::sun::star::sdbc::DataType::OTHER: + case ::com::sun::star::sdbc::DataType::OBJECT: + case ::com::sun::star::sdbc::DataType::DISTINCT: + case ::com::sun::star::sdbc::DataType::STRUCT: + case ::com::sun::star::sdbc::DataType::ARRAY: + case ::com::sun::star::sdbc::DataType::BLOB: + case ::com::sun::star::sdbc::DataType::CLOB: + case ::com::sun::star::sdbc::DataType::REF: default: - nFormat = starutil::NumberFormat::UNDEFINED; + nFormat = ::com::sun::star::util::NumberFormat::UNDEFINED; } return nFormat; } //============================================================================== //------------------------------------------------------------------------------ -staruno::Reference<starsdbc::XConnection> findConnection(const staruno::Reference< staruno::XInterface >& xParent) +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> findConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent) { - staruno::Reference<starsdbc::XConnection> xConnection(xParent, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection(xParent, ::com::sun::star::uno::UNO_QUERY); if (!xConnection.is()) { - staruno::Reference<starcontainer::XChild> xChild(xParent, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild> xChild(xParent, ::com::sun::star::uno::UNO_QUERY); if (xChild.is()) return findConnection(xChild->getParent()); } @@ -250,41 +262,41 @@ staruno::Reference<starsdbc::XConnection> findConnection(const staruno::Referenc } //------------------------------------------------------------------------------ -staruno::Reference<starsdbc::XDataSource> getDataSource( +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> getDataSource( const ::rtl::OUString& _rsTitleOrPath, - const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) { OSL_ENSHURE(_rsTitleOrPath.getLength(), "::getDataSource : invalid arg !"); - staruno::Reference<starsdbc::XDataSource> xReturn; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> xReturn; // is it a file url ? - staruno::Reference<starcontainer::XNameAccess> xNamingContext( + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> xNamingContext( _rxFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.sdb.DatabaseAccessContext")), - staruno::UNO_QUERY); + ::com::sun::star::uno::UNO_QUERY); if (xNamingContext.is() && xNamingContext->hasByName(_rsTitleOrPath)) { - OSL_ENSHURE(staruno::Reference<staruno::XNamingService>(xNamingContext, staruno::UNO_QUERY).is(), "::getDataSource : no NamingService interface on the DatabaseAccessContext !"); - xReturn = staruno::Reference<starsdbc::XDataSource>( - staruno::Reference<staruno::XNamingService>(xNamingContext, staruno::UNO_QUERY)->getRegisteredObject(_rsTitleOrPath), - staruno::UNO_QUERY); + OSL_ENSHURE(::com::sun::star::uno::Reference< ::com::sun::star::uno::XNamingService>(xNamingContext, ::com::sun::star::uno::UNO_QUERY).is(), "::getDataSource : no NamingService interface on the DatabaseAccessContext !"); + xReturn = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>( + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XNamingService>(xNamingContext, ::com::sun::star::uno::UNO_QUERY)->getRegisteredObject(_rsTitleOrPath), + ::com::sun::star::uno::UNO_QUERY); } else { // is it a favorite title ? - staruno::Reference<starsdb::XDatabaseEnvironment> xEnvironment( + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseEnvironment> xEnvironment( _rxFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.sdb.DatabaseEnvironment")), - staruno::UNO_QUERY); + ::com::sun::star::uno::UNO_QUERY); if (xEnvironment.is()) { try { - xReturn = staruno::Reference<starsdbc::XDataSource>(xEnvironment->getDatabaseAccess(_rsTitleOrPath), staruno::UNO_QUERY); + xReturn = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>(xEnvironment->getDatabaseAccess(_rsTitleOrPath), ::com::sun::star::uno::UNO_QUERY); } - catch(starsdbc::SQLException& e) + catch(::com::sun::star::sdbc::SQLException& e) { // allowed, the env may throw an exception in case of an invalid name e; // make compiler happy } @@ -296,48 +308,48 @@ staruno::Reference<starsdbc::XDataSource> getDataSource( } //------------------------------------------------------------------------------ -staruno::Reference<starsdbc::XConnection> getConnection( +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection( const ::rtl::OUString& _rsTitleOrPath, const ::rtl::OUString& _rsUser, const ::rtl::OUString& _rsPwd, - const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) { - staruno::Reference<starsdbc::XDataSource> xDataSource( getDataSource(_rsTitleOrPath, _rxFactory) ); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> xDataSource( getDataSource(_rsTitleOrPath, _rxFactory) ); if (xDataSource.is()) return xDataSource->getConnection(_rsUser, _rsPwd); - return staruno::Reference<starsdbc::XConnection>(); + return ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>(); } //------------------------------------------------------------------------------ -staruno::Reference<starsdbc::XConnection> getConnection(const staruno::Reference<starsdbc::XRowSet>& _rxRowSet) throw (staruno::RuntimeException) +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet) throw (::com::sun::star::uno::RuntimeException) { - staruno::Reference<starsdbc::XConnection> xReturn; - staruno::Reference<starbeans::XPropertySet> xRowSetProps(_rxRowSet, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xReturn; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xRowSetProps(_rxRowSet, ::com::sun::star::uno::UNO_QUERY); if (xRowSetProps.is()) { - staruno::Any aConn(xRowSetProps->getPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection"))); + ::com::sun::star::uno::Any aConn(xRowSetProps->getPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection"))); if (aConn.getValueType().equals( - getCppuType(reinterpret_cast<staruno::Reference<starsdbc::XConnection>*>(NULL)) + getCppuType(reinterpret_cast< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>*>(NULL)) )) - xReturn = *(staruno::Reference<starsdbc::XConnection>*)aConn.getValue(); + xReturn = *(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>*)aConn.getValue(); } return xReturn; } //------------------------------------------------------------------------------ -staruno::Reference<starsdbc::XConnection> calcConnection( - const staruno::Reference<starsdbc::XRowSet>& _rxRowSet, - const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) - throw (starsdbc::SQLException, staruno::RuntimeException) +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> calcConnection( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) + throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - staruno::Reference<starsdbc::XConnection> xReturn; - staruno::Reference<starbeans::XPropertySet> xRowSetProps(_rxRowSet, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xReturn; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xRowSetProps(_rxRowSet, ::com::sun::star::uno::UNO_QUERY); if (xRowSetProps.is()) { - staruno::Any aConn( xRowSetProps->getPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection")) ); - if (aConn.getValueType().getTypeClass() == staruno::TypeClass_INTERFACE) - xReturn = staruno::Reference<starsdbc::XConnection>(*(staruno::Reference<staruno::XInterface>*)aConn.getValue(), staruno::UNO_QUERY); + ::com::sun::star::uno::Any aConn( xRowSetProps->getPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection")) ); + if (aConn.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE) + xReturn = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)aConn.getValue(), ::com::sun::star::uno::UNO_QUERY); if (!xReturn.is()) { @@ -367,10 +379,10 @@ staruno::Reference<starsdbc::XConnection> calcConnection( else if (sURL.getLength()) { // the row set has no data source, but a connection url set // -> try to connection with that url - staruno::Reference<starsdb::XDatabaseEnvironment> xEnvironment( + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseEnvironment> xEnvironment( _rxFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.sdb.DatabaseEnvironment")), - staruno::UNO_QUERY); + ::com::sun::star::uno::UNO_QUERY); if (xEnvironment.is()) { ::rtl::OUString sUser, sPwd; @@ -380,7 +392,7 @@ staruno::Reference<starsdbc::XConnection> calcConnection( xRowSetProps->getPropertyValue(s_sPwdProp) >>= sPwd; if (sUser.getLength()) { // use user and pwd together with the url - staruno::Sequence<starbeans::PropertyValue> aInfo(2); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aInfo(2); aInfo.getArray()[0].Name = s_sUserProp; aInfo.getArray()[0].Value <<= sUser; aInfo.getArray()[1].Name = s_sPwdProp; @@ -403,7 +415,7 @@ staruno::Reference<starsdbc::XConnection> calcConnection( { try { - xRowSetProps->setPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection"), staruno::makeAny(xReturn)); + xRowSetProps->setPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection"), ::com::sun::star::uno::makeAny(xReturn)); } catch(...) { @@ -416,36 +428,36 @@ staruno::Reference<starsdbc::XConnection> calcConnection( } //------------------------------------------------------------------------------ -staruno::Reference<starcontainer::XNameAccess> getTableFields( - const staruno::Reference<starsdbc::XConnection>& _rxConn, +::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getTableFields( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn, const ::rtl::OUString& _rName) { - staruno::Reference<starsdbcx::XTablesSupplier> xSupplyTables(_rxConn, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> xSupplyTables(_rxConn, ::com::sun::star::uno::UNO_QUERY); OSL_ENSHURE(xSupplyTables.is(), "::getTableFields : invalid connection !"); // the conn already said it would support the service sdb::Connection - staruno::Reference<starcontainer::XNameAccess> xTables( xSupplyTables->getTables()); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> xTables( xSupplyTables->getTables()); if (xTables.is() && xTables->hasByName(_rName)) { - staruno::Reference<starsdbcx::XColumnsSupplier> xTableCols(*(staruno::Reference< staruno::XInterface >*)xTables->getByName(_rName).getValue(), staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xTableCols(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >*)xTables->getByName(_rName).getValue(), ::com::sun::star::uno::UNO_QUERY); OSL_ENSHURE(xTableCols.is(), "::getTableFields : invalid table !"); // the table is expected to support the service sddb::Table, which requires an XColumnsSupplier interface - staruno::Reference<starcontainer::XNameAccess> xFieldNames(xTableCols->getColumns(), staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> xFieldNames(xTableCols->getColumns(), ::com::sun::star::uno::UNO_QUERY); OSL_ENSHURE(xFieldNames.is(), "::getTableFields : TableCols->getColumns doesn't export a NameAccess !"); return xFieldNames; } - return staruno::Reference<starcontainer::XNameAccess>(); + return ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>(); } //------------------------------------------------------------------------------ -starsdb::SQLContext prependContextInfo(starsdbc::SQLException& _rException, const staruno::Reference< staruno::XInterface >& _rxContext, const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails) +::com::sun::star::sdb::SQLContext prependContextInfo(::com::sun::star::sdbc::SQLException& _rException, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext, const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails) { // determine the type of the exception SQLExceptionInfo aInfo(_rException); // the new first chain element - starsdb::SQLContext aContextDescription(_rContextDescription, _rxContext, ::rtl::OUString(), 0, aInfo.get(), _rContextDetails); + ::com::sun::star::sdb::SQLContext aContextDescription(_rContextDescription, _rxContext, ::rtl::OUString(), 0, aInfo.get(), _rContextDetails); return aContextDescription; } @@ -456,7 +468,7 @@ starsdb::SQLContext prependContextInfo(starsdbc::SQLException& _rException, cons } //------------------------------------------------------------------------------ -::rtl::OUString quoteTableName(const staruno::Reference<starsdbc::XDatabaseMetaData>& _rxMeta, const ::rtl::OUString& _rName) +::rtl::OUString quoteTableName(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _rxMeta, const ::rtl::OUString& _rName) { ::rtl::OUString sQuote = _rxMeta->getIdentifierQuoteString(); ::rtl::OUString sQuotedName; @@ -502,7 +514,7 @@ starsdb::SQLContext prependContextInfo(starsdbc::SQLException& _rException, cons } //------------------------------------------------------------------------------ -void qualifiedNameComponents(const staruno::Reference< starsdbc::XDatabaseMetaData >& _rxConnMetaData, const ::rtl::OUString& _rQualifiedName, ::rtl::OUString& _rCatalog, ::rtl::OUString& _rSchema, ::rtl::OUString& _rName) +void qualifiedNameComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxConnMetaData, const ::rtl::OUString& _rQualifiedName, ::rtl::OUString& _rCatalog, ::rtl::OUString& _rSchema, ::rtl::OUString& _rName) { OSL_ENSHURE(_rxConnMetaData.is(), "QualifiedNameComponents : invalid meta data!"); ::rtl::OUString sSeparator = _rxConnMetaData->getCatalogSeparator(); @@ -545,39 +557,39 @@ void qualifiedNameComponents(const staruno::Reference< starsdbc::XDatabaseMetaDa } //------------------------------------------------------------------------------ -staruno::Reference<starutil::XNumberFormatsSupplier> getNumberFormats( - const staruno::Reference<starsdbc::XConnection>& _rxConn, +::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn, sal_Bool _bAlloweDefault, - const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) { // ask the parent of the connection (should be an DatabaseAccess) - staruno::Reference<starutil::XNumberFormatsSupplier> xReturn; - staruno::Reference<starcontainer::XChild> xConnAsChild(_rxConn, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> xReturn; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild> xConnAsChild(_rxConn, ::com::sun::star::uno::UNO_QUERY); ::rtl::OUString sPropFormatsSupplier = ::rtl::OUString::createFromAscii("NumberFormatsSupplier"); if (xConnAsChild.is()) { - staruno::Reference<starbeans::XPropertySet> xConnParentProps(xConnAsChild->getParent(), staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xConnParentProps(xConnAsChild->getParent(), ::com::sun::star::uno::UNO_QUERY); if (xConnParentProps.is() && hasProperty(sPropFormatsSupplier, xConnParentProps)) { - staruno::Any aSupplier( xConnParentProps->getPropertyValue(sPropFormatsSupplier) ); - if (aSupplier.getValueType().getTypeClass() == staruno::TypeClass_INTERFACE) - xReturn = staruno::Reference<starutil::XNumberFormatsSupplier>(*(staruno::Reference< staruno::XInterface >*)aSupplier.getValue(), staruno::UNO_QUERY); + ::com::sun::star::uno::Any aSupplier( xConnParentProps->getPropertyValue(sPropFormatsSupplier) ); + if (aSupplier.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE) + xReturn = ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >*)aSupplier.getValue(), ::com::sun::star::uno::UNO_QUERY); } } // no result 'til now ? -> ask the environment for the default formatter if (!xReturn.is() && _bAlloweDefault) { - staruno::Reference<starsdb::XDatabaseEnvironment> xEnv(_rxFactory->createInstance( + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseEnvironment> xEnv(_rxFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.sdb.DatabaseEnvironment")), - staruno::UNO_QUERY); + ::com::sun::star::uno::UNO_QUERY); - staruno::Reference<starbeans::XPropertySet> xEnvProps(xEnv, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xEnvProps(xEnv, ::com::sun::star::uno::UNO_QUERY); if (xEnv.is() && hasProperty(sPropFormatsSupplier, xEnvProps)) { - staruno::Any aSupplier( xEnvProps->getPropertyValue(sPropFormatsSupplier) ); - if (aSupplier.getValueType().getTypeClass() == staruno::TypeClass_INTERFACE) - xReturn = staruno::Reference<starutil::XNumberFormatsSupplier>(*(staruno::Reference< staruno::XInterface >*)aSupplier.getValue(), staruno::UNO_QUERY); + ::com::sun::star::uno::Any aSupplier( xEnvProps->getPropertyValue(sPropFormatsSupplier) ); + if (aSupplier.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE) + xReturn = ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >*)aSupplier.getValue(), ::com::sun::star::uno::UNO_QUERY); } } @@ -587,20 +599,20 @@ staruno::Reference<starutil::XNumberFormatsSupplier> getNumberFormats( //============================================================================== //------------------------------------------------------------------------------ void TransferFormComponentProperties( - const staruno::Reference<starbeans::XPropertySet>& xOldProps, - const staruno::Reference<starbeans::XPropertySet>& xNewProps, - const starlang::Locale& _rLocale) + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xOldProps, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xNewProps, + const ::com::sun::star::lang::Locale& _rLocale) { // kopieren wir erst mal alle Props, die in Quelle und Ziel vorhanden sind und identische Beschreibungen haben - staruno::Reference<starbeans::XPropertySetInfo> xOldInfo( xOldProps->getPropertySetInfo()); - staruno::Reference<starbeans::XPropertySetInfo> xNewInfo( xNewProps->getPropertySetInfo()); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> xOldInfo( xOldProps->getPropertySetInfo()); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> xNewInfo( xNewProps->getPropertySetInfo()); - staruno::Sequence<starbeans::Property> aOldProperties = xOldInfo->getProperties(); - staruno::Sequence<starbeans::Property> aNewProperties = xNewInfo->getProperties(); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aOldProperties = xOldInfo->getProperties(); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aNewProperties = xNewInfo->getProperties(); int nNewLen = aNewProperties.getLength(); - starbeans::Property* pOldProps = aOldProperties.getArray(); - starbeans::Property* pNewProps = aNewProperties.getArray(); + ::com::sun::star::beans::Property* pOldProps = aOldProperties.getArray(); + ::com::sun::star::beans::Property* pNewProps = aNewProperties.getArray(); ::rtl::OUString sPropDefaultControl(::rtl::OUString::createFromAscii("DefaultControl")); ::rtl::OUString sPropLabelControl(::rtl::OUString::createFromAscii("LabelControl")); @@ -627,17 +639,17 @@ void TransferFormComponentProperties( ) { // binaere Suche - starbeans::Property* pResult = (starbeans::Property*) bsearch(pOldProps + i, (void*)pNewProps, nNewLen, sizeof(starbeans::Property), + ::com::sun::star::beans::Property* pResult = (::com::sun::star::beans::Property*) bsearch(pOldProps + i, (void*)pNewProps, nNewLen, sizeof(::com::sun::star::beans::Property), &PropertyCompare); if (pResult && (pResult->Attributes == pOldProps[i].Attributes) - && ((pResult->Attributes & starbeans::PropertyAttribute::READONLY) == 0) + && ((pResult->Attributes & ::com::sun::star::beans::PropertyAttribute::READONLY) == 0) && (pResult->Type.equals(pOldProps[i].Type))) { // Attribute stimmen ueberein und Property ist nicht read-only try { xNewProps->setPropertyValue(pResult->Name, xOldProps->getPropertyValue(pResult->Name)); } - catch(starlang::IllegalArgumentException& e) + catch(::com::sun::star::lang::IllegalArgumentException& e) { e; #ifdef DBG_UTIL @@ -667,22 +679,22 @@ void TransferFormComponentProperties( if (bOldIsFormatted) { // aus dem eingestellten Format ein paar Properties rausziehen und zum neuen Set durchschleifen - staruno::Any aFormatKey( xOldProps->getPropertyValue(sPropFormatKey) ); + ::com::sun::star::uno::Any aFormatKey( xOldProps->getPropertyValue(sPropFormatKey) ); if (aFormatKey.hasValue()) { - staruno::Any aSupplier( xOldProps->getPropertyValue(sPropFormatsSupplier) ); - OSL_ENSHURE(isAReference(aSupplier.getValueType(), static_cast<starutil::XNumberFormatsSupplier*>(NULL)), + ::com::sun::star::uno::Any aSupplier( xOldProps->getPropertyValue(sPropFormatsSupplier) ); + OSL_ENSHURE(isAReference(aSupplier.getValueType(), static_cast< ::com::sun::star::util::XNumberFormatsSupplier*>(NULL)), "TransferFormComponentProperties : invalid property type !"); - staruno::Reference<starutil::XNumberFormatsSupplier> xSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> xSupplier; if (aSupplier.hasValue()) - xSupplier = *(staruno::Reference<starutil::XNumberFormatsSupplier>*)aSupplier.getValue(); + xSupplier = *(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>*)aSupplier.getValue(); if (xSupplier.is()) { - staruno::Reference<starutil::XNumberFormats> xFormats(xSupplier->getNumberFormats()); - staruno::Reference<starbeans::XPropertySet> xFormat(xFormats->getByKey(getINT32(aFormatKey))); + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats> xFormats(xSupplier->getNumberFormats()); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xFormat(xFormats->getByKey(getINT32(aFormatKey))); if (hasProperty(sPropCurrencySymbol, xFormat)) { - staruno::Any aVal( xFormat->getPropertyValue(sPropCurrencySymbol) ); + ::com::sun::star::uno::Any aVal( xFormat->getPropertyValue(sPropCurrencySymbol) ); if (aVal.hasValue() && hasProperty(sPropCurrencySymbol, xNewProps)) // (wenn die Quelle das nicht gesetzt hat, dann auch nicht kopieren, um den // Default-Wert nicht zu ueberschreiben @@ -694,47 +706,47 @@ void TransferFormComponentProperties( } // eine eventuelle-Min-Max-Konvertierung - staruno::Any aEffectiveMin( xOldProps->getPropertyValue(sPropEffectiveMin) ); + ::com::sun::star::uno::Any aEffectiveMin( xOldProps->getPropertyValue(sPropEffectiveMin) ); if (aEffectiveMin.hasValue()) { // im Gegensatz zu ValueMin kann EffectiveMin void sein if (hasProperty(sPropValueMin, xNewProps)) { - OSL_ENSHURE(aEffectiveMin.getValueType().getTypeClass() == staruno::TypeClass_DOUBLE, + OSL_ENSHURE(aEffectiveMin.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE, "TransferFormComponentProperties : invalid property type !"); xNewProps->setPropertyValue(sPropValueMin, aEffectiveMin); } } - staruno::Any aEffectiveMax( xOldProps->getPropertyValue(sPropEffectiveMax) ); + ::com::sun::star::uno::Any aEffectiveMax( xOldProps->getPropertyValue(sPropEffectiveMax) ); if (aEffectiveMax.hasValue()) { // analog if (hasProperty(sPropValueMax, xNewProps)) { - OSL_ENSHURE(aEffectiveMax.getValueType().getTypeClass() == staruno::TypeClass_DOUBLE, + OSL_ENSHURE(aEffectiveMax.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE, "TransferFormComponentProperties : invalid property type !"); xNewProps->setPropertyValue(sPropValueMax, aEffectiveMax); } } // dann koennen wir noch Default-Werte konvertieren und uebernehmen - staruno::Any aEffectiveDefault( xOldProps->getPropertyValue(sPropEffectiveDefault) ); + ::com::sun::star::uno::Any aEffectiveDefault( xOldProps->getPropertyValue(sPropEffectiveDefault) ); if (aEffectiveDefault.hasValue()) { - sal_Bool bIsString = aEffectiveDefault.getValueType().getTypeClass() == staruno::TypeClass_STRING; - OSL_ENSHURE(bIsString || aEffectiveDefault.getValueType().getTypeClass() == staruno::TypeClass_DOUBLE, + sal_Bool bIsString = aEffectiveDefault.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING; + OSL_ENSHURE(bIsString || aEffectiveDefault.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE, "TransferFormComponentProperties : invalid property type !"); // die Effective-Properties sollten immer void oder string oder double sein .... if (hasProperty(sPropDefaultDate, xNewProps) && !bIsString) { // (einen String in ein Datum zu konvertieren muss nicht immer klappen, denn das ganze kann ja an // eine Textspalte gebunden gewesen sein, aber mit einem double koennen wir was anfangen) - starutil::Date aDate = DBTypeConversion::toDate(getDouble(aEffectiveDefault)); - xNewProps->setPropertyValue(sPropDefaultDate, staruno::makeAny(aDate)); + ::com::sun::star::util::Date aDate = DBTypeConversion::toDate(getDouble(aEffectiveDefault)); + xNewProps->setPropertyValue(sPropDefaultDate, ::com::sun::star::uno::makeAny(aDate)); } if (hasProperty(sPropDefaultTime, xNewProps) && !bIsString) { // voellig analog mit Zeit - starutil::Time aTime = DBTypeConversion::toTime(getDouble(aEffectiveDefault)); - xNewProps->setPropertyValue(sPropDefaultTime, staruno::makeAny(aTime)); + ::com::sun::star::util::Time aTime = DBTypeConversion::toTime(getDouble(aEffectiveDefault)); + xNewProps->setPropertyValue(sPropDefaultTime, ::com::sun::star::uno::makeAny(aTime)); } if (hasProperty(sPropDefaultValue, xNewProps) && !bIsString) @@ -756,20 +768,20 @@ void TransferFormComponentProperties( { // zuerst die Formatierung // einen Supplier koennen wir nicht setzen, also muss das neue Set schon einen mitbringen - staruno::Any aSupplier( xNewProps->getPropertyValue(sPropFormatsSupplier) ); - OSL_ENSHURE(isAReference(aSupplier, static_cast<starutil::XNumberFormatsSupplier*>(NULL)), + ::com::sun::star::uno::Any aSupplier( xNewProps->getPropertyValue(sPropFormatsSupplier) ); + OSL_ENSHURE(isAReference(aSupplier, static_cast< ::com::sun::star::util::XNumberFormatsSupplier*>(NULL)), "TransferFormComponentProperties : invalid property type !"); - staruno::Reference<starutil::XNumberFormatsSupplier> xSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> xSupplier; if (aSupplier.hasValue()) - xSupplier = *(staruno::Reference<starutil::XNumberFormatsSupplier>*)aSupplier.getValue(); + xSupplier = *(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>*)aSupplier.getValue(); if (xSupplier.is()) { - staruno::Reference<starutil::XNumberFormats> xFormats(xSupplier->getNumberFormats()); + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats> xFormats(xSupplier->getNumberFormats()); // Sprache des neuen Formats // ::rtl::OString sLanguage, sCountry; // ConvertLanguageToIsoNames(Application::GetAppInternational().GetLanguage(), String(sLanguage.getStr()), String(sCountry.getStr())); -// starlang::Locale aNewLanguage( +// ::com::sun::star::lang::Locale aNewLanguage( // ::rtl::OStringToOUString(sLanguage, RTL_TEXTENCODING_ASCII_US), // ::rtl::OStringToOUString(sCountry, RTL_TEXTENCODING_ASCII_US), // ::rtl::OUString()); @@ -783,23 +795,23 @@ void TransferFormComponentProperties( sal_Int32 nBaseKey = 0; if (hasProperty(sPropClassId, xOldProps)) { - staruno::Reference<starutil::XNumberFormatTypes> xTypeList(xFormats, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes> xTypeList(xFormats, ::com::sun::star::uno::UNO_QUERY); if (xTypeList.is()) { sal_Int16 nClassId; xOldProps->getPropertyValue(sPropClassId) >>= nClassId; switch (nClassId) { - case starform::FormComponentType::DATEFIELD : - nBaseKey = xTypeList->getStandardFormat(starutil::NumberFormat::DATE, _rLocale); + case ::com::sun::star::form::FormComponentType::DATEFIELD : + nBaseKey = xTypeList->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, _rLocale); break; - case starform::FormComponentType::TIMEFIELD : - nBaseKey = xTypeList->getStandardFormat(starutil::NumberFormat::TIME, _rLocale); + case ::com::sun::star::form::FormComponentType::TIMEFIELD : + nBaseKey = xTypeList->getStandardFormat(::com::sun::star::util::NumberFormat::TIME, _rLocale); break; - case starform::FormComponentType::CURRENCYFIELD : - nBaseKey = xTypeList->getStandardFormat(starutil::NumberFormat::CURRENCY, _rLocale); + case ::com::sun::star::form::FormComponentType::CURRENCYFIELD : + nBaseKey = xTypeList->getStandardFormat(::com::sun::star::util::NumberFormat::CURRENCY, _rLocale); break; } } @@ -816,11 +828,11 @@ void TransferFormComponentProperties( nKey = xFormats->addNew(sNewFormat, _rLocale); } - xNewProps->setPropertyValue(sPropFormatKey, staruno::makeAny((sal_Int32)nKey)); + xNewProps->setPropertyValue(sPropFormatKey, ::com::sun::star::uno::makeAny((sal_Int32)nKey)); } // min-/max-Werte - staruno::Any aNewMin, aNewMax; + ::com::sun::star::uno::Any aNewMin, aNewMax; if (hasProperty(sPropValueMin, xOldProps)) aNewMin = xOldProps->getPropertyValue(sPropValueMin); if (hasProperty(sPropValueMax, xOldProps)) @@ -829,19 +841,19 @@ void TransferFormComponentProperties( xNewProps->setPropertyValue(sPropEffectiveMax, aNewMax); // Default-Wert - staruno::Any aNewDefault; + ::com::sun::star::uno::Any aNewDefault; if (hasProperty(sPropDefaultDate, xOldProps)) { - staruno::Any aDate( xOldProps->getPropertyValue(sPropDefaultDate) ); + ::com::sun::star::uno::Any aDate( xOldProps->getPropertyValue(sPropDefaultDate) ); if (aDate.hasValue()) - aNewDefault <<= DBTypeConversion::toDouble(*(starutil::Date*)aDate.getValue()); + aNewDefault <<= DBTypeConversion::toDouble(*(::com::sun::star::util::Date*)aDate.getValue()); } if (hasProperty(sPropDefaultTime, xOldProps)) { - staruno::Any aTime( xOldProps->getPropertyValue(sPropDefaultTime) ); + ::com::sun::star::uno::Any aTime( xOldProps->getPropertyValue(sPropDefaultTime) ); if (aTime.hasValue()) - aNewDefault <<= DBTypeConversion::toDouble(*(starutil::Time*)aTime.getValue()); + aNewDefault <<= DBTypeConversion::toDouble(*(::com::sun::star::util::Time*)aTime.getValue()); } // double oder String werden direkt uebernommen @@ -856,32 +868,32 @@ void TransferFormComponentProperties( } //------------------------------------------------------------------------------ -sal_Bool canInsert(const staruno::Reference< starbeans::XPropertySet>& _rxCursorSet) +sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) { - return ((_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(::rtl::OUString::createFromAscii("Privileges"))) & starsdbcx::Privilege::INSERT) != 0)); + return ((_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(::rtl::OUString::createFromAscii("Privileges"))) & ::com::sun::star::sdbcx::Privilege::INSERT) != 0)); } //------------------------------------------------------------------------------ -sal_Bool canUpdate(const staruno::Reference< starbeans::XPropertySet>& _rxCursorSet) +sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) { - return ((_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(::rtl::OUString::createFromAscii("Privileges"))) & starsdbcx::Privilege::UPDATE) != 0)); + return ((_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(::rtl::OUString::createFromAscii("Privileges"))) & ::com::sun::star::sdbcx::Privilege::UPDATE) != 0)); } //------------------------------------------------------------------------------ -sal_Bool canDelete(const staruno::Reference< starbeans::XPropertySet>& _rxCursorSet) +sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) { - return ((_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(::rtl::OUString::createFromAscii("Privileges"))) & starsdbcx::Privilege::DELETE) != 0)); + return ((_rxCursorSet.is() && (getINT32(_rxCursorSet->getPropertyValue(::rtl::OUString::createFromAscii("Privileges"))) & ::com::sun::star::sdbcx::Privilege::DELETE) != 0)); } //------------------------------------------------------------------------------ -staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( - const staruno::Reference<starbeans::XPropertySet>& _rxRowSetProps, - const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) +::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer> getCurrentSettingsComposer( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxRowSetProps, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) { - staruno::Reference<starsdb::XSQLQueryComposer> xReturn; - staruno::Reference<starsdbc::XRowSet> xRowSet(_rxRowSetProps, staruno::UNO_QUERY); - staruno::Reference<starsdbc::XConnection> xConn( calcConnection(xRowSet, _rxFactory)); + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer> xReturn; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> xRowSet(_rxRowSetProps, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConn( calcConnection(xRowSet, _rxFactory)); try { if (xConn.is()) // implies xRowSet.is() implies _rxRowSetProps.is() @@ -907,7 +919,7 @@ staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( sal_Bool bEscapeProcessing = getBOOL(_rxRowSetProps->getPropertyValue(sPropEscapeProcessing)); switch (nCommandType) { - case starsdb::CommandType::COMMAND: + case ::com::sun::star::sdb::CommandType::COMMAND: if (!bEscapeProcessing) { // native sql -> no parsable statement sStatement = ::rtl::OUString(); @@ -917,7 +929,7 @@ staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( sStatement = sCommand; } break; - case starsdb::CommandType::TABLE: + case ::com::sun::star::sdb::CommandType::TABLE: { if (!sCommand.getLength()) break; @@ -927,18 +939,18 @@ staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( sStatement += sTableName; } break; - case starsdb::CommandType::QUERY: + case ::com::sun::star::sdb::CommandType::QUERY: { // ask the connection for the query - staruno::Reference<starsdb::XQueriesSupplier> xSupplyQueries(xConn, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XQueriesSupplier> xSupplyQueries(xConn, ::com::sun::star::uno::UNO_QUERY); if (!xSupplyQueries.is()) break; - staruno::Reference<starcontainer::XNameAccess> xQueries(xSupplyQueries->getQueries(), staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> xQueries(xSupplyQueries->getQueries(), ::com::sun::star::uno::UNO_QUERY); if (!xQueries.is() || !xQueries->hasByName(sCommand)) break; - staruno::Reference<starbeans::XPropertySet> xQueryProps(*(staruno::Reference<staruno::XInterface>*)xQueries->getByName(sCommand).getValue(), staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xQueryProps(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)xQueries->getByName(sCommand).getValue(), ::com::sun::star::uno::UNO_QUERY); if (!xQueryProps.is()) break; @@ -955,8 +967,8 @@ staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( sStatement = getString(xQueryProps->getPropertyValue(sPropCommand)); // use an additional composer to build a statement from the query filter/order props - staruno::Reference<starsdb::XSQLQueryComposerFactory> xFactory(xConn, staruno::UNO_QUERY); - staruno::Reference<starsdb::XSQLQueryComposer> xLocalComposer; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposerFactory> xFactory(xConn, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer> xLocalComposer; if (xFactory.is()) xLocalComposer = xFactory->createQueryComposer(); if (!xLocalComposer.is()) @@ -988,7 +1000,7 @@ staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( if (sStatement.getLength()) { // create an composer - staruno::Reference<starsdb::XSQLQueryComposerFactory> xFactory(xConn, staruno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposerFactory> xFactory(xConn, ::com::sun::star::uno::UNO_QUERY); if (xFactory.is()) xReturn = xFactory->createQueryComposer(); if (xReturn.is()) @@ -1012,6 +1024,64 @@ staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( return xReturn; } +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sdbc; +using namespace cppu; +using namespace osl; + +//-------------------------------------------------------------------------- +void composeTableName( const Reference< XDatabaseMetaData >& _rxMetaData, + const ::rtl::OUString& _rCatalog, + const ::rtl::OUString& _rSchema, + const ::rtl::OUString& _rName, + ::rtl::OUString& _rComposedName, + sal_Bool _bQuote) +{ + OSL_ENSHURE(_rxMetaData.is(), "composeTableName : invalid meta data !"); + OSL_ENSHURE(_rName.getLength(), "composeTableName : at least the name should be non-empty !"); + + ::rtl::OUString sQuoteString = _rxMetaData->getIdentifierQuoteString(); +#define QUOTE(s) if (_bQuote) s += sQuoteString + + static ::rtl::OUString sEmpty; + static ::rtl::OUString sSeparator = ::rtl::OUString::createFromAscii("."); + _rComposedName = sEmpty; + + if (_rCatalog.getLength() && _rxMetaData->isCatalogAtStart() && !_rxMetaData->usesLocalFiles()) + { + QUOTE(_rComposedName); + _rComposedName += _rCatalog; + QUOTE(_rComposedName); + _rComposedName += _rxMetaData->getCatalogSeparator(); + } + + if (_rSchema.getLength()) + { + QUOTE(_rComposedName); + _rComposedName += _rSchema; + QUOTE(_rComposedName); + _rComposedName += sSeparator; + QUOTE(_rComposedName); + _rComposedName += _rName; + QUOTE(_rComposedName); + } + else + { + QUOTE(_rComposedName); + _rComposedName += _rName; + QUOTE(_rComposedName); + } + + if (_rCatalog.getLength() && !_rxMetaData->isCatalogAtStart() && !_rxMetaData->usesLocalFiles()) + { + _rComposedName += _rxMetaData->getCatalogSeparator(); + QUOTE(_rComposedName); + _rComposedName += _rCatalog; + QUOTE(_rComposedName); + } +} + //......................................................................... } // namespace dbtools @@ -1021,6 +1091,9 @@ staruno::Reference<starsdb::XSQLQueryComposer> getCurrentSettingsComposer( /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.1 2000/10/05 08:50:51 fs + * moved the files from unotools to here + * * * Revision 1.0 29.09.00 08:16:59 fs ************************************************************************/ |