diff options
94 files changed, 2858 insertions, 2630 deletions
diff --git a/connectivity/inc/connectivity/CommonTools.hxx b/connectivity/inc/connectivity/CommonTools.hxx index 1272109f5652..90bad88db748 100644 --- a/connectivity/inc/connectivity/CommonTools.hxx +++ b/connectivity/inc/connectivity/CommonTools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: CommonTools.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:57:37 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,7 +90,11 @@ namespace com { namespace sun { namespace star { namespace util { struct Date; struct DateTime; struct Time; -}}}} +} + namespace lang { + class DisposedException; + } +}}} namespace connectivity { @@ -192,6 +196,8 @@ namespace connectivity const ::rtl::OUString& _rProp, const ::rtl::OUString& _rVal, const ::comphelper::UStringMixEqual& _rCase); + + void checkDisposed(sal_Bool _bThrow) throw ( ::com::sun::star::lang::DisposedException ); } //================================================================================== @@ -214,13 +220,13 @@ namespace connectivity } \ sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ { \ - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \ - const ::rtl::OUString* pSupported = aSupported.getConstArray(); \ - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) \ - if (pSupported->equals(_rServiceName)) \ - return sal_True; \ - \ - return sal_False; \ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \ + const ::rtl::OUString* pSupported = aSupported.getConstArray(); \ + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); \ + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) \ + ; \ + \ + return pSupported != pEnd; \ } \ //================================================================================== diff --git a/connectivity/inc/connectivity/dbexception.hxx b/connectivity/inc/connectivity/dbexception.hxx index bb3ce7e89187..4ba2e473c79a 100644 --- a/connectivity/inc/connectivity/dbexception.hxx +++ b/connectivity/inc/connectivity/dbexception.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dbexception.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: fs $ $Date: 2001-04-19 07:04:21 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -175,29 +175,22 @@ public: //================================================================================== //= StandardExceptions //================================================================================== -// please use throwFunctionSequenceException instead of this class. The UNO<->* bridges sometimes have -// trouble wrapping exception classes which are not defined in IDLs. -class FunctionSequenceException : public ::com::sun::star::sdbc::SQLException -{ -public: - FunctionSequenceException(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context, - const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()); -}; - //---------------------------------------------------------------------------------- /** throw a function sequence exception */ void throwFunctionSequenceException(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context, - const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()); + const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()) throw ( ::com::sun::star::sdbc::SQLException ); +//---------------------------------------------------------------------------------- +/** throw a invalid index sqlexception +*/ +void throwInvalidIndexException(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context, + const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()) throw ( ::com::sun::star::sdbc::SQLException ); //---------------------------------------------------------------------------------- /** throw a generic SQLException, i.e. one with an SQLState of S1000, an ErrorCode of 0 and no NextException */ -inline void throwGenericSQLException(const ::rtl::OUString& _rMsg, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource) - throw (::com::sun::star::sdbc::SQLException) -{ - throw ::com::sun::star::sdbc::SQLException(_rMsg, _rxSource, ::rtl::OUString::createFromAscii("S1000"), 0, ::com::sun::star::uno::Any()); -} +void throwGenericSQLException(const ::rtl::OUString& _rMsg, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource) + throw (::com::sun::star::sdbc::SQLException); //......................................................................... } // namespace dbtools //......................................................................... @@ -208,6 +201,9 @@ inline void throwGenericSQLException(const ::rtl::OUString& _rMsg, const ::com:: /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.4 2001/04/19 07:04:21 fs + * +throwFunctionSequenceException + * * Revision 1.3 2001/03/01 17:01:18 fs * operator= for SQLExceptionInfo, new ctor for SQLExceptionIteratorHelper, new next method * diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx index 9830b634ded8..20f4498f81b9 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDatabaseMetaDataResultSetMetaData.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-03-28 11:26:10 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:42:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,13 +71,8 @@ #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity; -using namespace connectivity::dbtools; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbcx; diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 90ce163ceae9..53219b29ed51 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FValue.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-07 12:23:40 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:42:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -131,7 +131,7 @@ ORowSetValue& ORowSetValue::operator=(const ORowSetValue& _rRH) if(&_rRH == this) return *this; - if(m_eTypeKind != _rRH.m_eTypeKind) + if(m_eTypeKind != _rRH.m_eTypeKind || _rRH.m_bNull) free(); m_bBound = _rRH.m_bBound; @@ -539,59 +539,62 @@ Any ORowSetValue::makeAny() const ::rtl::OUString ORowSetValue::getString( ) const { ::rtl::OUString aRet; - switch(getTypeKind()) + if(!m_bNull) { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - aRet = m_aValue.m_pString; - break; - case DataType::LONGVARCHAR: - { - Sequence<sal_Int8> aSeq(getSequence()); - if(aSeq.getLength()) - aRet = ::rtl::OUString(reinterpret_cast<sal_Unicode*>(aSeq.getArray()),aSeq.getLength()/sizeof(sal_Unicode)); - } - break; - case DataType::DOUBLE: - case DataType::FLOAT: - case DataType::REAL: - aRet = ::rtl::OUString::valueOf((double)*this); - break; - case DataType::DATE: - aRet = connectivity::toDateString(*this); - break; - case DataType::TIME: - aRet = connectivity::toTimeString(*this); - break; - case DataType::TIMESTAMP: - aRet = connectivity::toDateTimeString(*this); - break; - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - { - aRet = ::rtl::OUString::createFromAscii("0x"); - Sequence<sal_Int8> aSeq(getSequence()); - const sal_Int8* pBegin = aSeq.getConstArray(); - const sal_Int8* pEnd = pBegin + aSeq.getLength(); - for(;pBegin != pEnd;++pBegin) - aRet += ::rtl::OUString::valueOf((sal_Int32)*pBegin,16); - } - break; - case DataType::BIT: - aRet = ::rtl::OUString::valueOf((sal_Int32)(sal_Bool)*this); - break; - case DataType::TINYINT: - aRet = ::rtl::OUString::valueOf((sal_Int32)(sal_Int8)*this); - break; - case DataType::SMALLINT: - aRet = ::rtl::OUString::valueOf((sal_Int32)(sal_Int16)*this); - break; - case DataType::INTEGER: - aRet = ::rtl::OUString::valueOf((sal_Int32)*this); - break; + switch(getTypeKind()) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + aRet = m_aValue.m_pString; + break; + case DataType::LONGVARCHAR: + { + Sequence<sal_Int8> aSeq(getSequence()); + if(aSeq.getLength()) + aRet = ::rtl::OUString(reinterpret_cast<sal_Unicode*>(aSeq.getArray()),aSeq.getLength()/sizeof(sal_Unicode)); + } + break; + case DataType::DOUBLE: + case DataType::FLOAT: + case DataType::REAL: + aRet = ::rtl::OUString::valueOf((double)*this); + break; + case DataType::DATE: + aRet = connectivity::toDateString(*this); + break; + case DataType::TIME: + aRet = connectivity::toTimeString(*this); + break; + case DataType::TIMESTAMP: + aRet = connectivity::toDateTimeString(*this); + break; + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + { + aRet = ::rtl::OUString::createFromAscii("0x"); + Sequence<sal_Int8> aSeq(getSequence()); + const sal_Int8* pBegin = aSeq.getConstArray(); + const sal_Int8* pEnd = pBegin + aSeq.getLength(); + for(;pBegin != pEnd;++pBegin) + aRet += ::rtl::OUString::valueOf((sal_Int32)*pBegin,16); + } + break; + case DataType::BIT: + aRet = ::rtl::OUString::valueOf((sal_Int32)(sal_Bool)*this); + break; + case DataType::TINYINT: + aRet = ::rtl::OUString::valueOf((sal_Int32)(sal_Int8)*this); + break; + case DataType::SMALLINT: + aRet = ::rtl::OUString::valueOf((sal_Int32)(sal_Int16)*this); + break; + case DataType::INTEGER: + aRet = ::rtl::OUString::valueOf((sal_Int32)*this); + break; + } } return aRet; } @@ -601,42 +604,45 @@ sal_Bool ORowSetValue::getBool() const OSL_ENSURE(m_bBound,"Value is not bound!"); sal_Bool bRet = sal_False; - switch(getTypeKind()) + if(!m_bNull) { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - bRet = ::rtl::OUString(m_aValue.m_pString).toInt32() != 0; - break; - case DataType::LONGVARCHAR: - bRet = getString().toInt32() != 0; - break; - case DataType::DOUBLE: - case DataType::FLOAT: - case DataType::REAL: - bRet = *(double*)m_aValue.m_pValue != 0.0; - break; - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - OSL_ASSERT("getBool() for this type is not allowed!"); - break; - case DataType::BIT: - bRet = m_aValue.m_bBool; - break; - case DataType::TINYINT: - bRet = m_aValue.m_nInt8 != 0; - break; - case DataType::SMALLINT: - bRet = m_aValue.m_nInt16 != 0; - break; - case DataType::INTEGER: - bRet = m_aValue.m_nInt32 != 0; - break; + switch(getTypeKind()) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + bRet = ::rtl::OUString(m_aValue.m_pString).toInt32() != 0; + break; + case DataType::LONGVARCHAR: + bRet = getString().toInt32() != 0; + break; + case DataType::DOUBLE: + case DataType::FLOAT: + case DataType::REAL: + bRet = *(double*)m_aValue.m_pValue != 0.0; + break; + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + OSL_ASSERT("getBool() for this type is not allowed!"); + break; + case DataType::BIT: + bRet = m_aValue.m_bBool; + break; + case DataType::TINYINT: + bRet = m_aValue.m_nInt8 != 0; + break; + case DataType::SMALLINT: + bRet = m_aValue.m_nInt16 != 0; + break; + case DataType::INTEGER: + bRet = m_aValue.m_nInt32 != 0; + break; + } } return bRet; } @@ -646,42 +652,45 @@ sal_Int8 ORowSetValue::getInt8() const OSL_ENSURE(m_bBound,"Value is not bound!"); sal_Int8 nRet = 0; - switch(getTypeKind()) + if(!m_bNull) { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - nRet = sal_Int8(::rtl::OUString(m_aValue.m_pString).toInt32()); - break; - case DataType::LONGVARCHAR: - nRet = sal_Int8(getString().toInt32()); - break; - case DataType::DOUBLE: - case DataType::FLOAT: - case DataType::REAL: - nRet = sal_Int8(*(double*)m_aValue.m_pValue); - break; - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - OSL_ASSERT("getInt8() for this type is not allowed!"); - break; - case DataType::BIT: - nRet = m_aValue.m_bBool; - break; - case DataType::TINYINT: - nRet = m_aValue.m_nInt8; - break; - case DataType::SMALLINT: - nRet = sal_Int8(m_aValue.m_nInt16); - break; - case DataType::INTEGER: - nRet = sal_Int8(m_aValue.m_nInt32); - break; + switch(getTypeKind()) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + nRet = sal_Int8(::rtl::OUString(m_aValue.m_pString).toInt32()); + break; + case DataType::LONGVARCHAR: + nRet = sal_Int8(getString().toInt32()); + break; + case DataType::DOUBLE: + case DataType::FLOAT: + case DataType::REAL: + nRet = sal_Int8(*(double*)m_aValue.m_pValue); + break; + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + OSL_ASSERT("getInt8() for this type is not allowed!"); + break; + case DataType::BIT: + nRet = m_aValue.m_bBool; + break; + case DataType::TINYINT: + nRet = m_aValue.m_nInt8; + break; + case DataType::SMALLINT: + nRet = sal_Int8(m_aValue.m_nInt16); + break; + case DataType::INTEGER: + nRet = sal_Int8(m_aValue.m_nInt32); + break; + } } return nRet; } @@ -691,42 +700,45 @@ sal_Int16 ORowSetValue::getInt16() const OSL_ENSURE(m_bBound,"Value is not bound!"); sal_Int16 nRet = 0; - switch(getTypeKind()) + if(!m_bNull) { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - nRet = sal_Int16(::rtl::OUString(m_aValue.m_pString).toInt32()); - break; - case DataType::LONGVARCHAR: - nRet = sal_Int16(getString().toInt32()); - break; - case DataType::DOUBLE: - case DataType::FLOAT: - case DataType::REAL: - nRet = sal_Int16(*(double*)m_aValue.m_pValue); - break; - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - OSL_ASSERT("getInt16() for this type is not allowed!"); - break; - case DataType::BIT: - nRet = m_aValue.m_bBool; - break; - case DataType::TINYINT: - nRet = m_aValue.m_nInt8; - break; - case DataType::SMALLINT: - nRet = m_aValue.m_nInt16; - break; - case DataType::INTEGER: - nRet = (sal_Int16)m_aValue.m_nInt32; - break; + switch(getTypeKind()) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + nRet = sal_Int16(::rtl::OUString(m_aValue.m_pString).toInt32()); + break; + case DataType::LONGVARCHAR: + nRet = sal_Int16(getString().toInt32()); + break; + case DataType::DOUBLE: + case DataType::FLOAT: + case DataType::REAL: + nRet = sal_Int16(*(double*)m_aValue.m_pValue); + break; + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + OSL_ASSERT("getInt16() for this type is not allowed!"); + break; + case DataType::BIT: + nRet = m_aValue.m_bBool; + break; + case DataType::TINYINT: + nRet = m_aValue.m_nInt8; + break; + case DataType::SMALLINT: + nRet = m_aValue.m_nInt16; + break; + case DataType::INTEGER: + nRet = (sal_Int16)m_aValue.m_nInt32; + break; + } } return nRet; } @@ -736,44 +748,47 @@ sal_Int32 ORowSetValue::getInt32() const OSL_ENSURE(m_bBound,"Value is not bound!"); sal_Int32 nRet = 0; - switch(getTypeKind()) + if(!m_bNull) { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - nRet = ::rtl::OUString(m_aValue.m_pString).toInt32(); - break; - case DataType::LONGVARCHAR: - nRet = getString().toInt32(); - break; - case DataType::DOUBLE: - case DataType::FLOAT: - case DataType::REAL: - nRet = sal_Int32(*(double*)m_aValue.m_pValue); - break; - case DataType::DATE: - nRet = dbtools::DBTypeConversion::toDays(*(::com::sun::star::util::Date*)m_aValue.m_pValue); - break; - case DataType::TIME: - case DataType::TIMESTAMP: - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - OSL_ASSERT("getInt32() for this type is not allowed!"); - break; - case DataType::BIT: - nRet = m_aValue.m_bBool; - break; - case DataType::TINYINT: - nRet = m_aValue.m_nInt8; - break; - case DataType::SMALLINT: - nRet = m_aValue.m_nInt16; - break; - case DataType::INTEGER: - nRet = m_aValue.m_nInt32; - break; + switch(getTypeKind()) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + nRet = ::rtl::OUString(m_aValue.m_pString).toInt32(); + break; + case DataType::LONGVARCHAR: + nRet = getString().toInt32(); + break; + case DataType::DOUBLE: + case DataType::FLOAT: + case DataType::REAL: + nRet = sal_Int32(*(double*)m_aValue.m_pValue); + break; + case DataType::DATE: + nRet = dbtools::DBTypeConversion::toDays(*(::com::sun::star::util::Date*)m_aValue.m_pValue); + break; + case DataType::TIME: + case DataType::TIMESTAMP: + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + OSL_ASSERT("getInt32() for this type is not allowed!"); + break; + case DataType::BIT: + nRet = m_aValue.m_bBool; + break; + case DataType::TINYINT: + nRet = m_aValue.m_nInt8; + break; + case DataType::SMALLINT: + nRet = m_aValue.m_nInt16; + break; + case DataType::INTEGER: + nRet = m_aValue.m_nInt32; + break; + } } return nRet; } @@ -783,48 +798,51 @@ double ORowSetValue::getDouble() const OSL_ENSURE(m_bBound,"Value is not bound!"); double nRet = 0; - switch(getTypeKind()) + if(!m_bNull) { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - nRet = ::rtl::OUString(m_aValue.m_pString).toDouble(); - break; - case DataType::LONGVARCHAR: - nRet = getString().toDouble(); - break; - case DataType::DOUBLE: - case DataType::FLOAT: - case DataType::REAL: - nRet = *(double*)m_aValue.m_pValue; - break; - case DataType::DATE: - nRet = dbtools::DBTypeConversion::toDouble(*(::com::sun::star::util::Date*)m_aValue.m_pValue); - break; - case DataType::TIME: - nRet = dbtools::DBTypeConversion::toDouble(*(::com::sun::star::util::Time*)m_aValue.m_pValue); - break; - case DataType::TIMESTAMP: - nRet = dbtools::DBTypeConversion::toDouble(*(::com::sun::star::util::DateTime*)m_aValue.m_pValue); - break; - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - OSL_ASSERT("getDouble() for this type is not allowed!"); - break; - case DataType::BIT: - nRet = m_aValue.m_bBool; - break; - case DataType::TINYINT: - nRet = m_aValue.m_nInt8; - break; - case DataType::SMALLINT: - nRet = m_aValue.m_nInt16; - break; - case DataType::INTEGER: - nRet = m_aValue.m_nInt32; - break; + switch(getTypeKind()) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + nRet = ::rtl::OUString(m_aValue.m_pString).toDouble(); + break; + case DataType::LONGVARCHAR: + nRet = getString().toDouble(); + break; + case DataType::DOUBLE: + case DataType::FLOAT: + case DataType::REAL: + nRet = *(double*)m_aValue.m_pValue; + break; + case DataType::DATE: + nRet = dbtools::DBTypeConversion::toDouble(*(::com::sun::star::util::Date*)m_aValue.m_pValue); + break; + case DataType::TIME: + nRet = dbtools::DBTypeConversion::toDouble(*(::com::sun::star::util::Time*)m_aValue.m_pValue); + break; + case DataType::TIMESTAMP: + nRet = dbtools::DBTypeConversion::toDouble(*(::com::sun::star::util::DateTime*)m_aValue.m_pValue); + break; + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + OSL_ASSERT("getDouble() for this type is not allowed!"); + break; + case DataType::BIT: + nRet = m_aValue.m_bBool; + break; + case DataType::TINYINT: + nRet = m_aValue.m_nInt8; + break; + case DataType::SMALLINT: + nRet = m_aValue.m_nInt16; + break; + case DataType::INTEGER: + nRet = m_aValue.m_nInt32; + break; + } } return nRet; } diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx index d0dc3601fe06..e22adfc61ec8 100644 --- a/connectivity/source/commontools/TConnection.cxx +++ b/connectivity/source/commontools/TConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TConnection.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-04-27 10:06:13 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:42:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,6 +70,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace::osl; +::dbtools::OPropertyMap OMetaConnection::s_aPropertyNameMap; //XUnoTunnel sal_Int64 SAL_CALL OMetaConnection::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException) { @@ -94,5 +95,9 @@ Sequence< sal_Int8 > OMetaConnection::getUnoTunnelImplementationId() return pId->getImplementationId(); } // ----------------------------------------------------------------------------- - +::dbtools::OPropertyMap& OMetaConnection::getPropMap() +{ + return s_aPropertyNameMap; +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx index 551ac4d6746e..3c614b72b2be 100644 --- a/connectivity/source/commontools/dbexception.cxx +++ b/connectivity/source/commontools/dbexception.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbexception.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: fs $ $Date: 2001-04-19 07:05:17 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:42:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,11 +77,9 @@ #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" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif - using namespace comphelper; //......................................................................... @@ -89,7 +87,7 @@ namespace dbtools { //......................................................................... - using namespace connectivity::dbtools; + using namespace connectivity; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; @@ -373,21 +371,26 @@ const ::com::sun::star::sdbc::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){}; - //------------------------------------------------------------ -void throwFunctionSequenceException(const Reference< XInterface >& _Context, const Any& _Next) +void throwFunctionSequenceException(const Reference< XInterface >& _Context, const Any& _Next) throw ( ::com::sun::star::sdbc::SQLException ) { - throw SQLException(ERRORMSG_SEQUENCE, _Context, SQLSTATE_SEQUENCE, 0, _Next); + throw SQLException(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE), _Context, OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000), 0, _Next); } - +// ----------------------------------------------------------------------------- +void throwInvalidIndexException(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context, + const ::com::sun::star::uno::Any& _Next) throw ( ::com::sun::star::sdbc::SQLException ) +{ + static ::rtl::OUString sStatus = ::rtl::OUString::createFromAscii("07009"); + throw SQLException(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_INVALID_INDEX),_Context,sStatus,0,Any()); +} +// ----------------------------------------------------------------------------- +void throwGenericSQLException(const ::rtl::OUString& _rMsg, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource) + throw (::com::sun::star::sdbc::SQLException) +{ + static ::rtl::OUString sStatus = ::rtl::OUString::createFromAscii("S1000"); + throw ::com::sun::star::sdbc::SQLException(_rMsg, _rxSource, sStatus, 0, ::com::sun::star::uno::Any()); +} +// ----------------------------------------------------------------------------- //......................................................................... } // namespace dbtools //......................................................................... @@ -396,6 +399,9 @@ void throwFunctionSequenceException(const Reference< XInterface >& _Context, con /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.6 2001/04/19 07:05:17 fs + * +throwFunctionSequenceException + * * Revision 1.5 2001/03/21 13:37:07 jl * OSL_ENSHURE replaced by OSL_ENSURE * diff --git a/connectivity/source/drivers/adabas/BColumns.cxx b/connectivity/source/drivers/adabas/BColumns.cxx index f42e87ac4db1..048d80f4971f 100644 --- a/connectivity/source/drivers/adabas/BColumns.cxx +++ b/connectivity/source/drivers/adabas/BColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BColumns.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:19 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,10 +83,6 @@ #ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ #include "adabas/BTable.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::adabas; @@ -155,37 +151,37 @@ void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& des aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + aDot + aQuote + m_pTable->getTableName() + aQuote; aSql = aSql + ::rtl::OUString::createFromAscii(" ADD "); - aSql = aSql + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql = aSql + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; aSql = aSql + ::rtl::OUString::createFromAscii(" "); - Any aTypeName = descriptor->getPropertyValue(PROPERTY_TYPENAME); + Any aTypeName = descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); if(aTypeName.hasValue() && getString(aTypeName).getLength()) aSql = aSql + getString(aTypeName); else aSql = aSql + getTypeString(descriptor) + ::rtl::OUString::createFromAscii(" "); - // aSql = aSql + getString(descriptor->getPropertyValue(PROPERTY_TYPENAME)); + // aSql = aSql + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); - switch(getINT32(descriptor->getPropertyValue(PROPERTY_TYPE))) + switch(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { - case DataType::CHAR: - case DataType::VARCHAR: + case DataType::CHAR: + case DataType::VARCHAR: aSql = aSql + ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) + ::rtl::OUString::createFromAscii(")"); break; - case DataType::DECIMAL: - case DataType::NUMERIC: + case DataType::DECIMAL: + case DataType::NUMERIC: aSql = aSql + ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) + ::rtl::OUString::createFromAscii(",") - + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))) + ::rtl::OUString::createFromAscii(")"); break; } - ::rtl::OUString aDefault = getString(descriptor->getPropertyValue(PROPERTY_DEFAULTVALUE)); - if(getINT32(descriptor->getPropertyValue(PROPERTY_ISNULLABLE)) == ColumnValue::NO_NULLS) + ::rtl::OUString aDefault = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); + if(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS) { aSql = aSql + ::rtl::OUString::createFromAscii(" NOT NULL"); if(aDefault.getLength()) @@ -194,7 +190,7 @@ void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& des else if(aDefault.getLength()) aSql = aSql + ::rtl::OUString::createFromAscii(" DEFAULT ") + aDefault; - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); xStmt->execute(aSql); } OCollection_TYPE::appendByDescriptor(descriptor); @@ -214,7 +210,7 @@ void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(S aSql = aSql + ::rtl::OUString::createFromAscii(" DROP "); aSql = aSql + aQuote + elementName + aQuote; - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); xStmt->execute(aSql); } @@ -237,7 +233,7 @@ void SAL_CALL OColumns::dropByIndex( sal_Int32 index ) throw(SQLException, Index aSql = aSql + ::rtl::OUString::createFromAscii(" DROP "); aSql = aSql + aQuote + m_aElements[index]->first + aQuote; - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); xStmt->execute(aSql); } OCollection_TYPE::dropByIndex(index); diff --git a/connectivity/source/drivers/adabas/BGroup.cxx b/connectivity/source/drivers/adabas/BGroup.cxx index 4a4db5af27cb..9fd02f248fd5 100644 --- a/connectivity/source/drivers/adabas/BGroup.cxx +++ b/connectivity/source/drivers/adabas/BGroup.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BGroup.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:40 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,10 +74,6 @@ #ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ #include "adabas/BConnection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::adabas; using namespace ::com::sun::star::uno; diff --git a/connectivity/source/drivers/adabas/BGroups.cxx b/connectivity/source/drivers/adabas/BGroups.cxx index 9d5853cce9a4..a956813c6809 100644 --- a/connectivity/source/drivers/adabas/BGroups.cxx +++ b/connectivity/source/drivers/adabas/BGroups.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BGroups.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:19 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,10 +77,6 @@ #ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ #include "sdbcx/IRefreshable.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::adabas; using namespace ::com::sun::star::uno; @@ -114,7 +110,7 @@ Reference< XPropertySet > OGroups::createEmptyObject() void SAL_CALL OGroups::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); @@ -123,7 +119,7 @@ void SAL_CALL OGroups::appendByDescriptor( const Reference< XPropertySet >& desc ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USERGROUP "); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - aSql = aSql + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql = aSql + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; Reference< XStatement > xStmt = m_pConnection->createStatement( ); xStmt->execute(aSql); diff --git a/connectivity/source/drivers/adabas/BIndexes.cxx b/connectivity/source/drivers/adabas/BIndexes.cxx index 14dbc0dc764a..b5f153e6034d 100644 --- a/connectivity/source/drivers/adabas/BIndexes.cxx +++ b/connectivity/source/drivers/adabas/BIndexes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BIndexes.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:19 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,10 +79,6 @@ #ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ #include <com/sun/star/sdbc/IndexType.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif @@ -147,7 +143,7 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); @@ -158,7 +154,7 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); - if(getBOOL(descriptor->getPropertyValue(PROPERTY_ISUNIQUE))) + if(getBOOL(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))) aSql = aSql + ::rtl::OUString::createFromAscii("UNIQUE "); aSql = aSql + ::rtl::OUString::createFromAscii("INDEX "); @@ -177,8 +173,8 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des for(sal_Int32 i=0;i<xColumns->getCount();++i) { xColumns->getByIndex(i) >>= xColProp; - aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote; - aSql = aSql + (getBOOL(xColProp->getPropertyValue(PROPERTY_ISASCENDING)) + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; + aSql = aSql + (getBOOL(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING))) ? ::rtl::OUString::createFromAscii(" ASC") : @@ -199,7 +195,7 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des xColumns->getByIndex(0) >>= xColProp; - aSql = aSql + aDot + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql = aSql + aDot + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; } Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); diff --git a/connectivity/source/drivers/adabas/BKeys.cxx b/connectivity/source/drivers/adabas/BKeys.cxx index c3ff6c947a59..67e436c99a17 100644 --- a/connectivity/source/drivers/adabas/BKeys.cxx +++ b/connectivity/source/drivers/adabas/BKeys.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BKeys.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:19 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,10 +80,7 @@ #ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ #include <com/sun/star/sdbc/KeyRule.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif + using namespace connectivity::adabas; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -174,16 +171,16 @@ Reference< XPropertySet > OKeys::createEmptyObject() void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) { - if(aName.getLength() || getINT32(descriptor->getPropertyValue(PROPERTY_TYPE)) == KeyType::PRIMARY) // check if this isn't a primary key + if(aName.getLength() || getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == KeyType::PRIMARY) // check if this isn't a primary key throw ElementExistException(aName,*this); } if(!m_pTable->isNew()) { - sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(PROPERTY_TYPE)); + sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); @@ -208,16 +205,16 @@ void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descri { Reference< XPropertySet > xColProp; xColumns->getByIndex(i) >>= xColProp; - aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + ::rtl::OUString::createFromAscii(","); } aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); if(nKeyType == KeyType::FOREIGN) { - sal_Int32 nDeleteRule = getINT32(descriptor->getPropertyValue(PROPERTY_DELETERULE)); + sal_Int32 nDeleteRule = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE))); - ::rtl::OUString aName,aSchema,aRefTable = getString(descriptor->getPropertyValue(PROPERTY_REFERENCEDTABLE)); + ::rtl::OUString aName,aSchema,aRefTable = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE))); sal_Int32 nLen = aRefTable.indexOf('.'); aSchema = aRefTable.copy(0,nLen); aName = aRefTable.copy(nLen+1); @@ -229,7 +226,7 @@ void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descri { Reference< XPropertySet > xColProp; xColumns->getByIndex(i) >>= xColProp; - aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_RELATEDCOLUMN)) + aQuote + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN))) + aQuote + ::rtl::OUString::createFromAscii(","); } aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); @@ -268,7 +265,7 @@ void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descri ObjectMap::iterator aIter = m_aNameMap.find(sName); if( aIter == m_aNameMap.end()) // this name wasn't inserted yet so it must be te new one { - descriptor->setPropertyValue(PROPERTY_NAME,makeAny(sName)); + descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sName)); break; } } @@ -293,7 +290,7 @@ void SAL_CALL OKeys::dropByName( const ::rtl::OUString& elementName ) throw(SQLE ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); Reference<XPropertySet> xKey(aIter->second,UNO_QUERY); - sal_Int32 nKeyType = getINT32(xKey->getPropertyValue(PROPERTY_TYPE)); + sal_Int32 nKeyType = getINT32(xKey->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); aSql += aQuote + m_pTable->getSchema() + aQuote + aDot + aQuote + m_pTable->getTableName() + aQuote; if(nKeyType == KeyType::PRIMARY) diff --git a/connectivity/source/drivers/adabas/BTable.cxx b/connectivity/source/drivers/adabas/BTable.cxx index ed921cf5e3ef..3fb3e38609d3 100644 --- a/connectivity/source/drivers/adabas/BTable.cxx +++ b/connectivity/source/drivers/adabas/BTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BTable.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:40 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,10 +95,6 @@ #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif @@ -197,8 +193,9 @@ void OAdabasTable::refreshKeys() refreshForgeinKeys(aVector); } if(m_pKeys) - delete m_pKeys; - m_pKeys = new OKeys(this,m_aMutex,aVector); + m_pKeys->reFill(aVector); + else + m_pKeys = new OKeys(this,m_aMutex,aVector); } // ------------------------------------------------------------------------- void OAdabasTable::refreshIndexes() @@ -233,8 +230,9 @@ void OAdabasTable::refreshIndexes() } if(m_pIndexes) - delete m_pIndexes; - m_pIndexes = new OIndexes(this,m_aMutex,aVector); + m_pIndexes->reFill(aVector); + else + m_pIndexes = new OIndexes(this,m_aMutex,aVector); } //-------------------------------------------------------------------------- Sequence< sal_Int8 > OAdabasTable::getUnoTunnelImplementationId() @@ -277,31 +275,31 @@ sal_Bool OAdabasTable::create() throw(SQLException, RuntimeException) for(sal_Int32 i=0;i<nCount;++i) { ::cppu::extractInterface(xProp,m_pColumns->getByIndex(i)); - aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote - + getString(xProp->getPropertyValue(PROPERTY_TYPENAME)); + aSql += aQuote + getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + + getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); // add type definition - switch(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + switch(getINT32(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { case DataType::CHAR: case DataType::VARCHAR: aSql += ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) + ::rtl::OUString::createFromAscii(")"); break; case DataType::DECIMAL: case DataType::NUMERIC: aSql += ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) + ::rtl::OUString::createFromAscii(",") - + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))) + ::rtl::OUString::createFromAscii(")"); break; } - ::rtl::OUString aDefault = getString(xProp->getPropertyValue(PROPERTY_DEFAULTVALUE)); - if(getINT32(xProp->getPropertyValue(PROPERTY_ISNULLABLE)) == ColumnValue::NO_NULLS) + ::rtl::OUString aDefault = getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); + if(getINT32(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS) { aSql += ::rtl::OUString::createFromAscii(" NOT NULL"); if(aDefault.getLength()) @@ -321,7 +319,7 @@ sal_Bool OAdabasTable::create() throw(SQLException, RuntimeException) ::cppu::extractInterface(xProp,m_pKeys->getByIndex(i)); Reference< XColumnsSupplier > xKey(xProp,UNO_QUERY); Reference< ::com::sun::star::container::XIndexAccess > xCols(xKey->getColumns(),UNO_QUERY); - switch(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + switch(getINT32(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { case KeyType::PRIMARY: { @@ -331,7 +329,7 @@ sal_Bool OAdabasTable::create() throw(SQLException, RuntimeException) for(sal_Int32 i=0;i<nCols;++i) { ::cppu::extractInterface(xProp,xCols->getByIndex(i)); - aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql += aQuote + getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; aSql += aComma; } if(nCols) @@ -345,7 +343,7 @@ sal_Bool OAdabasTable::create() throw(SQLException, RuntimeException) for(sal_Int32 i=0;i<nCols;++i) { ::cppu::extractInterface(xProp,xCols->getByIndex(i)); - aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql += aQuote + getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; aSql += aComma; } if(nCols) @@ -357,9 +355,9 @@ sal_Bool OAdabasTable::create() throw(SQLException, RuntimeException) if(nCols) { aSql += ::rtl::OUString::createFromAscii(" FOREIGN KEY( "); - ::rtl::OUString aKeyName = getString(xProp->getPropertyValue(PROPERTY_NAME)); - ::rtl::OUString aRefTableName = getString(xProp->getPropertyValue(PROPERTY_REFERENCEDTABLE)); - sal_Int32 nDeleteRule = getINT32(xProp->getPropertyValue(PROPERTY_DELETERULE)); + ::rtl::OUString aKeyName = getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); + ::rtl::OUString aRefTableName = getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE))); + sal_Int32 nDeleteRule = getINT32(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE))); if(aKeyName.getLength()) { aSql += aQuote + aKeyName + aQuote; @@ -369,7 +367,7 @@ sal_Bool OAdabasTable::create() throw(SQLException, RuntimeException) for(sal_Int32 i=0;i<nCols;++i) { ::cppu::extractInterface(xProp,xCols->getByIndex(i)); - aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql += aQuote + getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; aSql += aComma; } aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); @@ -456,7 +454,7 @@ void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, c if(!isNew()) { - if(getString(descriptor->getPropertyValue(PROPERTY_NAME)) != colName) + if(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) != colName) throw SQLException(::rtl::OUString::createFromAscii("Not supported by this driver!"),*this,::rtl::OUString::createFromAscii("S1000"),0,Any() ); Reference< XStatement > xStmt = m_pConnection->createStatement(); @@ -469,22 +467,22 @@ void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, c m_pColumns->getByName(colName) >>= xProp; // first check the types sal_Int32 nOldType = 0,nNewType = 0; - xProp->getPropertyValue(PROPERTY_TYPE) >>= nOldType; - descriptor->getPropertyValue(PROPERTY_TYPE) >>= nNewType; + xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nOldType; + descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nNewType; if(nOldType != nNewType) alterColumnType(nNewType,colName,descriptor); // second: check the "is nullable" value sal_Int32 nOldNullable = 0,nNewNullable = 0; - xProp->getPropertyValue(PROPERTY_ISNULLABLE) >>= nOldNullable; - descriptor->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNewNullable; + xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nOldNullable; + descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nNewNullable; if(nNewNullable != nOldNullable) alterNotNullValue(nNewNullable,colName); // third: check the default values ::rtl::OUString sNewDefault,sOldDefault; - xProp->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sOldDefault; - descriptor->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sNewDefault; + xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sOldDefault; + descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sNewDefault; if(sOldDefault.getLength()) { @@ -533,14 +531,14 @@ void SAL_CALL OAdabasTable::alterColumnByIndex( sal_Int32 index, const Reference Reference< XPropertySet > xOld; if(::cppu::extractInterface(xOld,m_pColumns->getByIndex(index)) && xOld.is()) - alterColumnByName(getString(xOld->getPropertyValue(PROPERTY_NAME)),descriptor); + alterColumnByName(getString(xOld->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),descriptor); } // ------------------------------------------------------------------------- ::rtl::OUString connectivity::adabas::getTypeString(const Reference< ::com::sun::star::beans::XPropertySet >& xColProp) { ::rtl::OUString aValue; - switch(getINT32(xColProp->getPropertyValue(PROPERTY_TYPE))) + switch(getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { case DataType::BIT: aValue = ::rtl::OUString::createFromAscii("BOOLEAN"); @@ -628,23 +626,23 @@ void OAdabasTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rC + ::rtl::OUString::createFromAscii(" COLUMN ") + aQuote + _rColName + aQuote; aSql += ::rtl::OUString::createFromAscii(" ") - + getString(_xDescriptor->getPropertyValue(PROPERTY_TYPENAME)); + + getString(_xDescriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); switch(nNewType) { case DataType::CHAR: case DataType::VARCHAR: aSql += ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(_xDescriptor->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::valueOf(getINT32(_xDescriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) + ::rtl::OUString::createFromAscii(")"); break; case DataType::DECIMAL: case DataType::NUMERIC: aSql += ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(_xDescriptor->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::valueOf(getINT32(_xDescriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) + ::rtl::OUString::createFromAscii(",") - + ::rtl::OUString::valueOf(getINT32(_xDescriptor->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::valueOf(getINT32(_xDescriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))) + ::rtl::OUString::createFromAscii(")"); break; } diff --git a/connectivity/source/drivers/adabas/BUser.cxx b/connectivity/source/drivers/adabas/BUser.cxx index b943ea35bc12..f6cdcc7b4462 100644 --- a/connectivity/source/drivers/adabas/BUser.cxx +++ b/connectivity/source/drivers/adabas/BUser.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BUser.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:40 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,10 +74,6 @@ #ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ #include "adabas/BConnection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::adabas; using namespace ::com::sun::star::uno; @@ -148,7 +144,7 @@ typedef connectivity::sdbcx::OUser OUser_TYPEDEF; void OUserExtend::construct() { OUser_TYPEDEF::construct(); - registerProperty(PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const diff --git a/connectivity/source/drivers/adabas/BUsers.cxx b/connectivity/source/drivers/adabas/BUsers.cxx index ca0c29de09ea..724f2a4cc5a8 100644 --- a/connectivity/source/drivers/adabas/BUsers.cxx +++ b/connectivity/source/drivers/adabas/BUsers.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BUsers.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:19 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,23 +77,6 @@ #ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ #include "connectivity/sdbcx/IRefreshable.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif - -// define the properties of this lib -// this file includes the properties for this dll -namespace connectivity -{ - namespace adabas - { -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" -#endif - } -} - using namespace connectivity::adabas; using namespace ::com::sun::star::uno; @@ -126,7 +109,7 @@ Reference< XPropertySet > OUsers::createEmptyObject() void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); @@ -134,9 +117,9 @@ void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descr ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USER "); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - aSql = aSql + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + aSql = aSql + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + ::rtl::OUString::createFromAscii(" PASSWORD ") - + getString(descriptor->getPropertyValue(PROPERTY_PASSWORD)); + + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD))); Reference< XStatement > xStmt = m_pConnection->createStatement( ); xStmt->execute(aSql); diff --git a/connectivity/source/drivers/adabas/BViews.cxx b/connectivity/source/drivers/adabas/BViews.cxx index 51560af74b84..98f2b4a3fdaa 100644 --- a/connectivity/source/drivers/adabas/BViews.cxx +++ b/connectivity/source/drivers/adabas/BViews.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BViews.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-04-24 14:13:16 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,10 +84,6 @@ #ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ #include "adabas/BConnection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE adabas -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif @@ -179,7 +175,7 @@ Reference< XPropertySet > OViews::createEmptyObject() void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); @@ -244,15 +240,15 @@ void OViews::createView( const Reference< XPropertySet >& descriptor ) ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."),sSchema,sCommand; - descriptor->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema; + descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema; if(sSchema.getLength()) aSql += ::dbtools::quoteName(aQuote, sSchema) + aDot; else - descriptor->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getUserName())); + descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),makeAny(sSchema = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getUserName())); - aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(PROPERTY_NAME))) + aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))) + ::rtl::OUString::createFromAscii(" AS "); - descriptor->getPropertyValue(PROPERTY_COMMAND) >>= sCommand; + descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand; aSql += sCommand; OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); @@ -265,7 +261,7 @@ void OViews::createView( const Reference< XPropertySet >& descriptor ) { ::rtl::OUString sName = sSchema; sName += aDot; - sName += getString(descriptor->getPropertyValue(PROPERTY_NAME)); + sName += getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); pTables->appendNew(sName); } } diff --git a/connectivity/source/drivers/ado/ACatalog.cxx b/connectivity/source/drivers/ado/ACatalog.cxx index aead9372ba78..1b1d59034f3a 100644 --- a/connectivity/source/drivers/ado/ACatalog.cxx +++ b/connectivity/source/drivers/ado/ACatalog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ACatalog.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:57:36 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,7 @@ // ------------------------------------------------------------------------- +using namespace connectivity; using namespace connectivity::ado; // ------------------------------------------------------------------------- OCatalog::OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx index 7777f9f86819..118311fa3648 100644 --- a/connectivity/source/drivers/ado/AColumn.cxx +++ b/connectivity/source/drivers/ado/AColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AColumn.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,10 +77,6 @@ #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif @@ -159,8 +155,8 @@ void OAdoColumn::construct() { sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_ISASCENDING, PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType()); - registerProperty(PROPERTY_RELATEDCOLUMN, PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx index 9607b1d12718..5038e1ad7413 100644 --- a/connectivity/source/drivers/ado/AColumns.cxx +++ b/connectivity/source/drivers/ado/AColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AColumns.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-27 11:38:25 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,10 +83,6 @@ #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::ado; using namespace connectivity; using namespace com::sun::star::uno; @@ -135,7 +131,7 @@ void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& des ADOS::ThrowException(*m_pConnection->getConnection(),*this); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not append column!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not append column!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } OCollection_TYPE::appendByDescriptor(descriptor); diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 578d0a033910..407de502f738 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AConnection.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-04-27 10:08:08 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:41:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -100,8 +100,8 @@ #include <cppuhelper/typeprovider.hxx> #endif +using namespace dbtools; using namespace connectivity::ado; -using namespace connectivity::dbtools; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx index ac8c9cffe9f5..fa4e01b43973 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ADatabaseMetaDataResultSet.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:57:36 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:42:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,10 +65,6 @@ #ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ #include "ado/ADatabaseMetaDataResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX_ #include "ado/ADatabaseMetaDataResultSetMetaData.hxx" #endif @@ -105,6 +101,9 @@ #ifndef _COMPHELPER_SEQSTREAM_HXX #include <comphelper/seqstream.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif #include <oledb.h> diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx index 315256501c67..107bcc627fee 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ADatabaseMetaDataResultSetMetaData.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,9 +76,8 @@ #ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ #include "ado/Awrapado.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" #endif using namespace connectivity; diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx index afd08bcc0c83..ff399ca6729e 100644 --- a/connectivity/source/drivers/ado/AGroup.cxx +++ b/connectivity/source/drivers/ado/AGroup.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AGroup.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,10 +90,10 @@ #ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ #include "ado/AConnection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif + using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx index 354580f7e2eb..63a835402253 100644 --- a/connectivity/source/drivers/ado/AGroups.cxx +++ b/connectivity/source/drivers/ado/AGroups.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AGroups.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,6 +77,10 @@ #ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ #include "connectivity/sdbcx/IRefreshable.hxx" #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif + using namespace connectivity::ado; using namespace com::sun::star::uno; diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx index ce93fe8d27d9..4582db03ff4f 100644 --- a/connectivity/source/drivers/ado/AIndex.cxx +++ b/connectivity/source/drivers/ado/AIndex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AIndex.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,13 +77,12 @@ #ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ #include "ado/AColumns.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif using namespace connectivity::ado; using namespace com::sun::star::uno; diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx index 9f8baa47ab91..8115897e2af4 100644 --- a/connectivity/source/drivers/ado/AIndexes.cxx +++ b/connectivity/source/drivers/ado/AIndexes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AIndexes.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,11 +73,12 @@ #ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ #include <com/sun/star/sdbc/IndexType.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif + +using namespace connectivity; using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -118,10 +119,10 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des { OAdoIndex* pIndex = (OAdoIndex*)xTunnel->getSomething(OAdoIndex:: getUnoTunnelImplementationId()); if(pIndex) - m_pCollection->Append(OLEVariant(getString(descriptor->getPropertyValue(PROPERTY_NAME))), + m_pCollection->Append(OLEVariant(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))), OLEVariant(pIndex->getImpl())); else - throw SQLException(::rtl::OUString::createFromAscii("Could not append index!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not append index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } OCollection_TYPE::appendByDescriptor(descriptor); diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx index b5a33c6903bf..163bc9c5d162 100644 --- a/connectivity/source/drivers/ado/AKey.cxx +++ b/connectivity/source/drivers/ado/AKey.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AKey.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,10 +83,10 @@ #ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ #include "ado/AColumns.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif + using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; diff --git a/connectivity/source/drivers/ado/AKeyColumn.cxx b/connectivity/source/drivers/ado/AKeyColumn.cxx index 2ed8f753acec..23ad5ef5dbae 100644 --- a/connectivity/source/drivers/ado/AKeyColumn.cxx +++ b/connectivity/source/drivers/ado/AKeyColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AKeyColumn.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,10 +92,11 @@ OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, { construct(); } + // ------------------------------------------------------------------------- void OKeyColumn::construct() { sal_Int32 nAttrib = isNew() ? 0 : starbeans::PropertyAttribute::READONLY; - registerProperty(PROPERTY_REFERENCEDCOLUMN, PROPERTY_ID_REFERENCEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDCOLUMN), PROPERTY_ID_REFERENCEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx index f59de10e8205..9536b828c8f9 100644 --- a/connectivity/source/drivers/ado/AKeys.cxx +++ b/connectivity/source/drivers/ado/AKeys.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AKeys.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,10 +77,12 @@ #ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ #include <com/sun/star/sdbc/KeyRule.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif + + +using namespace connectivity; using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -127,10 +129,10 @@ void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descri vOptional.vt = VT_ERROR; vOptional.scode = DISP_E_PARAMNOTFOUND; - m_pCollection->Append(OLEVariant(pKey->getImpl()),(KeyTypeEnum)getINT32(descriptor->getPropertyValue(PROPERTY_TYPE)),vOptional); + m_pCollection->Append(OLEVariant(pKey->getImpl()),(KeyTypeEnum)getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))),vOptional); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } OCollection_TYPE::appendByDescriptor(descriptor); diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx index c71315979f66..6ddaa52c2769 100644 --- a/connectivity/source/drivers/ado/APreparedStatement.cxx +++ b/connectivity/source/drivers/ado/APreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: APreparedStatement.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,9 @@ #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif #define CHECK_RETURN(x) \ if(!x) \ diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index e94b69877253..43fb0534c0b4 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AResultSet.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,10 +63,6 @@ #ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ #include "ado/AResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ #include "ado/AResultSetMetaData.hxx" #endif @@ -106,8 +102,8 @@ #ifndef _COMPHELPER_SEQSTREAM_HXX #include <comphelper/seqstream.hxx> #endif -#ifndef _COMPHELPER_SEQSTREAM_HXX -#include <comphelper/seqstream.hxx> +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" #endif diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx index d9580947c215..2e2ed7ad5f53 100644 --- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx +++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AResultSetMetaData.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,9 +72,8 @@ #ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ #include "ado/Awrapado.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" #endif using namespace connectivity; diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx index 0a9a74dfaf7d..adce16cb9088 100644 --- a/connectivity/source/drivers/ado/AStatement.cxx +++ b/connectivity/source/drivers/ado/AStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AStatement.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,10 +67,6 @@ #ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ #include "ado/AResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> #endif @@ -104,17 +100,6 @@ ADOS::ThrowException(*m_pConnection->getConnection(),*this); -// define the properties of this lib -// this file includes the properties for this dll -namespace connectivity -{ - namespace ado - { -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" -#endif - } -} using namespace connectivity::ado; diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx index 1064aaba3d5f..34a2a42d3b46 100644 --- a/connectivity/source/drivers/ado/ATable.cxx +++ b/connectivity/source/drivers/ado/ATable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ATable.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,10 +101,11 @@ #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif + +using namespace connectivity; using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -289,7 +290,7 @@ void SAL_CALL OAdoTable::alterColumnByName( const ::rtl::OUString& colName, cons m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl())); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by name!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by name!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } m_pColumns->refresh(); @@ -312,7 +313,7 @@ void SAL_CALL OAdoTable::alterColumnByIndex( sal_Int32 index, const Reference< X m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl())); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by index!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } m_pColumns->refresh(); } diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx index 0720065db007..8cf847b7668e 100644 --- a/connectivity/source/drivers/ado/ATables.cxx +++ b/connectivity/source/drivers/ado/ATables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ATables.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-27 11:38:25 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,11 +89,11 @@ #ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ #include "ado/Awrapado.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif +using namespace connectivity; using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -140,7 +140,7 @@ void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& desc ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not append table!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not append table!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } OCollection_TYPE::appendByDescriptor(descriptor); diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx index fcab27da4889..3b7cdc16e830 100644 --- a/connectivity/source/drivers/ado/AUser.cxx +++ b/connectivity/source/drivers/ado/AUser.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AUser.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,10 +80,6 @@ #ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ #include "ado/AConnection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::ado; using namespace com::sun::star::uno; @@ -225,11 +221,12 @@ OUserExtend::OUserExtend(sal_Bool _bCase, ADOUser* _pUser) : OAdoUser(_bCase,_ OUserExtend::OUserExtend(sal_Bool _bCase, const ::rtl::OUString& _Name) : OAdoUser(_bCase,_Name) { } + // ------------------------------------------------------------------------- void OUserExtend::construct() { OUser_TYPEDEF::construct(); - registerProperty(PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const diff --git a/connectivity/source/drivers/ado/AView.cxx b/connectivity/source/drivers/ado/AView.cxx index 53739893103e..8c5a49a38a8f 100644 --- a/connectivity/source/drivers/ado/AView.cxx +++ b/connectivity/source/drivers/ado/AView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AView.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,10 +64,6 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ #include "ado/adoimp.hxx" #endif @@ -80,6 +76,9 @@ #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif // ------------------------------------------------------------------------- using namespace connectivity::ado; diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx index 2cfc89f9436d..6fa4ba273539 100644 --- a/connectivity/source/drivers/ado/AViews.cxx +++ b/connectivity/source/drivers/ado/AViews.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AViews.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-27 11:38:25 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,14 +85,14 @@ #ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ #include "ado/AConnection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE ado -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ #include "ado/Awrapado.hxx" #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif +using namespace connectivity; using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -122,6 +122,7 @@ Reference< XPropertySet > OViews::createEmptyObject() OAdoView* pNew = new OAdoView(isCaseSensitive()); return pNew; } + // ------------------------------------------------------------------------- // XAppend void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) @@ -134,11 +135,11 @@ void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descr OAdoView* pView = (OAdoView*)xTunnel->getSomething(OAdoView:: getUnoTunnelImplementationId()); if(pView) { - m_pCollection->Append(OLEString(getString(descriptor->getPropertyValue(PROPERTY_NAME))),(IDispatch *)pView->getImpl()); + m_pCollection->Append(OLEString(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))),(IDispatch *)pView->getImpl()); ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } OCollection_TYPE::appendByDescriptor(descriptor); diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx new file mode 100644 index 000000000000..bc91fa2c2530 --- /dev/null +++ b/connectivity/source/drivers/ado/Awrapado.cxx @@ -0,0 +1,894 @@ +/************************************************************************* + * + * $RCSfile: Awrapado.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-05-14 11:42:44 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the License); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an AS IS basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif + +using namespace connectivity::ado; + +ADOProperties* WpADOConnection::get_Properties() const +{ + ADOProperties* pProps=NULL; + pInterface->get_Properties(&pProps); + return pProps; +} + +rtl::OUString WpADOConnection::GetConnectionString() const +{ + OLEString aBSTR; + pInterface->get_ConnectionString(&aBSTR); + return aBSTR; +} + +sal_Bool WpADOConnection::PutConnectionString(const ::rtl::OUString &aCon) const +{ + OLEString bstr(aCon); + sal_Bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr)); + + return bErg; +} + +sal_Int32 WpADOConnection::GetCommandTimeout() const +{ + sal_Int32 nRet=0; + pInterface->get_CommandTimeout(&nRet); + return nRet; +} + +void WpADOConnection::PutCommandTimeout(sal_Int32 nRet) +{ + pInterface->put_CommandTimeout(nRet); +} + +sal_Int32 WpADOConnection::GetConnectionTimeout() const +{ + sal_Int32 nRet=0; + pInterface->get_ConnectionTimeout(&nRet); + return nRet; +} + +void WpADOConnection::PutConnectionTimeout(sal_Int32 nRet) +{ + pInterface->put_ConnectionTimeout(nRet); +} + +sal_Bool WpADOConnection::Close( ) +{ + return (SUCCEEDED(pInterface->Close())); +} + +sal_Bool WpADOConnection::Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset) +{ + OLEString sStr1(_CommandText); + sal_Bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,(_ADORecordset**)ppiRset)); + return bErg; +} + +sal_Bool WpADOConnection::BeginTrans() +{ + sal_Int32 nIso=0; + return SUCCEEDED(pInterface->BeginTrans(&nIso)); +} + +sal_Bool WpADOConnection::CommitTrans( ) +{ + return SUCCEEDED(pInterface->CommitTrans()); +} + +sal_Bool WpADOConnection::RollbackTrans( ) +{ + return SUCCEEDED(pInterface->RollbackTrans()); +} + +sal_Bool WpADOConnection::Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options) +{ + OLEString sStr1(ConnectionString); + OLEString sStr2(UserID); + OLEString sStr3(Password); + sal_Bool bErg = SUCCEEDED(pInterface->Open(sStr1,sStr2,sStr3,Options)); + return bErg; +} + +sal_Bool WpADOConnection::GetErrors(ADOErrors** pErrors) +{ + return SUCCEEDED(pInterface->get_Errors(pErrors)); +} + +::rtl::OUString WpADOConnection::GetDefaultDatabase() const +{ + OLEString aBSTR; pInterface->get_DefaultDatabase(&aBSTR); + return aBSTR; +} + +sal_Bool WpADOConnection::PutDefaultDatabase(const ::rtl::OUString& _bstr) +{ + OLEString bstr(_bstr); + sal_Bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr)); + + return bErg; +} + +IsolationLevelEnum WpADOConnection::get_IsolationLevel() const +{ + IsolationLevelEnum eNum=adXactUnspecified; + pInterface->get_IsolationLevel(&eNum); + return eNum; +} + +sal_Bool WpADOConnection::put_IsolationLevel(const IsolationLevelEnum& eNum) +{ + return SUCCEEDED(pInterface->put_IsolationLevel(eNum)); +} + +sal_Int32 WpADOConnection::get_Attributes() const +{ + sal_Int32 nRet=0; + pInterface->get_Attributes(&nRet); + return nRet; +} + +sal_Bool WpADOConnection::put_Attributes(sal_Int32 nRet) +{ + return SUCCEEDED(pInterface->put_Attributes(nRet)); +} + +CursorLocationEnum WpADOConnection::get_CursorLocation() const +{ + CursorLocationEnum eNum=adUseNone; + pInterface->get_CursorLocation(&eNum); + return eNum; +} + +sal_Bool WpADOConnection::put_CursorLocation(const CursorLocationEnum &eNum) +{ + return SUCCEEDED(pInterface->put_CursorLocation(eNum)); +} + +ConnectModeEnum WpADOConnection::get_Mode() const +{ + ConnectModeEnum eNum=adModeUnknown; + pInterface->get_Mode(&eNum); + return eNum; +} + +sal_Bool WpADOConnection::put_Mode(const ConnectModeEnum &eNum) +{ + + return SUCCEEDED(pInterface->put_Mode(eNum)); +} + +::rtl::OUString WpADOConnection::get_Provider() const +{ + OLEString aBSTR; pInterface->get_Provider(&aBSTR); + return aBSTR; +} + +sal_Bool WpADOConnection::put_Provider(const ::rtl::OUString& _bstr) +{ + OLEString bstr(_bstr); + return SUCCEEDED(pInterface->put_Provider(bstr)); +} + +sal_Int32 WpADOConnection::get_State() const +{ + sal_Int32 nRet=0; + pInterface->get_State(&nRet); + return nRet; +} + +sal_Bool WpADOConnection::OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset) +{ + return SUCCEEDED(pInterface->OpenSchema(eNum,Restrictions,SchemaID,pprset)); +} + +::rtl::OUString WpADOConnection::get_Version() const +{ + OLEString aBSTR; + pInterface->get_Version(&aBSTR); + return aBSTR; +} + +sal_Bool WpADOCommand::putref_ActiveConnection( WpADOConnection *pCon) +{ + return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface)); +} + +void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn) +{ + pInterface->put_ActiveConnection(vConn); +} + +void WpADOCommand::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr; + hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21, + CLSCTX_INPROC_SERVER, + NULL, + IID_IClassFactory2, + (void**)&pIUnknown ); + + if( !FAILED( hr ) ) + { + pIUnknown->AddRef(); + ADOCommand* pCommand=NULL; + + hr = pIUnknown->CreateInstanceLic( pOuter, + NULL, + ADOS::IID_ADOCOMMAND_21, + ADOS::GetKeyStr(), + (void**) &pCommand); + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } + pIUnknown->Release(); + } +} + +sal_Int32 WpADOCommand::get_State() const +{ + sal_Int32 nRet=0; + pInterface->get_State(&nRet); + return nRet; +} + +::rtl::OUString WpADOCommand::get_CommandText() const +{ + OLEString aBSTR; pInterface->get_CommandText(&aBSTR); + return aBSTR; +} + +sal_Bool WpADOCommand::put_CommandText(const ::rtl::OUString &aCon) +{ + OLEString bstr(aCon); + sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr)); + + return bErg; +} + +sal_Int32 WpADOCommand::get_CommandTimeout() const +{ + sal_Int32 nRet=0; + pInterface->get_CommandTimeout(&nRet); + return nRet; +} + +void WpADOCommand::put_CommandTimeout(sal_Int32 nRet) +{ + pInterface->put_CommandTimeout(nRet); +} + +sal_Bool WpADOCommand::get_Prepared() const +{ + VARIANT_BOOL bPrepared = VARIANT_FALSE; + pInterface->get_Prepared(&bPrepared); + return bPrepared == VARIANT_TRUE; +} + +sal_Bool WpADOCommand::put_Prepared(VARIANT_BOOL bPrepared) const +{ + return SUCCEEDED(pInterface->put_Prepared(bPrepared)); +} + +sal_Bool WpADOCommand::Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset) +{ + return SUCCEEDED(pInterface->Execute(&RecordsAffected,&Parameters,Options,ppiRset)); +} + +ADOParameter* WpADOCommand::CreateParameter(const ::rtl::OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value) +{ + ADOParameter* pPara = NULL; + OLEString bstr(_bstr); + sal_Bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr,Type,Direction,nSize,Value,&pPara)); + + return bErg ? pPara : NULL; +} + +ADOParameters* WpADOCommand::get_Parameters() const +{ + ADOParameters* pPara=NULL; + pInterface->get_Parameters(&pPara); + return pPara; +} + +sal_Bool WpADOCommand::put_CommandType( /* [in] */ CommandTypeEnum lCmdType) +{ + return SUCCEEDED(pInterface->put_CommandType(lCmdType)); +} + +CommandTypeEnum WpADOCommand::get_CommandType( ) const +{ + CommandTypeEnum eNum=adCmdUnspecified; + pInterface->get_CommandType(&eNum); + return eNum; +} + +// gibt den Namen des Feldes zur"ueck +::rtl::OUString WpADOCommand::GetName() const +{ + OLEString aBSTR; + pInterface->get_Name(&aBSTR); + return aBSTR; +} + +sal_Bool WpADOCommand::put_Name(const ::rtl::OUString& _Name) +{ + OLEString bstr(_Name); + sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr)); + + return bErg; +} +sal_Bool WpADOCommand::Cancel() +{ + return SUCCEEDED(pInterface->Cancel()); +} + +::rtl::OUString WpADOError::GetDescription() const +{ + OLEString aBSTR; + pInterface->get_Description(&aBSTR); + return aBSTR; +} + + ::rtl::OUString WpADOError::GetSource() const +{ + OLEString aBSTR; + pInterface->get_Source(&aBSTR); + return aBSTR; +} + + sal_Int32 WpADOError::GetNumber() const +{ + sal_Int32 nErrNr=0; + pInterface->get_Number(&nErrNr); + return nErrNr; +} + + ::rtl::OUString WpADOError::GetSQLState() const +{ + OLEString aBSTR; + pInterface->get_SQLState(&aBSTR); + return aBSTR; +} + + sal_Int32 WpADOError::GetNativeError() const +{ + sal_Int32 nErrNr=0; + pInterface->get_NativeError(&nErrNr); + return nErrNr; +} + ADOProperties* WpADOField::get_Properties() +{ + ADOProperties* pProps = NULL; + pInterface->get_Properties(&pProps); + return pProps; +} + + sal_Int32 WpADOField::GetActualSize() const +{ + sal_Int32 nActualSize=0; + pInterface->get_ActualSize(&nActualSize); + return nActualSize; +} + + sal_Int32 WpADOField::GetAttributes() const +{ + sal_Int32 eADOSFieldAttributes=0; + pInterface->get_Attributes(&eADOSFieldAttributes); + return eADOSFieldAttributes; +} + + sal_Int32 WpADOField::GetStatus() const +{ + sal_Int32 eADOSFieldAttributes=0; + // pInterface->get_Status(&eADOSFieldAttributes); + return eADOSFieldAttributes; +} + + sal_Int32 WpADOField::GetDefinedSize() const +{ + sal_Int32 nDefinedSize=0; + pInterface->get_DefinedSize(&nDefinedSize); + return nDefinedSize; +} + +// gibt den Namen des Feldes zur"ueck + ::rtl::OUString WpADOField::GetName() const +{ + OLEString aBSTR; + pInterface->get_Name(&aBSTR); + return aBSTR; +} + + DataTypeEnum WpADOField::GetADOType() const +{ + DataTypeEnum eType=adEmpty; + pInterface->get_Type(&eType); + return eType; +} + + void WpADOField::get_Value(OLEVariant& aValVar) const +{ + aValVar.setEmpty(); + pInterface->get_Value(&aValVar); +} + + OLEVariant WpADOField::get_Value() const +{ + OLEVariant aValVar; + pInterface->get_Value(&aValVar); + return aValVar; +} + + sal_Bool WpADOField::PutValue(const OLEVariant& aVariant) +{ + return (SUCCEEDED(pInterface->put_Value(aVariant))); +} + + sal_Int32 WpADOField::GetPrecision() const +{ + sal_uInt8 eType=0; + pInterface->get_Precision(&eType); + return eType; +} + + sal_Int32 WpADOField::GetNumericScale() const +{ + sal_uInt8 eType=0; + pInterface->get_NumericScale(&eType); + return eType; +} + + sal_Bool WpADOField::AppendChunk(const OLEVariant& _Variant) +{ + return (SUCCEEDED(pInterface->AppendChunk(_Variant))); +} + + OLEVariant WpADOField::GetChunk(long Length) const +{ + OLEVariant aValVar; + pInterface->GetChunk(Length,&aValVar); + return aValVar; +} + + void WpADOField::GetChunk(long Length,OLEVariant &aValVar) const +{ + pInterface->GetChunk(Length,&aValVar); +} + + OLEVariant WpADOField::GetOriginalValue() const +{ + OLEVariant aValVar; + pInterface->get_OriginalValue(&aValVar); + return aValVar; +} + + void WpADOField::GetOriginalValue(OLEVariant &aValVar) const +{ + pInterface->get_OriginalValue(&aValVar); +} + + OLEVariant WpADOField::GetUnderlyingValue() const +{ + OLEVariant aValVar; + pInterface->get_UnderlyingValue(&aValVar); + return aValVar; +} + + void WpADOField::GetUnderlyingValue(OLEVariant &aValVar) const +{ + pInterface->get_UnderlyingValue(&aValVar); +} + + sal_Bool WpADOField::PutPrecision(sal_Int8 _prec) +{ + return (SUCCEEDED(pInterface->put_Precision(_prec))); +} + + sal_Bool WpADOField::PutNumericScale(sal_Int8 _prec) +{ + return (SUCCEEDED(pInterface->put_NumericScale(_prec))); +} + + void WpADOField::PutADOType(DataTypeEnum eType) +{ + pInterface->put_Type(eType); +} + + sal_Bool WpADOField::PutDefinedSize(sal_Int32 _nDefSize) +{ + return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize))); +} + + sal_Bool WpADOField::PutAttributes(sal_Int32 _nDefSize) +{ + return (SUCCEEDED(pInterface->put_Attributes(_nDefSize))); +} + + OLEVariant WpADOProperty::GetValue() const +{ + OLEVariant aValVar; + pInterface->get_Value(&aValVar); + return aValVar; +} + + void WpADOProperty::GetValue(OLEVariant &aValVar) const +{ + pInterface->get_Value(&aValVar); +} + + sal_Bool WpADOProperty::PutValue(const OLEVariant &aValVar) +{ + return (SUCCEEDED(pInterface->put_Value(aValVar))); +} + + ::rtl::OUString WpADOProperty::GetName() const +{ + OLEString aBSTR; + pInterface->get_Name(&aBSTR); + return aBSTR; +} + + DataTypeEnum WpADOProperty::GetADOType() const +{ + DataTypeEnum eType=adEmpty; + pInterface->get_Type(&eType); + return eType; +} + + sal_Int32 WpADOProperty::GetAttributes() const +{ + sal_Int32 eADOSFieldAttributes=0; + pInterface->get_Attributes(&eADOSFieldAttributes); + return eADOSFieldAttributes; +} + + sal_Bool WpADOProperty::PutAttributes(sal_Int32 _nDefSize) +{ + return (SUCCEEDED(pInterface->put_Attributes(_nDefSize))); +} + void WpADORecordset::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr; + hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21, + CLSCTX_INPROC_SERVER, + NULL, + IID_IClassFactory2, + (void**)&pIUnknown ); + + if( !FAILED( hr ) ) + { + pIUnknown->AddRef(); + + ADORecordset *pRec = NULL; + hr = pIUnknown->CreateInstanceLic( pOuter, + NULL, + ADOS::IID_ADORECORDSET_21, + ADOS::GetKeyStr(), + (void**) &pRec); + + if( !FAILED( hr ) ) + { + pInterface = pRec; + pInterface->AddRef(); + } + pIUnknown->Release(); + } +} + + sal_Bool WpADORecordset::Open( + /* [optional][in] */ VARIANT Source, + /* [optional][in] */ VARIANT ActiveConnection, + /* [defaultvalue][in] */ CursorTypeEnum CursorType, + /* [defaultvalue][in] */ LockTypeEnum LockType, + /* [defaultvalue][in] */ sal_Int32 Options) +{ + return (SUCCEEDED(pInterface->Open(Source,ActiveConnection,CursorType,LockType,Options))); +} + + + LockTypeEnum WpADORecordset::GetLockType() +{ + LockTypeEnum eType=adLockUnspecified; + pInterface->get_LockType(&eType); + return eType; +} + + void WpADORecordset::Close() +{ + pInterface->Close(); +} + + sal_Bool WpADORecordset::Cancel() const +{ + return (SUCCEEDED(pInterface->Cancel())); +} + + sal_Int32 WpADORecordset::get_State( ) +{ + sal_Int32 nState = 0; + pInterface->get_State(&nState); + return nState; +} + + sal_Bool WpADORecordset::Supports( /* [in] */ CursorOptionEnum CursorOptions) +{ + VARIANT_BOOL bSupports=VARIANT_FALSE; + pInterface->Supports(CursorOptions,&bSupports); + return bSupports == VARIANT_TRUE; +} + +PositionEnum WpADORecordset::get_AbsolutePosition() +{ + PositionEnum aTemp=adPosUnknown; + pInterface->get_AbsolutePosition(&aTemp); + return aTemp; +} + + void WpADORecordset::GetDataSource(IUnknown** pIUnknown) const +{ + pInterface->get_DataSource(pIUnknown); +} + + void WpADORecordset::PutRefDataSource(IUnknown* pIUnknown) +{ + pInterface->putref_DataSource(pIUnknown); +} + + void WpADORecordset::GetBookmark(VARIANT& var) +{ + pInterface->get_Bookmark(&var); +} + + OLEVariant WpADORecordset::GetBookmark() +{ + OLEVariant var; + pInterface->get_Bookmark(&var); + return var; +} + +CompareEnum WpADORecordset::CompareBookmarks(const OLEVariant& left,const OLEVariant& right) +{ + CompareEnum eNum=adCompareNotComparable; + pInterface->CompareBookmarks(left,right,&eNum); + return eNum; +} + + sal_Bool WpADORecordset::SetBookmark(const OLEVariant &pSafeAr) +{ + return SUCCEEDED(pInterface->put_Bookmark(pSafeAr)); +} + + + ADOFields* WpADORecordset::GetFields() const +{ + ADOFields* pFields=NULL; + pInterface->get_Fields(&pFields); + return pFields; +} + + + sal_Bool WpADORecordset::Move(sal_Int32 nRows, VARIANT aBmk) {return SUCCEEDED(pInterface->Move(nRows, aBmk));} + sal_Bool WpADORecordset::MoveNext() {return SUCCEEDED(pInterface->MoveNext());} + sal_Bool WpADORecordset::MovePrevious() {return SUCCEEDED(pInterface->MovePrevious());} + sal_Bool WpADORecordset::MoveFirst() {return SUCCEEDED(pInterface->MoveFirst());} + sal_Bool WpADORecordset::MoveLast() {return SUCCEEDED(pInterface->MoveLast());} + + sal_Bool WpADORecordset::IsAtBOF() const +{ + VARIANT_BOOL bIsAtBOF=VARIANT_FALSE; + pInterface->get_BOF(&bIsAtBOF); + return bIsAtBOF == VARIANT_TRUE; +} + + sal_Bool WpADORecordset::IsAtEOF() const +{ + VARIANT_BOOL bIsAtEOF=VARIANT_FALSE; + pInterface->get_EOF(&bIsAtEOF); + return bIsAtEOF == VARIANT_TRUE; +} + + sal_Bool WpADORecordset::Delete(AffectEnum eNum) +{ + return SUCCEEDED(pInterface->Delete(eNum)); +} + + sal_Bool WpADORecordset::AddNew(const OLEVariant &FieldList,const OLEVariant &Values) +{ + return SUCCEEDED(pInterface->AddNew(FieldList,Values)); +} + + sal_Bool WpADORecordset::Update(const OLEVariant &FieldList,const OLEVariant &Values) +{ + return SUCCEEDED(pInterface->Update(FieldList,Values)); +} + + sal_Bool WpADORecordset::CancelUpdate() +{ + return SUCCEEDED(pInterface->CancelUpdate()); +} + + ADOProperties* WpADORecordset::get_Properties() const +{ + ADOProperties* pProps=NULL; + pInterface->get_Properties(&pProps); + return pProps; +} + + sal_Bool WpADORecordset::NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset) +{ + return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset)); +} + + sal_Bool WpADORecordset::get_RecordCount(sal_Int32 &_nRet) const +{ + return SUCCEEDED(pInterface->get_RecordCount(&_nRet)); +} + + sal_Bool WpADORecordset::get_MaxRecords(sal_Int32 &_nRet) const +{ + return SUCCEEDED(pInterface->get_MaxRecords(&_nRet)); +} + + sal_Bool WpADORecordset::put_MaxRecords(sal_Int32 _nRet) +{ + return SUCCEEDED(pInterface->put_MaxRecords(_nRet)); +} + + sal_Bool WpADORecordset::get_CursorType(CursorTypeEnum &_nRet) const +{ + return SUCCEEDED(pInterface->get_CursorType(&_nRet)); +} + + sal_Bool WpADORecordset::put_CursorType(CursorTypeEnum _nRet) +{ + return SUCCEEDED(pInterface->put_CursorType(_nRet)); +} + + sal_Bool WpADORecordset::get_LockType(LockTypeEnum &_nRet) const +{ + return SUCCEEDED(pInterface->get_LockType(&_nRet)); +} + + sal_Bool WpADORecordset::put_LockType(LockTypeEnum _nRet) +{ + return SUCCEEDED(pInterface->put_LockType(_nRet)); +} + + sal_Bool WpADORecordset::get_CacheSize(sal_Int32 &_nRet) const +{ + return SUCCEEDED(pInterface->get_CacheSize(&_nRet)); +} + + sal_Bool WpADORecordset::put_CacheSize(sal_Int32 _nRet) +{ + return SUCCEEDED(pInterface->put_CacheSize(_nRet)); +} + + sal_Bool WpADORecordset::UpdateBatch(AffectEnum AffectRecords) +{ + return SUCCEEDED(pInterface->UpdateBatch(AffectRecords)); +} + + ::rtl::OUString WpADOParameter::GetName() const +{ + OLEString aBSTR; + pInterface->get_Name(&aBSTR); + return aBSTR; +} + + DataTypeEnum WpADOParameter::GetADOType() const +{ + DataTypeEnum eType=adEmpty; + pInterface->get_Type(&eType); + return eType; +} + + sal_Int32 WpADOParameter::GetAttributes() const +{ + sal_Int32 eADOSFieldAttributes=0; + pInterface->get_Attributes(&eADOSFieldAttributes); + return eADOSFieldAttributes; +} + + sal_Int32 WpADOParameter::GetPrecision() const +{ + sal_uInt8 eType=0; + pInterface->get_Precision(&eType); + return eType; +} + + sal_Int32 WpADOParameter::GetNumericScale() const +{ + sal_uInt8 eType=0; + pInterface->get_NumericScale(&eType); + return eType; +} + + ParameterDirectionEnum WpADOParameter::get_Direction() const +{ + ParameterDirectionEnum alParmDirection=adParamUnknown; + pInterface->get_Direction(&alParmDirection); + return alParmDirection; +} + + void WpADOParameter::GetValue(OLEVariant& aValVar) const +{ + pInterface->get_Value(&aValVar); +} + + OLEVariant WpADOParameter::GetValue() const +{ + OLEVariant aValVar; + pInterface->get_Value(&aValVar); + return aValVar; +} + + sal_Bool WpADOParameter::PutValue(const OLEVariant& aVariant) +{ + return (SUCCEEDED(pInterface->put_Value(aVariant))); +} diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk index fef8eba5cf21..2fd2f0a41efd 100644 --- a/connectivity/source/drivers/ado/makefile.mk +++ b/connectivity/source/drivers/ado/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $ +# last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -80,6 +80,7 @@ ENVCFLAGS+=/FR$(SLO)$/ # --- Files ------------------------------------- SLOFILES=\ + $(SLO)$/Awrapado.obj \ $(SLO)$/ADatabaseMetaData.obj \ $(SLO)$/AColumn.obj \ $(SLO)$/AColumns.obj \ diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index 5dd895b6f5c7..942545719e5d 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CDatabaseMetaData.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-03-28 11:32:42 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,10 +117,6 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE calc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::calc; using namespace connectivity::file; @@ -289,16 +285,16 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( xColumns->getByName(*pBegin) >>= xColumn; OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); - aRow[5] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)); - aRow[6] = ::comphelper::getString(xColumn->getPropertyValue(PROPERTY_TYPENAME)); - aRow[7] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_PRECISION)); - // aRow[8] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - aRow[9] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_SCALE)); - aRow[11] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_ISNULLABLE)); - // aRow[12] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - aRow[13] = ::comphelper::getString(xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)); - // aRow[14] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - // aRow[15] = xColumn->getPropertyValue(PROPERTY_TYPENAME); + aRow[5] = ::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); + aRow[6] = ::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); + aRow[7] = ::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + // aRow[8] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + aRow[9] = ::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); + aRow[11] = ::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); + // aRow[12] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + aRow[13] = ::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); + // aRow[14] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + // aRow[15] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); switch(sal_Int32(aRow[5])) { case DataType::CHAR: diff --git a/connectivity/source/drivers/calc/CPreparedStatement.cxx b/connectivity/source/drivers/calc/CPreparedStatement.cxx index b16017ae9f61..d0aa2147e942 100644 --- a/connectivity/source/drivers/calc/CPreparedStatement.cxx +++ b/connectivity/source/drivers/calc/CPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CPreparedStatement.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: nn $ $Date: 2001-01-26 19:05:48 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,7 @@ using namespace connectivity::calc; using namespace connectivity::file; +using namespace com::sun::star::uno; // ------------------------------------------------------------------------- OResultSet* OCalcPreparedStatement::createResultSet() { diff --git a/connectivity/source/drivers/calc/CResultSet.cxx b/connectivity/source/drivers/calc/CResultSet.cxx index d19b4de1bfe7..dbc7446ee6de 100644 --- a/connectivity/source/drivers/calc/CResultSet.cxx +++ b/connectivity/source/drivers/calc/CResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CResultSet.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,21 +70,6 @@ #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE calc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif -// define the properties of this lib -// this file includes the properties for this dll -namespace connectivity -{ - namespace calc - { -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" -#endif - } -} using namespace connectivity::calc; using namespace connectivity::file; @@ -101,7 +86,7 @@ OCalcResultSet::OCalcResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTr : file::OResultSet(pStmt,_aSQLIterator) ,m_bBookmarkable(sal_True) { - registerProperty(PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType()); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OCalcResultSet::getImplementationName( ) throw ( RuntimeException) diff --git a/connectivity/source/drivers/calc/CStatement.cxx b/connectivity/source/drivers/calc/CStatement.cxx index c0b134be532f..0f87a9679324 100644 --- a/connectivity/source/drivers/calc/CStatement.cxx +++ b/connectivity/source/drivers/calc/CStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CStatement.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: nn $ $Date: 2001-01-26 19:05:48 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,7 @@ using namespace connectivity::calc; using namespace connectivity::file; +using namespace com::sun::star::uno; // ------------------------------------------------------------------------- OResultSet* OCalcStatement::createResultSet() { diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 6b64ac6781ee..7e621143fd5e 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CTable.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-05-07 10:37:51 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -146,10 +146,6 @@ #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE calc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _UNTOOLS_UCBSTREAMHELPER_HXX #include <unotools/ucbstreamhelper.hxx> #endif @@ -874,13 +870,13 @@ sal_Bool OCalcTable::fetchRow( OValueRow _rRow, const OSQLColumns & _rCols, Reference< XPropertySet> xColumn = *aIter; // ::rtl::OUString aName; -// xColumn->getPropertyValue(PROPERTY_NAME) >>= aName; +// xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aName; sal_Int32 nType; if(_bUseTableDefs) nType = m_aTypes[i-1]; else - xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType; if ((*_rRow)[i].isBound()) lcl_SetValue( (*_rRow)[i], m_xSheet, m_nStartCol, m_nStartRow, m_bHasHeaders, diff --git a/connectivity/source/drivers/calc/CTables.cxx b/connectivity/source/drivers/calc/CTables.cxx index 27f5de7311e2..e70611ee24f4 100644 --- a/connectivity/source/drivers/calc/CTables.cxx +++ b/connectivity/source/drivers/calc/CTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CTables.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:40:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,10 +92,6 @@ #ifndef _CONNECTIVITY_CALC_CATALOG_HXX_ #include "calc/CCatalog.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE calc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif @@ -145,7 +141,7 @@ void SAL_CALL OCalcTables::appendByDescriptor( const Reference< XPropertySet >& { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); diff --git a/connectivity/source/drivers/calc/makefile.mk b/connectivity/source/drivers/calc/makefile.mk index 93e276173a19..3e3dcff38d8d 100644 --- a/connectivity/source/drivers/calc/makefile.mk +++ b/connectivity/source/drivers/calc/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: pluby $ $Date: 2001-03-23 23:46:05 $ +# last change: $Author: oj $ $Date: 2001-05-14 11:40:01 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -110,16 +110,17 @@ SHL1STDLIBS=\ $(UCBHELPERLIB) \ $(SALLIB) \ $(DBTOOLSLIB) \ + $(DBFILELIB) \ $(UNOTOOLSLIB) \ $(COMPHELPERLIB) -.IF "$(COMPHELPERLIB)" == "" -SHL1STDLIBS+= icomphelp2.lib + +.IF "$(DBFILELIB)" == "" +SHL1STDLIBS+= ifile$(UPD).lib .ENDIF SHL1DEPN= SHL1IMPLIB= i$(TARGET) -SHL1LIBS= $(SLB)$/file.lib SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/connectivity/source/drivers/dbase/DCode.cxx b/connectivity/source/drivers/dbase/DCode.cxx index 40e172353668..544c0817990b 100644 --- a/connectivity/source/drivers/dbase/DCode.cxx +++ b/connectivity/source/drivers/dbase/DCode.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DCode.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-05-07 10:46:53 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:39:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,10 +70,6 @@ #ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ #include "dbase/DIndexIter.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::dbase; @@ -92,6 +88,7 @@ OOperandAttr* OFILEAnalyzer::createOperandAttr(sal_Int32 _nPos, { return new OFILEOperandAttr(_nPos,_xCol,_xIndexes); } + //------------------------------------------------------------------ OFILEOperandAttr::OFILEOperandAttr(sal_uInt16 _nPos, const Reference< XPropertySet>& _xColumn, @@ -114,15 +111,15 @@ OFILEOperandAttr::OFILEOperandAttr(sal_uInt16 _nPos, { Reference<XColumnsSupplier> xColsSup(xIndex,UNO_QUERY); Reference<XNameAccess> xNameAccess = xColsSup->getColumns(); - _xColumn->getPropertyValue(PROPERTY_NAME) >>= sName; + _xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sName; if(xNameAccess->hasByName(sName)) { m_xIndex = xIndex; break; } - else if(xColInfo->hasPropertyByName(PROPERTY_REALNAME)) + else if(xColInfo->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME))) { - _xColumn->getPropertyValue(PROPERTY_REALNAME) >>= sName; + _xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME)) >>= sName; if(xNameAccess->hasByName(sName)) { m_xIndex = xIndex; diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index b66d283609d6..786aabec0a14 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DDatabaseMetaData.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,10 +96,6 @@ #ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ #include "dbase/DIndex.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_FILE_VALUE_HXX_ #include "FValue.hxx" #endif @@ -270,16 +266,16 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin)); OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); - aRow[5] = getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)); - aRow[6] = getString(xColumn->getPropertyValue(PROPERTY_TYPENAME)); - aRow[7] = getINT32(xColumn->getPropertyValue(PROPERTY_PRECISION)); - // aRow[8] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - aRow[9] = getINT32(xColumn->getPropertyValue(PROPERTY_SCALE)); - aRow[11] = getINT32(xColumn->getPropertyValue(PROPERTY_ISNULLABLE)); - // aRow[12] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - aRow[13] = getString(xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)); - // aRow[14] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - // aRow[15] = xColumn->getPropertyValue(PROPERTY_TYPENAME); + aRow[5] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); + aRow[6] = getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); + aRow[7] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + // aRow[8] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + aRow[9] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); + aRow[11] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); + // aRow[12] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + aRow[13] = getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); + // aRow[14] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + // aRow[15] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); switch((sal_Int32)aRow[5]) { case DataType::CHAR: @@ -405,9 +401,9 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( ::cppu::extractInterface(xIndex,xIndexes->getByName(*pBegin)); OSL_ENSURE(xIndex.is(),"Indexes contains a column who isn't a fastpropertyset!"); - if(unique && !getBOOL(xIndex->getPropertyValue(PROPERTY_ISUNIQUE))) + if(unique && !getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))) continue; - aRow[4] = getBOOL(xIndex->getPropertyValue(PROPERTY_ISUNIQUE)); + aRow[4] = getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))); aRow[6] = *pBegin; Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xIndex,UNO_QUERY); diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx index dbb4c36ce9c5..a2b60fa84ada 100644 --- a/connectivity/source/drivers/dbase/DIndexColumns.cxx +++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DIndexColumns.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-05-08 13:23:12 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,10 +68,6 @@ #ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ #include "connectivity/sdbcx/VIndexColumn.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::dbase; using namespace connectivity; @@ -97,12 +93,12 @@ Reference< XNamed > ODbaseIndexColumns::createObject(const ::rtl::OUString& _rNa return Reference< XNamed >(); Reference< XNamed > xRet = new sdbcx::OIndexColumn(sal_True,_rName - ,getString(xCol->getPropertyValue(PROPERTY_TYPENAME)) + ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) ,::rtl::OUString() - ,getINT32(xCol->getPropertyValue(PROPERTY_ISNULLABLE)) - ,getINT32(xCol->getPropertyValue(PROPERTY_PRECISION)) - ,getINT32(xCol->getPropertyValue(PROPERTY_SCALE)) - ,getINT32(xCol->getPropertyValue(PROPERTY_TYPE)) + ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) + ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) + ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) + ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) ,sal_False ,sal_False ,sal_False diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx index c3774c6df4bd..f55751ce0570 100644 --- a/connectivity/source/drivers/dbase/DIndexes.cxx +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DIndexes.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,10 +64,6 @@ #ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ #include "dbase/DIndex.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _UNTOOLS_UCBSTREAMHELPER_HXX #include <unotools/ucbstreamhelper.hxx> #endif @@ -92,11 +88,11 @@ Reference< XNamed > ODbaseIndexes::createObject(const ::rtl::OUString& _rName) // String aPath = pDir->GetName(); // aPath += _rName.getStr(); ::rtl::OUString sFile = m_pTable->getConnection()->getURL(); - sFile += STR_DELIMITER; + sFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sFile += _rName; sFile += ::rtl::OUString::createFromAscii(".ndx"); if(!UCBContentHelper::Exists(sFile)) - throw SQLException(::rtl::OUString::createFromAscii("Index file doesn't exists!"),*m_pTable,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Index file doesn't exists!"),*m_pTable,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); Reference< XNamed > xRet; SvStream* pFileStream = UcbStreamHelper::CreateStream(sFile,STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE); @@ -115,7 +111,7 @@ Reference< XNamed > ODbaseIndexes::createObject(const ::rtl::OUString& _rName) pIndex->openIndexFile(); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not open index file"),*m_pTable,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not open index file"),*m_pTable,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); return xRet; } // ------------------------------------------------------------------------- @@ -138,7 +134,7 @@ void SAL_CALL ODbaseIndexes::appendByDescriptor( const Reference< XPropertySet > { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); diff --git a/connectivity/source/drivers/dbase/DPreparedStatement.cxx b/connectivity/source/drivers/dbase/DPreparedStatement.cxx index f53d1ff933ac..eae12dfbaa46 100644 --- a/connectivity/source/drivers/dbase/DPreparedStatement.cxx +++ b/connectivity/source/drivers/dbase/DPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DPreparedStatement.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2000-09-29 15:29:33 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,7 @@ using namespace connectivity::dbase; using namespace connectivity::file; +using namespace com::sun::star::uno; // ------------------------------------------------------------------------- OResultSet* ODbasePreparedStatement::createResultSet() { diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx index ed4f62d35c91..5860b9ba85bd 100644 --- a/connectivity/source/drivers/dbase/DResultSet.cxx +++ b/connectivity/source/drivers/dbase/DResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DResultSet.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-05-10 14:30:43 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,10 +70,6 @@ #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ #include "dbase/DIndex.hxx" #endif @@ -99,7 +95,7 @@ ODbaseResultSet::ODbaseResultSet( OStatement_Base* pStmt,connectivity::OSQLParse : file::OResultSet(pStmt,_aSQLIterator) ,m_bBookmarkable(sal_True) { - registerProperty(PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType()); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODbaseResultSet::getImplementationName( ) throw ( RuntimeException) diff --git a/connectivity/source/drivers/dbase/DStatement.cxx b/connectivity/source/drivers/dbase/DStatement.cxx index c9b88917209b..3509a513e5a4 100644 --- a/connectivity/source/drivers/dbase/DStatement.cxx +++ b/connectivity/source/drivers/dbase/DStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DStatement.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2000-09-29 15:29:39 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,8 @@ using namespace connectivity::dbase; using namespace connectivity::file; +using namespace com::sun::star::uno; + // ------------------------------------------------------------------------- OResultSet* ODbaseStatement::createResultSet() { diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 5f3d3f2eb81e..33e6434869ea 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.43 $ + * $Revision: 1.44 $ * - * last change: $Author: oj $ $Date: 2001-05-11 06:13:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,10 +117,6 @@ #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _UNTOOLS_UCBSTREAMHELPER_HXX #include <unotools/ucbstreamhelper.hxx> #endif @@ -719,7 +715,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols, sal_B Reference< XPropertySet> xColumn = *aIter; ::rtl::OUString aName; - xColumn->getPropertyValue(PROPERTY_NAME) >>= aName; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aName; // Laengen je nach Datentyp: // nyi: eine zentrale Funktion, die die Laenge liefert! sal_Int32 nLen; @@ -731,8 +727,8 @@ sal_Bool ODbaseTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols, sal_B } else { - xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nLen; - xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType; } switch(nType) { @@ -741,7 +737,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols, sal_B if(_bUseTableDefs) nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,m_aScales[i-1]); else - nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xColumn->getPropertyValue(PROPERTY_SCALE))); + nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); break; // das Vorzeichen und das Komma case DataType::BIT: nLen = 1; break; case DataType::LONGVARCHAR: nLen = 10; break; @@ -1114,21 +1110,21 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) char cTyp; - xCol->getPropertyValue(PROPERTY_NAME) >>= aName; + xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aName; if (aName.getLength() > nMaxFieldLength) { ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid column name length for column: "); sMsg += aName; sMsg += ::rtl::OUString::createFromAscii("!"); - throw SQLException(sMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } ByteString aCol(aName.getStr(), getConnection()->getTextEncoding()); (*m_pFileStream) << aCol.GetBuffer(); m_pFileStream->Write(aBuffer, 11 - aCol.Len()); - switch (getINT32(xCol->getPropertyValue(PROPERTY_TYPE))) + switch (getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { case DataType::CHAR: case DataType::VARCHAR: @@ -1159,7 +1155,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid column type for column: "); sMsg += aName; sMsg += ::rtl::OUString::createFromAscii("!"); - throw SQLException(sMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } } @@ -1167,9 +1163,9 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) m_pFileStream->Write(aBuffer, 4); sal_Int32 nPrecision = 0; - xCol->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision; + xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nPrecision; sal_Int32 nScale = 0; - xCol->getPropertyValue(PROPERTY_SCALE) >>= nScale; + xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale; switch(cTyp) { @@ -1180,7 +1176,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid precision for column: "); sMsg += aName; sMsg += ::rtl::OUString::createFromAscii("!"); - throw SQLException(sMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } (*m_pFileStream) << (BYTE) Min((ULONG)nPrecision, 255UL); //Feldlnge nRecLength += (USHORT)Min((ULONG)nPrecision, 255UL); @@ -1195,10 +1191,10 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Precision is less than scale for column: "); sMsg += aName; sMsg += ::rtl::OUString::createFromAscii("!"); - throw SQLException(sMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); break; } - if (getBOOL(xCol->getPropertyValue(PROPERTY_ISCURRENCY))) // Currency wird gesondert behandelt + if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt { (*m_pFileStream) << (BYTE)10; // Standard Laenge (*m_pFileStream) << (BYTE)4; @@ -1234,7 +1230,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid column type for column: "); sMsg += aName; sMsg += ::rtl::OUString::createFromAscii("!"); - throw SQLException(sMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } } m_pFileStream->Write(aBuffer, 14); @@ -1437,7 +1433,7 @@ BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) ::cppu::extractInterface(xCol,m_pColumns->getByIndex(i)); // const SdbFILEColumn *pColumn = (const SdbFILEColumn *)(*aOriginalColumns)[i]; - xCol->getPropertyValue(PROPERTY_NAME) >>= aColName; + xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; Reference<XPropertySet> xIndex = isUniqueByColumnName(aColName); if (xIndex.is()) { @@ -1452,7 +1448,7 @@ BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) { // Reference<XPropertySet> xFindCol; // _xCols->getByIndex(nPos) >>= xFindCol; - if(aCase(getString((*aIter)->getPropertyValue(PROPERTY_REALNAME)),aColName)) + if(aCase(getString((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME))),aColName)) break; } if (aIter == _rCols.end()) @@ -1641,7 +1637,7 @@ Reference<XPropertySet> ODbaseTable::isUniqueByColumnName(const ::rtl::OUString& for(sal_Int32 i=0;i<m_pIndexes->getCount();++i) { ::cppu::extractInterface(xIndex,m_pIndexes->getByIndex(i)); - if(xIndex.is() && getBOOL(xIndex->getPropertyValue(PROPERTY_ISUNIQUE))) + if(xIndex.is() && getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))) { Reference<XNameAccess> xCols(Reference<XColumnsSupplier>(xIndex,UNO_QUERY)->getColumns()); if(xCols->hasByName(_rColName)) @@ -1687,7 +1683,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer for (i = 0; i < m_pColumns->getCount(); i++) { m_pColumns->getByIndex(i) >>= xCol; - xCol->getPropertyValue(PROPERTY_NAME) >>= aColName; + xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; // const SdbFILEColumn *pColumn = (const SdbFILEColumn *)(*aOriginalColumns)[i]; sal_Int32 nPos = 0; @@ -1695,7 +1691,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer { Reference<XPropertySet> xFindCol; ::cppu::extractInterface(xFindCol,_xCols->getByIndex(nPos)); - if(aCase(getString(xFindCol->getPropertyValue(PROPERTY_NAME)),aColName)) + if(aCase(getString(xFindCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),aColName)) break; } if (nPos >= _xCols->getCount()) @@ -1721,7 +1717,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer { // es existiert kein eindeutiger Wert ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Dupilcate value found!"); - throw SQLException(sMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } } } @@ -1732,17 +1728,17 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer for (i = 0; i < m_pColumns->getCount(); i++) { m_pColumns->getByIndex(i) >>= xCol; - xCol->getPropertyValue(PROPERTY_NAME) >>= aColName; + xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; // Laengen je nach Datentyp: // nyi: eine zentrale Funktion, die die Laenge liefert! - sal_Int32 nLen = getINT32(xCol->getPropertyValue(PROPERTY_PRECISION)); - sal_Int32 nType = getINT32(xCol->getPropertyValue(PROPERTY_TYPE)); + sal_Int32 nLen = getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + sal_Int32 nType = getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); switch (nType) { case DataType::DATE: nLen = 8; break; case DataType::DECIMAL: - nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xCol->getPropertyValue(PROPERTY_SCALE))); + nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); break; // das Vorzeichen und das Komma case DataType::BIT: nLen = 1; break; case DataType::LONGVARCHAR:nLen = 10; break; @@ -1755,7 +1751,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer { Reference<XPropertySet> xFindCol; ::cppu::extractInterface(xFindCol,_xCols->getByIndex(nPos)); - if(aCase(getString(xFindCol->getPropertyValue(PROPERTY_NAME)),aColName)) + if(aCase(getString(xFindCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),aColName)) break; } @@ -1824,8 +1820,8 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer double n = rRow[nPos]; - int nPrecision = (int)getINT32(xCol->getPropertyValue(PROPERTY_PRECISION)); - int nScale = (int)getINT32(xCol->getPropertyValue(PROPERTY_SCALE)); + int nPrecision = (int)getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + int nScale = (int)getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); // ein const_cast, da GetFormatPrecision am SvNumberFormat nicht const ist, obwohl es das eigentlich // sein koennte und muesste @@ -1891,7 +1887,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid value for column: "); sMsg += aColName; sMsg += ::rtl::OUString::createFromAscii("!"); - throw SQLException(sMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } // Und weiter ... nByteOffset += nLen; @@ -1953,23 +1949,23 @@ void ODbaseTable::alterColumn(sal_Int32 index, // // get the name // ::rtl::OUString sOldName,sNewName; -// xOldColumn->getPropertyByName(PROPERTY_NAME) >>= sOldName; -// descriptor->getPropertyByName(PROPERTY_NAME) >>= sNewName; +// xOldColumn->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sOldName; +// descriptor->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sNewName; // // // get the type // sal_Int32 nOldType,nNewType; -// xOldColumn->getPropertyByName(PROPERTY_TYPE) >>= nOldType; -// descriptor->getPropertyByName(PROPERTY_TYPE) >>= nNewType; +// xOldColumn->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nOldType; +// descriptor->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nNewType; // // // get the precision // sal_Int32 nOldPrec,nNewPrec; -// xOldColumn->getPropertyByName(PROPERTY_PRECISION) >>= nOldPrec; -// descriptor->getPropertyByName(PROPERTY_PRECISION) >>= nNewPrec; +// xOldColumn->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nOldPrec; +// descriptor->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nNewPrec; // // // get the scale // sal_Int32 nOldScale,nNewScale; -// xOldColumn->getPropertyByName(PROPERTY_SCALE) >>= nOldScale; -// descriptor->getPropertyByName(PROPERTY_SCALE) >>= nNewScale; +// xOldColumn->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nOldScale; +// descriptor->getPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nNewScale; // // // check if currency changed // sal_Bool bOldCur,bNewCur; @@ -1982,7 +1978,7 @@ void ODbaseTable::alterColumn(sal_Int32 index, ODbaseTable* pNewTable = new ODbaseTable(static_cast<ODbaseConnection*>(m_pConnection)); Reference<XPropertySet> xHoldTable = pNewTable; - pNewTable->setPropertyValue(PROPERTY_NAME,makeAny(::rtl::OUString(sTempName))); + pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(::rtl::OUString(sTempName))); Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); // copy the structure @@ -2069,7 +2065,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) ODbaseTable* pNewTable = new ODbaseTable(static_cast<ODbaseConnection*>(m_pConnection)); Reference<XPropertySet> xHoldTable = pNewTable; - pNewTable->setPropertyValue(PROPERTY_NAME,makeAny(::rtl::OUString(sTempName))); + pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(::rtl::OUString(sTempName))); { Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); @@ -2113,7 +2109,7 @@ String ODbaseTable::createTempFile() String sName(m_Name); TempFile aTempFile(sName,&sExt,&sTempName); if(!aTempFile.IsValid()) - throw SQLException(::rtl::OUString::createFromAscii("Error while alter table!"),NULL,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Error while alter table!"),NULL,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); INetURLObject aURL; aURL.SetSmartProtocol(INET_PROT_FILE); diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index 82b34f7af9e7..b7059943c30f 100644 --- a/connectivity/source/drivers/dbase/DTables.cxx +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTables.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,10 +92,6 @@ #ifndef _CONNECTIVITY_DBASE_CATALOG_HXX_ #include "dbase/DCatalog.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif @@ -140,7 +136,7 @@ void SAL_CALL ODbaseTables::appendByDescriptor( const Reference< XPropertySet >& { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); @@ -151,7 +147,7 @@ void SAL_CALL ODbaseTables::appendByDescriptor( const Reference< XPropertySet >& ODbaseTable* pTable = (ODbaseTable*)xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()); if(pTable) { - pTable->setPropertyValue(PROPERTY_NAME,descriptor->getPropertyValue(PROPERTY_NAME)); + pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); if(pTable->CreateImpl()) ODbaseTables_BASE_BASE::appendByDescriptor(Reference< XPropertySet >(createObject(aName),UNO_QUERY)); } @@ -178,7 +174,7 @@ void SAL_CALL ODbaseTables::dropByName( const ::rtl::OUString& elementName ) thr ODbaseTables_BASE_BASE::dropByName(elementName); } else - throw SQLException(::rtl::OUString::createFromAscii("Can't drop table ") + elementName,*this,SQLSTATE_SEQUENCE,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Can't drop table ") + elementName,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/makefile.mk b/connectivity/source/drivers/dbase/makefile.mk index 7830d605fb57..8c77904c86bf 100644 --- a/connectivity/source/drivers/dbase/makefile.mk +++ b/connectivity/source/drivers/dbase/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.15 $ +# $Revision: 1.16 $ # -# last change: $Author: oj $ $Date: 2001-05-07 10:37:51 $ +# last change: $Author: oj $ $Date: 2001-05-14 11:37:37 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -118,16 +118,17 @@ SHL1STDLIBS=\ $(UCBHELPERLIB) \ $(SALLIB) \ $(DBTOOLSLIB) \ + $(DBFILELIB) \ $(UNOTOOLSLIB) \ $(COMPHELPERLIB) -.IF "$(COMPHELPERLIB)" == "" -SHL1STDLIBS+= icomphelp2.lib +.IF "$(DBFILELIB)" == "" +SHL1STDLIBS+= ifile$(UPD).lib .ENDIF SHL1DEPN= SHL1IMPLIB= i$(DBASE_TARGET) -SHL1LIBS= $(SLB)$/file.lib + SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 21986788cf51..689fac8db68b 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.15 $ + * $Revision: 1.16 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,10 +73,6 @@ #ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ #include "file/FResultSetMetaData.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE file -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> #endif @@ -92,6 +88,9 @@ #ifndef _DBHELPER_DBCONVERSION_HXX_ #include "connectivity/dbconversion.hxx" #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif using namespace connectivity; @@ -237,7 +236,7 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::r throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(x); else @@ -272,7 +271,7 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(x); @@ -286,7 +285,7 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back((sal_Int32)x); @@ -301,7 +300,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(DBTypeConversion::toDouble(aData)); @@ -317,7 +316,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(DBTypeConversion::toDouble(aVal)); @@ -332,7 +331,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(DBTypeConversion::toDouble(aVal)); @@ -347,7 +346,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(x); @@ -363,7 +362,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back((double)x); @@ -378,7 +377,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(x); @@ -392,7 +391,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 a ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -403,7 +402,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s throw DisposedException(); // Get the buffer needed for the length if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(ORowSetValue()); @@ -417,7 +416,7 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -426,7 +425,7 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -435,7 +434,7 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -444,7 +443,7 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -454,7 +453,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); // For each known SQL Type, call the appropriate // set routine @@ -518,7 +517,7 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); if(parameterIndex >= (sal_Int32)m_aRow->size()) m_aRow->push_back(ORowSetValue()); @@ -532,7 +531,7 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); // setObject (parameterIndex, x, sqlType, 0); } // ------------------------------------------------------------------------- @@ -543,7 +542,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); if( parameterIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); setInt(parameterIndex,x); } // ------------------------------------------------------------------------- @@ -553,7 +552,7 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -563,7 +562,7 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -572,7 +571,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con ::osl::MutexGuard aGuard( m_aMutex ); if (OStatement_BASE::rBHelper.bDisposed) throw DisposedException(); - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx index bdebb0708f27..e55c9ea88073 100644 --- a/connectivity/source/drivers/file/FResultSetMetaData.cxx +++ b/connectivity/source/drivers/file/FResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSetMetaData.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:56 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,17 +62,18 @@ #ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ #include "file/FResultSetMetaData.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE file -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_FILE_TABLE_HXX_ #include "file/FTable.hxx" #endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif + using namespace connectivity; +using namespace dbtools; using namespace connectivity::file; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -99,18 +100,18 @@ OResultSetMetaData::~OResultSetMetaData() sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); - return getINT32((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_PRECISION)); + return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); - return getINT32((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_TYPE)); + return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); } // ------------------------------------------------------------------------- @@ -123,7 +124,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, Ru sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); return sal_False; } @@ -132,7 +133,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw( ::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); return ::rtl::OUString(); } @@ -141,16 +142,16 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw( ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); - Any aName((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_NAME)); - return aName.hasValue() ? getString(aName) : getString((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_NAME)); + Any aName((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); + return aName.hasValue() ? getString(aName) : getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); return m_aTableName; } @@ -158,28 +159,28 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw( ::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - return getString((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_TYPENAME)); + throwInvalidIndexException(*this); + return getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - return getString((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_NAME)); + throwInvalidIndexException(*this); + return getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); return ::rtl::OUString(); } // ------------------------------------------------------------------------- @@ -187,52 +188,52 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw( sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - return getBOOL((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_ISCURRENCY)); + throwInvalidIndexException(*this); + return getBOOL((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - return getBOOL((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_ISAUTOINCREMENT)); + throwInvalidIndexException(*this); + return getBOOL((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); return sal_False; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - return getINT32((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_PRECISION)); + throwInvalidIndexException(*this); + return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - return getINT32((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_SCALE)); + throwInvalidIndexException(*this); + return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - return getINT32((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_ISNULLABLE)); + throwInvalidIndexException(*this); + return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + throwInvalidIndexException(*this); return sal_True; } // ------------------------------------------------------------------------- @@ -240,9 +241,9 @@ sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQL sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(PROPERTY_FUNCTION) && - ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_FUNCTION))) + throwInvalidIndexException(*this); + if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && + ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)))) return sal_True; return m_pTable->isReadOnly(); } @@ -251,9 +252,9 @@ sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLEx sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(PROPERTY_FUNCTION) && - ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_FUNCTION))) + throwInvalidIndexException(*this); + if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && + ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)))) return sal_False; return !m_pTable->isReadOnly(); ; @@ -262,9 +263,9 @@ sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) t sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); - if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(PROPERTY_FUNCTION) && - ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(PROPERTY_FUNCTION))) + throwInvalidIndexException(*this); + if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && + ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)))) return sal_False; return !m_pTable->isReadOnly(); } diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index aea96f370917..3f4b3e4e6b5c 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.15 $ + * $Revision: 1.16 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,10 +74,6 @@ #ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ #include "file/FResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE file -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> #endif @@ -114,11 +110,6 @@ namespace connectivity { namespace file { -// define the properties of this lib -// this file includes the properties for this dll -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" -#endif //------------------------------------------------------------------------------ using namespace com::sun::star::uno; @@ -147,16 +138,16 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE( sal_Int32 nAttrib = 0; - registerProperty(PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, nAttrib,&m_aCursorName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_MAXFIELDSIZE, PROPERTY_ID_MAXFIELDSIZE, nAttrib,&m_nMaxFieldSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_MAXROWS, PROPERTY_ID_MAXROWS, nAttrib,&m_nMaxRows, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_QUERYTIMEOUT, PROPERTY_ID_QUERYTIMEOUT, nAttrib,&m_nQueryTimeOut, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, nAttrib,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, nAttrib,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, nAttrib,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_ESCAPEPROCESSING, PROPERTY_ID_ESCAPEPROCESSING, nAttrib,&m_bEscapeProcessing,::getCppuBooleanType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME), PROPERTY_ID_CURSORNAME, nAttrib,&m_aCursorName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE), PROPERTY_ID_MAXFIELDSIZE, nAttrib,&m_nMaxFieldSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS), PROPERTY_ID_MAXROWS, nAttrib,&m_nMaxRows, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT), PROPERTY_ID_QUERYTIMEOUT, nAttrib,&m_nQueryTimeOut, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, nAttrib,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, nAttrib,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, nAttrib,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING), PROPERTY_ID_ESCAPEPROCESSING, nAttrib,&m_bEscapeProcessing,::getCppuBooleanType()); - registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, nAttrib,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY, nAttrib,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); } //------------------------------------------------------------------------------ void OStatement_Base::disposeResultSet() diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 6dcb96c7dfbf..4d5731762a88 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.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,10 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif + #ifndef _CONNECTIVITY_SQLPARSE_HXX #include "connectivity/sqlparse.hxx" #endif @@ -77,10 +81,6 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include "connectivity/dbexception.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE file -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity; using namespace connectivity::file; @@ -461,7 +461,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr { ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Column not found: "); sMsg += aColumnName; - throw SQLException(sMsg,NULL,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sMsg,NULL,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCol; try diff --git a/connectivity/source/drivers/file/makefile.mk b/connectivity/source/drivers/file/makefile.mk index b6afa45d0285..49b80c4af232 100644 --- a/connectivity/source/drivers/file/makefile.mk +++ b/connectivity/source/drivers/file/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.6 $ +# $Revision: 1.7 $ # -# last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $ +# last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -65,7 +65,10 @@ PRJINC=..$/.. PRJNAME=connectivity TARGET=file +USE_LDUMP2=TRUE +USE_DEFFILE=TRUE ENABLE_EXCEPTIONS=TRUE +LDUMP=ldump2.exe # --- Settings ---------------------------------- .IF "$(DBGUTIL_OJ)"!="" @@ -93,8 +96,52 @@ SLOFILES=\ $(SLO)$/fcode.obj \ $(SLO)$/fcomp.obj +.IF "$(OS)"=="MACOSX" +#SHL1VERSIONMAP=$(TARGET).$(DLLPOSTFIX).map +.ELSE +SHL1VERSIONMAP=$(TARGET).map +.ENDIF +# --- Library ----------------------------------- +SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX) +SHL1OBJS=$(SLOFILES) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SVLLIB) \ + $(SVLIB) \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(UCBHELPERLIB) \ + $(SALLIB) \ + $(DBTOOLSLIB) \ + $(UNOTOOLSLIB) \ + $(COMPHELPERLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET)$(UPD) + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \ + $(SLB)$/$(TARGET).lib +DEFLIB1NAME=$(TARGET) + # --- Targets ---------------------------------- .INCLUDE : target.mk +# --- filter file ------------------------------ + +.IF "$(depend)"=="" + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo CLEAR_THE_FILE > $@ + @echo _TI >>$@ + @echo _real >>$@ +.ENDIF + diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx index 073c9483d294..fd2491750df4 100644 --- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx +++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EDatabaseMetaData.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:21 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,10 +93,6 @@ #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE flat -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif @@ -283,16 +279,16 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin)); OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); - aRow[5] = getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)); - aRow[6] = getString(xColumn->getPropertyValue(PROPERTY_TYPENAME)); - aRow[7] = getINT32(xColumn->getPropertyValue(PROPERTY_PRECISION)); - // aRow[8] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - aRow[9] = getINT32(xColumn->getPropertyValue(PROPERTY_SCALE)); - aRow[11] = getINT32(xColumn->getPropertyValue(PROPERTY_ISNULLABLE)); - // aRow[12] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - aRow[13] = getString(xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)); - // aRow[14] = xColumn->getPropertyValue(PROPERTY_TYPENAME); - // aRow[15] = xColumn->getPropertyValue(PROPERTY_TYPENAME); + aRow[5] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); + aRow[6] = getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); + aRow[7] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + // aRow[8] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + aRow[9] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); + aRow[11] = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); + // aRow[12] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + aRow[13] = getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); + // aRow[14] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); + // aRow[15] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); switch((sal_Int32)aRow[5]) { case DataType::CHAR: diff --git a/connectivity/source/drivers/flat/EPreparedStatement.cxx b/connectivity/source/drivers/flat/EPreparedStatement.cxx index a44282268a44..16fa235392ba 100644 --- a/connectivity/source/drivers/flat/EPreparedStatement.cxx +++ b/connectivity/source/drivers/flat/EPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EPreparedStatement.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2000-10-05 14:43:13 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,7 @@ using namespace connectivity::flat; using namespace connectivity::file; +using namespace ::com::sun::star::uno; // ------------------------------------------------------------------------- OResultSet* OFlatPreparedStatement::createResultSet() { @@ -75,3 +76,4 @@ OResultSet* OFlatPreparedStatement::createResultSet() } // ------------------------------------------------------------------------- IMPLEMENT_SERVICE_INFO(OFlatPreparedStatement,"com.sun.star.sdbc.driver.flat.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); + diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx index b1ff0a3b5f2a..4cdf9e7ed8b4 100644 --- a/connectivity/source/drivers/flat/EResultSet.cxx +++ b/connectivity/source/drivers/flat/EResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EResultSet.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:11:29 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,21 +74,6 @@ #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE flat -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif -// define the properties of this lib -// this file includes the properties for this dll -namespace connectivity -{ - namespace flat - { -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" -#endif - } -} using namespace connectivity::flat; using namespace connectivity::file; @@ -105,7 +90,7 @@ OFlatResultSet::OFlatResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTr : file::OResultSet(pStmt,_aSQLIterator) ,m_bBookmarkable(sal_True) { - registerProperty(PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType()); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OFlatResultSet::getImplementationName( ) throw ( RuntimeException) diff --git a/connectivity/source/drivers/flat/EStatement.cxx b/connectivity/source/drivers/flat/EStatement.cxx index 383731a9c4da..901d5d2c38d6 100644 --- a/connectivity/source/drivers/flat/EStatement.cxx +++ b/connectivity/source/drivers/flat/EStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EStatement.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2000-10-05 14:43:50 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,7 @@ using namespace connectivity::flat; using namespace connectivity::file; +using namespace com::sun::star::uno; // ------------------------------------------------------------------------- OResultSet* OFlatStatement::createResultSet() { diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 6f475358903e..ea188764fa38 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ETable.cxx,v $ * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * - * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -125,10 +125,6 @@ #ifndef _UTL_CONFIGMGR_HXX_ #include <unotools/configmgr.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE flat -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _ISOLANG_HXX #include <tools/isolang.hxx> #endif @@ -857,8 +853,8 @@ sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Boo // Laengen je nach Datentyp: // nyi: eine zentrale Funktion, die die Laenge liefert! sal_Int32 nLen; - xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nLen; - sal_Int32 nType = getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)); + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen; + sal_Int32 nType = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); ByteString aStr(m_aCurrentLine.GetToken(i-1,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter())); if (aStr.Len() == 0) diff --git a/connectivity/source/drivers/flat/ETables.cxx b/connectivity/source/drivers/flat/ETables.cxx index bbc404eb6159..cbbf48ff79a7 100644 --- a/connectivity/source/drivers/flat/ETables.cxx +++ b/connectivity/source/drivers/flat/ETables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ETables.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:07:21 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,10 +89,6 @@ //#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ //#include <com/sun/star/lang/XUnoTunnel.hpp> //#endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE flat -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif using namespace connectivity::flat; using namespace connectivity::file; using namespace ::com::sun::star::uno; @@ -131,7 +127,7 @@ void SAL_CALL OFlatTables::appendByDescriptor( const Reference< XPropertySet >& { ::osl::MutexGuard aGuard(m_rMutex); - ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); ObjectMap::iterator aIter = m_aNameMap.find(aName); if( aIter != m_aNameMap.end()) throw ElementExistException(aName,*this); diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 07186dc840cf..d1a36dbb4136 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ResultSet.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:13:38 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,10 +91,6 @@ #ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ #include "java/tools.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE jdbc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> #endif @@ -110,19 +106,9 @@ #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> #endif - -// define the properties of this lib -// this file includes the properties for this dll -namespace connectivity -{ - namespace jdbc - { -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif - } -} - using namespace connectivity; using namespace ::com::sun::star::uno; diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index 0c72a32fd8be..e1d04f09e942 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OConnection.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:44 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,7 +102,8 @@ #endif using namespace connectivity::odbc; -using namespace connectivity::dbtools; +using namespace connectivity; +using namespace dbtools; //------------------------------------------------------------------------------ using namespace com::sun::star::uno; @@ -219,37 +220,45 @@ SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< Prop ::rtl::OUString aDSN(RTL_CONSTASCII_USTRINGPARAM("DSN=")), aUID, aPWD, aSysDrvSettings; aDSN += url.copy(nLen+1); + const char* pUser = "user"; + const char* pTimeout = "Timeout"; + const char* pSilent = "Silent"; + const char* pPwd = "password"; + const char* pUseCatalog = "UseCatalog"; + const char* pSysDrv = "SystemDriverSettings"; + const char* pCharSet = "CharSet"; + sal_Int32 nTimeout = 20; sal_Bool bSilent = sal_True; const PropertyValue *pBegin = info.getConstArray(); const PropertyValue *pEnd = pBegin + info.getLength(); for(;pBegin != pEnd;++pBegin) { - if(!pBegin->Name.compareToAscii("Timeout")) + if(!pBegin->Name.compareToAscii(pTimeout)) pBegin->Value >>= nTimeout; - else if(!pBegin->Name.compareToAscii("Silent")) + else if(!pBegin->Name.compareToAscii(pSilent)) pBegin->Value >>= bSilent; - else if(!pBegin->Name.compareToAscii("user")) + else if(!pBegin->Name.compareToAscii(pUser)) { pBegin->Value >>= aUID; aDSN = aDSN + ::rtl::OUString::createFromAscii(";UID=") + aUID; } - else if(!pBegin->Name.compareToAscii("password")) + else if(!pBegin->Name.compareToAscii(pPwd)) { pBegin->Value >>= aPWD; aDSN = aDSN + ::rtl::OUString::createFromAscii(";PWD=") + aPWD; } - else if(!pBegin->Name.compareToAscii("UseCatalog")) + else if(!pBegin->Name.compareToAscii(pUseCatalog)) { m_bUseCatalog = ::cppu::any2bool(pBegin->Value); } - else if(!pBegin->Name.compareToAscii("SystemDriverSettings")) + else if(!pBegin->Name.compareToAscii(pSysDrv)) { pBegin->Value >>= aSysDrvSettings; aDSN += ::rtl::OUString::createFromAscii(";"); aDSN += aSysDrvSettings; } - else if(0 == pBegin->Name.compareToAscii("CharSet")) + else if(0 == pBegin->Name.compareToAscii(pCharSet)) { ::rtl::OUString sIanaName; pBegin->Value >>= sIanaName; @@ -286,8 +295,8 @@ IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.odbc.OConnection" Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + Reference< XStatement > xReturn = new OStatement(this); m_aStatements.push_back(WeakReferenceHelper(xReturn)); return xReturn; @@ -296,8 +305,8 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLExcep Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + if(m_aTypeInfo.empty()) buildTypeInfo(); @@ -309,8 +318,8 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const :: Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return NULL; } // -------------------------------------------------------------------------------- @@ -328,8 +337,8 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl:: void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + OTools::ThrowException(N3SQLSetConnectAttr(m_aConnectionHandle, SQL_ATTR_AUTOCOMMIT, @@ -340,8 +349,8 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLExcepti sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + sal_uInt32 nOption = 0; OTools::ThrowException(N3SQLGetConnectAttr(m_aConnectionHandle, @@ -352,8 +361,8 @@ sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeExce void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + OTools::ThrowException(N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this); } @@ -361,8 +370,8 @@ void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + OTools::ThrowException(N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this); } @@ -377,8 +386,8 @@ sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + Reference< XDatabaseMetaData > xMetaData = m_xMetaData; if(!xMetaData.is()) @@ -393,8 +402,8 @@ Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLEx void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + OTools::ThrowException( N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,(SQLPOINTER)readOnly,SQL_IS_INTEGER), @@ -404,19 +413,19 @@ void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + ::rtl::OUString aValue; OTools::GetInfo(m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aValue,*this,getTextEncoding()); - return aValue == ::rtl::OUString::createFromAscii("Y"); + return !aValue.compareToAscii("Y"); } // -------------------------------------------------------------------------------- void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + ::rtl::OString aCat(::rtl::OUStringToOString(catalog.getStr(),getTextEncoding())); OTools::ThrowException( @@ -427,8 +436,8 @@ void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQ ::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + sal_Int32 nValueLen; char pCat[1024]; @@ -442,8 +451,8 @@ void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + OTools::ThrowException(N3SQLSetConnectAttr(m_aConnectionHandle, SQL_ATTR_TXN_ISOLATION, @@ -454,8 +463,8 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLE sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + sal_Int32 nTxn = 0; SQLINTEGER nValueLen; @@ -468,8 +477,8 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + return NULL; } @@ -483,8 +492,8 @@ void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) { { ::osl::MutexGuard aGuard( m_aMutex ); - if (OConnection_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + } dispose(); } diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx index 11a7d1774b0f..1e44a3043cec 100644 --- a/connectivity/source/drivers/odbc/ODriver.cxx +++ b/connectivity/source/drivers/odbc/ODriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ODriver.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2000-09-21 09:54:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,7 +75,9 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; // -------------------------------------------------------------------------------- -ODBCDriver::ODBCDriver() : ODriver_BASE(m_aMutex),m_pDriverHandle(SQL_NULL_HANDLE) +ODBCDriver::ODBCDriver() + : ODriver_BASE(m_aMutex) + ,m_pDriverHandle(SQL_NULL_HANDLE) { } // -------------------------------------------------------------------------------- @@ -101,10 +103,12 @@ rtl::OUString ODBCDriver::getImplementationName_Static( ) throw(RuntimeExceptio { return rtl::OUString::createFromAscii("com.sun.star.sdbc.ODBCDriver"); } + +typedef Sequence< ::rtl::OUString > SS; //------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > ODBCDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +SS ODBCDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { - Sequence< ::rtl::OUString > aSNS( 1 ); + SS aSNS( 1 ); aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); return aSNS; } @@ -118,17 +122,17 @@ Sequence< ::rtl::OUString > ODBCDriver::getSupportedServiceNames_Static( ) thro //------------------------------------------------------------------ sal_Bool SAL_CALL ODBCDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + SS aSupported(getSupportedServiceNames()); const ::rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } //------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL ODBCDriver::getSupportedServiceNames( ) throw(RuntimeException) +SS SAL_CALL ODBCDriver::getSupportedServiceNames( ) throw(RuntimeException) { return getSupportedServiceNames_Static(); } @@ -149,7 +153,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& ur } OConnection* pCon = new OConnection(m_pDriverHandle,this); pCon->Construct(url,info); - Reference< XConnection > xCon = pCon; + Reference< XConnection > xCon = NULL; m_xConnections.push_back(WeakReferenceHelper(*pCon)); return xCon; @@ -158,11 +162,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& ur sal_Bool SAL_CALL ODBCDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:odbc:"),10)) - { - return sal_True; - } - return sal_False; + return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:odbc:"),10)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) @@ -191,10 +191,7 @@ SQLHANDLE ODBCDriver::EnvironmentHandle(::rtl::OUString &_rPath) // Environment allozieren // ODBC-DLL jetzt laden: - if (!LoadLibrary_ODBC3(_rPath)) - return SQL_NULL_HANDLE; - - if (N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS) + if (!LoadLibrary_ODBC3(_rPath) || N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS) return SQL_NULL_HANDLE; // In globaler Struktur merken ... diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx index ebc197ba08ff..38cde70951bf 100644 --- a/connectivity/source/drivers/odbc/OFunctions.cxx +++ b/connectivity/source/drivers/odbc/OFunctions.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OFunctions.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2000-09-21 09:54:26 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,9 @@ #ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ #include "odbc/OFunctions.hxx" #endif +#ifndef _OSL_PROCESS_H_ +#include <osl/process.h> +#endif // Implib-Definitionen fuer ODBC-DLL/shared library: @@ -77,8 +80,9 @@ sal_Bool connectivity::LoadLibrary_ADABAS(::rtl::OUString &_rPath) if (bLoaded) return sal_True; - char *pPath =getenv("DBROOT"); - if(pPath) + rtl_uString* pPath = NULL; + ::rtl::OUString sTemp = ::rtl::OUString::createFromAscii("DBROOT"); + if(osl_getEnvironment(sTemp.pData,&pPath) == osl_Process_E_None && pPath) { #if ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx index db6ee38d29b0..7b93ec76faa7 100644 --- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OPreparedStatement.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:54:55 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,10 +79,6 @@ #ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ #include "odbc/OResultSetMetaData.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE odbc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> #endif @@ -92,6 +88,9 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif using namespace connectivity; using namespace connectivity::odbc; @@ -147,8 +146,8 @@ Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(Runt Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -162,8 +161,8 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + // Close/clear our result set clearMyResultSet (); @@ -187,11 +186,9 @@ void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + - sal_Bool hasResultSet = sal_False; - SQLWarning warning; sal_Bool needData = sal_False; // Reset warnings @@ -242,11 +239,6 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc } catch (SQLWarning& ex) { - - // Save pointer to warning and save with ResultSet - // object once it is created. - - warning = ex; } // Now loop while more data is needed (i.e. a data-at- @@ -278,19 +270,16 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc // the SQL statement that was executed. Get the column // count, and if it is not zero, there is a result set. - if (getColumnCount () > 0) - hasResultSet = sal_True; - - return hasResultSet; + return getColumnCount() > 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + sal_Int32 numRows = -1; if(!isPrepared()) @@ -316,8 +305,8 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -329,8 +318,8 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::r Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + return (Reference< XConnection >)m_pConnection; } // ------------------------------------------------------------------------- @@ -338,8 +327,8 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + Reference< XResultSet > rs = NULL; if(!isPrepared()) @@ -363,8 +352,8 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + sal_Int32 value = 0; @@ -378,7 +367,7 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool } // ------------------------------------------------------------------------- #define PREP_BIND_PARAM(_ty,_jt) \ - bindParameter( m_aStatementHandle, \ + OTools::bindParameter( m_aStatementHandle, \ parameterIndex, \ bindBuf,getLengthBuf(parameterIndex), \ _jt, \ @@ -389,8 +378,8 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -398,7 +387,7 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_Int8* bindBuf = allocBindBuf(parameterIndex, 4); @@ -409,8 +398,8 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -419,7 +408,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32); @@ -433,8 +422,8 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -442,7 +431,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32); @@ -455,8 +444,8 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -464,7 +453,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32); @@ -477,8 +466,8 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -486,7 +475,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_Int8* bindBuf = allocBindBuf (parameterIndex, 8); @@ -498,8 +487,8 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -507,7 +496,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_Int8* bindBuf = allocBindBuf (parameterIndex, 8); @@ -518,8 +507,8 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -527,7 +516,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_Int8* bindBuf = allocBindBuf (parameterIndex, 4); @@ -538,8 +527,8 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -548,7 +537,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 a // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_Int8 *bindBuf = allocBindBuf (parameterIndex, 8); @@ -560,14 +549,14 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 a void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); // Get the buffer needed for the length if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); sal_Int8* lenBuf = getLengthBuf (parameterIndex); *(SDWORD*)lenBuf = SQL_NULL_DATA; @@ -601,8 +590,8 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); } @@ -611,8 +600,8 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); } @@ -621,8 +610,8 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); } @@ -631,8 +620,8 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); } @@ -640,9 +629,8 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { + checkDisposed(OStatement_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); if(!isPrepared()) prepareStatement(); @@ -656,13 +644,9 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c break; case DataType::VARCHAR: - setChar (parameterIndex, sqlType, 0, *(::rtl::OUString*) x.getValue()); - break; - case DataType::LONGVARCHAR: setChar (parameterIndex, sqlType, 0, *(::rtl::OUString*) x.getValue()); break; - case DataType::BIT: setBoolean (parameterIndex,*(sal_Bool*) x.getValue()); break; @@ -684,13 +668,9 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c break; case DataType::REAL: - setFloat (parameterIndex, *(float*)x.getValue ()); - break; - case DataType::FLOAT: setFloat (parameterIndex, *(float*)x.getValue ()); break; - case DataType::DOUBLE: setDouble (parameterIndex,*(double*)x.getValue ()); break; @@ -743,8 +723,8 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + setNull(parameterIndex,sqlType); } // ------------------------------------------------------------------------- @@ -752,8 +732,8 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -764,8 +744,8 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -773,7 +753,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_Int8* bindBuf = allocBindBuf (parameterIndex, 4); @@ -784,8 +764,8 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -804,8 +784,8 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -816,8 +796,8 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!isPrepared()) prepareStatement(); @@ -987,6 +967,13 @@ sal_Int32 OPreparedStatement::getParamLength ( sal_Int32 index) void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException) { + // Sanity check the parameter index + if ((index < 1) || + (index > numParams)) + { + return; + } + // We'll transfer up to maxLen at a time sal_Int32 maxLen = MAX_PUT_DATA_LENGTH; sal_Int32 bufLen; @@ -995,13 +982,6 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException) Sequence< sal_Int8 > buf(maxLen); sal_Bool endOfStream = sal_False; - // Sanity check the parameter index - if ((index < 1) || - (index > numParams)) - { - return; - } - // Get the information about the input stream Reference< XInputStream> inputStream = boundParams[index - 1].getInputStream (); @@ -1009,80 +989,82 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException) sal_Int32 inputStreamType = boundParams[index - 1].getStreamType (); // Loop while more data from the input stream - - while (!endOfStream) + try { - // Read some data from the input stream + while (!endOfStream) + { - try { + // Read some data from the input stream bufLen = inputStream->readBytes(buf,maxLen); - } - catch (IOException& ex) { - // If an I/O exception was generated, turn - // it into a SQLException + // -1 as the number of bytes read indicates that + // there is no more data in the input stream - throw SQLException(ex.Message,*this,::rtl::OUString(),0,Any()); - } + if (bufLen == -1) + { - // -1 as the number of bytes read indicates that - // there is no more data in the input stream + // Sanity check to ensure that all the data we said we + // had was read. If not, raise an exception - if (bufLen == -1) - { + if (inputStreamLen != 0) + { + throw SQLException (::rtl::OUString::createFromAscii("End of InputStream reached before satisfying length specified when InputStream was set"), + *this, + ::rtl::OUString(),0,Any()); + } + endOfStream = sal_True; + break; + } - // Sanity check to ensure that all the data we said we - // had was read. If not, raise an exception + // If we got more bytes than necessary, truncate + // the buffer by re-setting the buffer length. Also, + // indicate that we don't need to read any more. - if (inputStreamLen != 0) { - throw SQLException (::rtl::OUString::createFromAscii("End of InputStream reached before satisfying length specified when InputStream was set"), - *this, - ::rtl::OUString(),0,Any()); + if (bufLen > inputStreamLen) + { + bufLen = inputStreamLen; + endOfStream = sal_True; } - endOfStream = sal_True; - break; - } - // If we got more bytes than necessary, truncate - // the buffer by re-setting the buffer length. Also, - // indicate that we don't need to read any more. + realLen = bufLen; - if (bufLen > inputStreamLen) - { - bufLen = inputStreamLen; - endOfStream = sal_True; - } + // For UNICODE streams, strip off the high sal_Int8 and set the + // number of actual bytes present. It is assumed that + // there are 2 bytes present for every UNICODE character - if + // not, then that's not our problem - realLen = bufLen; + if (inputStreamType == OBoundParam::UNICODE) + { + realLen = bufLen / 2; - // For UNICODE streams, strip off the high sal_Int8 and set the - // number of actual bytes present. It is assumed that - // there are 2 bytes present for every UNICODE character - if - // not, then that's not our problem + for (sal_Int32 ii = 0; ii < realLen; ii++) + buf[ii] = buf[(ii * 2) + 1]; + } - if (inputStreamType == OBoundParam::UNICODE) - { - realLen = bufLen / 2; + // Put the data + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - for (sal_Int32 ii = 0; ii < realLen; ii++) - buf[ii] = buf[(ii * 2) + 1]; - } + N3SQLPutData (m_aStatementHandle, buf.getArray(), realLen); - // Put the data - OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); + // Decrement the number of bytes still needed - N3SQLPutData (m_aStatementHandle, buf.getArray(), realLen); + inputStreamLen -= bufLen; - // Decrement the number of bytes still needed - inputStreamLen -= bufLen; + // If there is no more data to be read, exit loop + if (inputStreamLen == 0) + endOfStream = sal_True; + } + } + catch (const IOException& ex) + { - // If there is no more data to be read, exit loop + // If an I/O exception was generated, turn + // it into a SQLException - if (inputStreamLen == 0) - endOfStream = sal_True; + throw SQLException(ex.Message,*this,::rtl::OUString(),0,Any()); } } // ------------------------------------------------------------------------- @@ -1095,14 +1077,13 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException) sal_Int32 OPreparedStatement::getPrecision ( sal_Int32 sqlType) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); sal_Int32 prec = -1; - OTypeInfo aInfo; - aInfo.nType = sqlType; if (m_aTypeInfo.size()) { + OTypeInfo aInfo; + aInfo.nType = sqlType; TTypeInfoVector::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo); if(aIter != m_aTypeInfo.end()) prec = (*aIter).nPrecision; @@ -1124,7 +1105,7 @@ void OPreparedStatement::setStream ( throw(SQLException) { if( !ParameterIndex || ParameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); // Get the buffer needed for the length sal_Int8* lenBuf = getLengthBuf(ParameterIndex); @@ -1172,7 +1153,7 @@ void OPreparedStatement::setChar(sal_Int32 parameterIndex, // ::rtl::OString x1(::rtl::OUStringToOString(x,getConnection()->getTextEncoding())); if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); sal_Int8* bindBuf = allocBindBuf (parameterIndex,x.getLength()); @@ -1214,14 +1195,14 @@ void OPreparedStatement::setBinary (sal_Int32 parameterIndex,sal_Int32 SQLtype, // a 'permanent' buffer that the bridge will fill in with // the bound data in native format. if( !parameterIndex || parameterIndex > numParams) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + ::dbtools::throwInvalidIndexException(*this); sal_Int8* bindBuf = allocBindBuf (parameterIndex,x.getLength()); // Get the buffer needed for the length // sal_Int8* lenBuf = getLengthBuf (parameterIndex); - bindParameter< Sequence< sal_Int8 > >( m_aStatementHandle, + OTools::bindParameter( m_aStatementHandle, parameterIndex, bindBuf,getLengthBuf(parameterIndex), SQLtype, diff --git a/connectivity/source/drivers/odbc/OTools.cxx b/connectivity/source/drivers/odbc/OTools.cxx index 6dd66b8d39b5..d4316eb8af58 100644 --- a/connectivity/source/drivers/odbc/OTools.cxx +++ b/connectivity/source/drivers/odbc/OTools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OTools.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:44 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,7 +82,424 @@ using namespace com::sun::star::uno; using namespace com::sun::star::sdbc; using namespace com::sun::star::util; +void OTools::getValue( SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _nType, + sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + void* _pValue,SQLINTEGER _rSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SQLINTEGER pcbValue; + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + (SQLUSMALLINT)columnIndex, + _nType, + _pValue, + (SQLINTEGER)_rSize, + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface,sal_False); + _bWasNull = pcbValue == SQL_NULL_DATA; +} +// ----------------------------------------------------------------------------- +void OTools::bindParameter(SQLHANDLE _hStmt, + sal_Int32 nPos, + sal_Int8* pDataBuffer, + sal_Int8* pLenBuffer, + SQLSMALLINT _nJDBCtype, + sal_Bool _bUseWChar, + sal_Bool _bUseOldTimeDate, + const void* _pValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + rtl_TextEncoding _nTextEncoding) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SQLRETURN nRetcode; + SWORD fSqlType; + SWORD fCType; + SDWORD nMaxLen = 0; + void* pData = pDataBuffer; + SDWORD* pLen = (SDWORD*)pLenBuffer; + SQLUINTEGER nColumnSize=0; + SQLSMALLINT nDecimalDigits=0; + SQLSMALLINT nNullable=0; + + OTools::getBindTypes(_bUseWChar,_bUseOldTimeDate,_nJDBCtype,fSqlType,fCType,nColumnSize,nDecimalDigits); + + OTools::bindData(fSqlType,_bUseWChar,pData,pLen,_pValue,_nTextEncoding); + if(fSqlType == SQL_LONGVARCHAR || fSqlType == SQL_LONGVARBINARY) + memcpy(pData,&nPos,sizeof(nPos)); + + nRetcode = N3SQLDescribeParam(_hStmt,(SQLUSMALLINT)nPos,&fSqlType,&nColumnSize,&nDecimalDigits,&nNullable); + + nRetcode = N3SQLBindParameter(_hStmt, + (SQLUSMALLINT)nPos, + SQL_PARAM_INPUT, + fCType, + fSqlType, + nColumnSize, + nDecimalDigits, + pData, + nMaxLen, + pLen); + + OTools::ThrowException(nRetcode,_hStmt,SQL_HANDLE_STMT,_xInterface); +} +// ----------------------------------------------------------------------------- +void OTools::bindData( SWORD fSqlType, + sal_Bool _bUseWChar, + void *&_pData, + SDWORD*& pLen, + const void* _pValue, + rtl_TextEncoding _nTextEncoding) +{ + SDWORD nMaxLen = 0; + + switch (fSqlType) + { + case SQL_CHAR: + case SQL_VARCHAR: + if(_bUseWChar) + { + *pLen = SQL_NTS; + *((rtl::OUString*)_pData) = *(::rtl::OUString*)_pValue; + + // Zeiger auf Char* + _pData = (void*)((rtl::OUString*)_pData)->getStr(); + } + else + { + ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding)); + *pLen = SQL_NTS; + memcpy(_pData,aString.getStr(),aString.getLength()); + ((sal_Int8*)_pData)[aString.getLength()] = '\0'; + } break; + + case SQL_BIGINT: + case SQL_DECIMAL: + case SQL_NUMERIC: + if(_bUseWChar) + { + ::rtl::OUString aString = rtl::OUString::valueOf(*(double*)_pValue); + nMaxLen = aString.getLength(); + *pLen = nMaxLen; + *((rtl::OUString*)_pData) = aString; + // Zeiger auf Char* + _pData = (void*)((rtl::OUString*)_pData)->getStr(); + } + else + { + ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue); + nMaxLen = aString.getLength(); + *pLen = nMaxLen; + memcpy(_pData,aString.getStr(),aString.getLength()); + ((sal_Int8*)_pData)[aString.getLength()] = '\0'; + } break; + case SQL_BIT: + *((sal_Int8*)_pData) = *(sal_Int8*)_pValue; + *pLen = sizeof(sal_Int8); + break; + case SQL_TINYINT: + case SQL_SMALLINT: + *((sal_Int16*)_pData) = *(sal_Int16*)_pValue; + *pLen = sizeof(sal_Int16); + break; + case SQL_INTEGER: + *((sal_Int32*)_pData) = *(sal_Int32*)_pValue; + *pLen = sizeof(sal_Int32); + break; + case SQL_REAL: + *((float*)_pData) = *(float*)_pValue; + *pLen = sizeof(float); + break; + case SQL_DOUBLE: + *((double*)_pData) = *(double*)_pValue; + *pLen = sizeof(double); + break; + case SQL_BINARY: + case SQL_VARBINARY: + _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); + *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + break; + case SQL_LONGVARBINARY: + { + sal_Int32 nLen = 0; + nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } + break; + case SQL_LONGVARCHAR: + { + _pData = 0;//(void*)&rCol; + sal_Int32 nLen = 0; + if(_bUseWChar) + nLen = sizeof(sal_Unicode) * ((::rtl::OUString*)_pValue)->getLength(); + else + { + ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding)); + nLen = aString.getLength(); + } + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } break; + case SQL_DATE: + *(DATE_STRUCT*)_pData = *(DATE_STRUCT*)_pValue; + *pLen = (SDWORD)sizeof(DATE_STRUCT); + break; + case SQL_TIME: + *(TIME_STRUCT*)_pData = *(TIME_STRUCT*)_pValue; + *pLen = (SDWORD)sizeof(TIME_STRUCT); + break; + case SQL_TIMESTAMP: + *(TIMESTAMP_STRUCT*)_pData = *(TIMESTAMP_STRUCT*)_pValue; + *pLen = (SDWORD)sizeof(TIMESTAMP_STRUCT); + break; + } +} // ------------------------------------------------------------------------- +void OTools::bindValue( SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _nType, + SQLSMALLINT _nMaxLen, + SQLSMALLINT _nScale, + const void* _pValue, + void* _pData, + SQLINTEGER *pLen, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + rtl_TextEncoding _nTextEncoding) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SQLRETURN nRetcode; + SWORD fSqlType; + SWORD fCType; + + switch(_nType) + { + case SQL_CHAR: //if(GetODBCConnection()->m_bUserWChar) + // { +// fCType = SQL_C_WCHAR; +// fSqlType = SQL_WCHAR; +// } + // else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_CHAR; + } + break; + case SQL_VARCHAR: //if(GetODBCConnection()->m_bUserWChar) +// { +// fCType = SQL_C_WCHAR; +// fSqlType = SQL_WVARCHAR; +// } +// else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_VARCHAR; + } + break; + case SQL_LONGVARCHAR: //if(GetODBCConnection()->m_bUserWChar) +// { +// fCType = SQL_C_WCHAR; +// fSqlType = SQL_WLONGVARCHAR; +// } +// else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_LONGVARCHAR; + } + break; + case SQL_DECIMAL: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_DECIMAL; break; + case SQL_NUMERIC: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_NUMERIC; break; + case SQL_BIT: fCType = SQL_C_TINYINT; + fSqlType = SQL_INTEGER; break; + case SQL_TINYINT: fCType = SQL_C_SHORT; + fSqlType = SQL_TINYINT; break; + case SQL_SMALLINT: fCType = SQL_C_SHORT; + fSqlType = SQL_SMALLINT; break; + case SQL_INTEGER: fCType = SQL_C_LONG; + fSqlType = SQL_INTEGER; break; + case SQL_BIGINT: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_BIGINT; break; + case SQL_REAL: fCType = SQL_C_FLOAT; + fSqlType = SQL_REAL; break; + case SQL_DOUBLE: fCType = SQL_C_DOUBLE; + fSqlType = SQL_DOUBLE; break; + case SQL_BINARY: fCType = SQL_C_BINARY; + fSqlType = SQL_BINARY; break; + case SQL_VARBINARY: + fCType = SQL_C_BINARY; + fSqlType = SQL_VARBINARY; break; + case SQL_LONGVARBINARY: fCType = SQL_C_BINARY; + fSqlType = SQL_LONGVARBINARY; break; + case SQL_DATE: + // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) + { + fCType = SQL_C_DATE; + fSqlType = SQL_DATE; + } +// else +// { +// fCType = SQL_C_TYPE_DATE; +// fSqlType = SQL_TYPE_DATE; +// } + break; + case SQL_TIME: + // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) + { + fCType = SQL_C_TIME; + fSqlType = SQL_TIME; + } +// else +// { +// fCType = SQL_C_TYPE_TIME; +// fSqlType = SQL_TYPE_TIME; +// } + break; + case SQL_TIMESTAMP: + // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) + { + fCType = SQL_C_TIMESTAMP; + fSqlType = SQL_TIMESTAMP; + } +// else +// { +// fCType = SQL_C_TYPE_TIMESTAMP; +// fSqlType = SQL_TYPE_TIMESTAMP; +// } + break; + default: fCType = SQL_C_BINARY; + fSqlType = SQL_LONGVARBINARY; break; + } + + if (columnIndex != 0 && !_pValue) + { + *pLen = SQL_NULL_DATA; + nRetcode = N3SQLBindCol(_aStatementHandle, + columnIndex, + fCType, + _pData, + _nMaxLen, + pLen + ); + } + else + { + try + { + switch (_nType) + { + case SQL_CHAR: + case SQL_VARCHAR: + //if(GetODBCConnection()->m_bUserWChar) +// { +// _nMaxLen = rCol.GetPrecision(); +// *pLen = SQL_NTS; +// *((rtl::OUString*)pData) = (rtl::OUString)_aValue; +// +// // Zeiger auf Char* +// pData = (void*)((rtl::OUString*)pData)->getStr(); +// } +// else + { + ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding)); + *pLen = SQL_NTS; + *((::rtl::OString*)_pData) = aString; + _nMaxLen = aString.getLength(); + + // Zeiger auf Char* + _pData = (void*)aString.getStr(); + } break; + case SQL_BIGINT: + case SQL_DECIMAL: + case SQL_NUMERIC: + //if(GetODBCConnection()->m_bUserWChar) +// { +// rtl::OUString aString(rtl::OUString(SdbTools::ToString(ODbTypeConversion::toDouble(*pVariable),rCol.GetScale()))); +// *pLen = _nMaxLen; +// *((rtl::OUString*)_pData) = aString; +// // Zeiger auf Char* +// _pData = (void*)((rtl::OUString*)_pData)->getStr(); +// } +// else + { + ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue); + _nMaxLen = aString.getLength(); + *pLen = _nMaxLen; + *((::rtl::OString*)_pData) = aString; + // Zeiger auf Char* + _pData = (void*)((::rtl::OString*)_pData)->getStr(); + } break; + case SQL_BIT: + *((sal_Int8*)_pData) = *(sal_Int8*)_pValue; + *pLen = sizeof(sal_Int8); + break; + case SQL_TINYINT: + case SQL_SMALLINT: + *((sal_Int16*)_pData) = *(sal_Int16*)_pValue; + *pLen = sizeof(sal_Int16); + break; + case SQL_INTEGER: + *((sal_Int32*)_pData) = *(sal_Int32*)_pValue; + *pLen = sizeof(sal_Int32); + break; + case SQL_REAL: + *((float*)_pData) = *(float*)_pValue; + *pLen = sizeof(float); + break; + case SQL_DOUBLE: + *((double*)_pData) = *(double*)_pValue; + *pLen = sizeof(double); + break; + case SQL_BINARY: + case SQL_VARBINARY: + // if (_pValue == ::getCppuType((const ::com::sun::star::uno::Sequence< sal_Int8 > *)0)) + { + _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); + *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + } break; + case SQL_LONGVARBINARY: + { + sal_Int32 nLen = 0; + nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } + break; + case SQL_LONGVARCHAR: + { + sal_Int32 nLen = 0; + nLen = ((::rtl::OUString*)_pValue)->getLength(); + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } break; + case SQL_DATE: + *pLen = sizeof(DATE_STRUCT); + *((DATE_STRUCT*)_pData) = *(DATE_STRUCT*)_pValue; + break; + case SQL_TIME: + *pLen = sizeof(TIME_STRUCT); + *((TIME_STRUCT*)_pData) = *(TIME_STRUCT*)_pValue; + break; + case SQL_TIMESTAMP: + *pLen = sizeof(TIMESTAMP_STRUCT); + *((TIMESTAMP_STRUCT*)_pData) = *(TIMESTAMP_STRUCT*)_pValue; + } + } + catch ( ... ) + { + } +// SQLINTEGER *pLen = &aLen; +// bindData< T >(fSqlType,sal_False,_pData,pLen,_pValue); + + + nRetcode = N3SQLBindCol(_aStatementHandle, + columnIndex, + fCType, + _pData, + _nMaxLen, + pLen + ); + } + + OTools::ThrowException(nRetcode,_aStatementHandle,SQL_HANDLE_STMT,_xInterface); +} +// ----------------------------------------------------------------------------- void OTools::ThrowException(SQLRETURN _rRetCode,SQLHANDLE _pContext,SQLSMALLINT _nHandleType,const Reference< XInterface >& _xInterface,sal_Bool _bNoFound,rtl_TextEncoding _nTextEncoding) throw(SQLException, RuntimeException) { switch(_rRetCode) diff --git a/connectivity/source/drivers/odbc/makefile.mk b/connectivity/source/drivers/odbc/makefile.mk index 8b1806f101ea..bebf64345dc1 100644 --- a/connectivity/source/drivers/odbc/makefile.mk +++ b/connectivity/source/drivers/odbc/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.9 $ # -# last change: $Author: oj $ $Date: 2001-03-19 09:35:29 $ +# last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -63,9 +63,13 @@ PRJ=..$/..$/.. PRJINC=..$/.. PRJNAME=connectivity -TARGET=odbc +TARGET=odbcbase +TARGET2=odbc +USE_LDUMP2=TRUE +USE_DEFFILE=TRUE ENABLE_EXCEPTIONS=TRUE +LDUMP=ldump2.exe # --- Settings ---------------------------------- .IF "$(DBGUTIL_OJ)"!="" @@ -77,7 +81,6 @@ ENVCFLAGS+=/FR$(SLO)$/ # --- Files ------------------------------------- - SLOFILES=\ $(SLO)$/OPreparedStatement.obj \ $(SLO)$/OStatement.obj \ @@ -88,12 +91,13 @@ SLOFILES=\ $(SLO)$/ODatabaseMetaData.obj \ $(SLO)$/ODriver.obj \ $(SLO)$/OFunctions.obj \ - $(SLO)$/oservices.obj \ $(SLO)$/OConnection.obj -# --- Library ----------------------------------- + + +# --- ODBC BASE Library ----------------------------------- -SHL1TARGET= $(ODBC_TARGET)$(ODBC_MAJOR) +SHL1TARGET= $(ODBC2_TARGET)$(ODBC2_MAJOR) SHL1OBJS=$(SLOFILES) SHL1STDLIBS=\ $(CPPULIB) \ @@ -104,21 +108,59 @@ SHL1STDLIBS=\ $(DBTOOLSLIB) \ $(COMPHELPERLIB) -.IF "$(COMPHELPERLIB)" == "" -SHL1STDLIBS+= icomphelp2.lib -.ENDIF - SHL1DEPN= -SHL1IMPLIB= i$(ODBC_TARGET) +SHL1IMPLIB= i$(ODBC2_TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp +DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \ + $(SLB)$/$(TARGET).lib +DEFLIB1NAME=$(TARGET) + +# --- ODBC Library ----------------------------------- +# --- Files ------------------------------------- +SLO2FILES=\ + $(SLO)$/oservices.obj + +# --- ODBC Library ----------------------------------- +SHL2TARGET= $(ODBC_TARGET)$(ODBC_MAJOR) +SHL2OBJS=$(SLO2FILES) +SHL2STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) \ + $(DBTOOLSLIB) \ + $(ODBCBASELIB) \ + $(COMPHELPERLIB) + +.IF "$(ODBCBASELIB)" == "" +SHL2STDLIBS+= iodbcbase.lib +.ENDIF + +SHL2DEPN= +SHL2IMPLIB= i$(ODBC_TARGET) + +SHL2DEF= $(MISC)$/$(SHL2TARGET).def + +DEF2NAME= $(SHL2TARGET) +DEF2EXPORTFILE= exports.dxp # --- Targets ---------------------------------- .INCLUDE : target.mk +# --- filter file ------------------------------ + +.IF "$(depend)"=="" + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo CLEAR_THE_FILE > $@ + @echo _TI >>$@ + @echo _real >>$@ +.ENDIF diff --git a/connectivity/source/inc/TConnection.hxx b/connectivity/source/inc/TConnection.hxx index 7edc93333f87..44957d3e9525 100644 --- a/connectivity/source/inc/TConnection.hxx +++ b/connectivity/source/inc/TConnection.hxx @@ -2,9 +2,9 @@ * * $RCSfile: TConnection.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-27 10:08:11 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,9 @@ #ifndef _CPPUHELPER_COMPBASE4_HXX_ #include <cppuhelper/compbase4.hxx> #endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif namespace connectivity @@ -93,8 +96,12 @@ namespace connectivity { protected: ::osl::Mutex m_aMutex; + static ::dbtools::OPropertyMap s_aPropertyNameMap; rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions public: + + static ::dbtools::OPropertyMap& getPropMap(); + OMetaConnection() : OMetaConnection_BASE(m_aMutex) ,m_nTextEncoding(RTL_TEXTENCODING_MS_1252){} rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; } diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx index 8f080bad12df..dbee80f7b69e 100644 --- a/connectivity/source/inc/ado/Awrapado.hxx +++ b/connectivity/source/inc/ado/Awrapado.hxx @@ -2,9 +2,9 @@ * * $RCSfile: Awrapado.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-25 06:12:01 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,192 +107,68 @@ namespace connectivity WpADOConnection(const WpADOConnection& rhs){operator=(rhs);} - inline WpADOConnection& operator=(const WpADOConnection& rhs) + WpADOConnection& operator=(const WpADOConnection& rhs) {WpOLEBase<ADOConnection>::operator=(rhs); return *this;} ////////////////////////////////////////////////////////////////////// - inline ADOProperties* get_Properties() const - { - ADOProperties* pProps=NULL; - pInterface->get_Properties(&pProps); - return pProps; - } + ADOProperties* get_Properties() const; - inline rtl::OUString GetConnectionString() const - { - OLEString aBSTR; - pInterface->get_ConnectionString(&aBSTR); - return aBSTR; - } + rtl::OUString GetConnectionString() const; - inline sal_Bool PutConnectionString(const ::rtl::OUString &aCon) const - { - OLEString bstr(aCon); - sal_Bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr)); + sal_Bool PutConnectionString(const ::rtl::OUString &aCon) const; - return bErg; - } + sal_Int32 GetCommandTimeout() const; - inline sal_Int32 GetCommandTimeout() const - { - sal_Int32 nRet=0; - pInterface->get_CommandTimeout(&nRet); - return nRet; - } + void PutCommandTimeout(sal_Int32 nRet); - inline void PutCommandTimeout(sal_Int32 nRet) - { - pInterface->put_CommandTimeout(nRet); - } + sal_Int32 GetConnectionTimeout() const ; - inline sal_Int32 GetConnectionTimeout() const - { - sal_Int32 nRet=0; - pInterface->get_ConnectionTimeout(&nRet); - return nRet; - } + void PutConnectionTimeout(sal_Int32 nRet); - inline void PutConnectionTimeout(sal_Int32 nRet) - { - pInterface->put_ConnectionTimeout(nRet); - } + sal_Bool Close( ) ; - inline sal_Bool Close( ) - { - return (SUCCEEDED(pInterface->Close())); - } + sal_Bool Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset); - inline sal_Bool Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset) - { - OLEString sStr1(_CommandText); - sal_Bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,(_ADORecordset**)ppiRset)); - return bErg; - } + sal_Bool BeginTrans(); - inline sal_Bool BeginTrans() - { - sal_Int32 nIso=0; - return SUCCEEDED(pInterface->BeginTrans(&nIso)); - } + sal_Bool CommitTrans( ) ; - inline sal_Bool CommitTrans( ) - { - return SUCCEEDED(pInterface->CommitTrans()); - } + sal_Bool RollbackTrans( ); - inline sal_Bool RollbackTrans( ) - { - return SUCCEEDED(pInterface->RollbackTrans()); - } + sal_Bool Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options); - inline sal_Bool Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options) - { - OLEString sStr1(ConnectionString); - OLEString sStr2(UserID); - OLEString sStr3(Password); - sal_Bool bErg = SUCCEEDED(pInterface->Open(sStr1,sStr2,sStr3,Options)); - return bErg; - } + sal_Bool GetErrors(ADOErrors** pErrors); - inline sal_Bool GetErrors(ADOErrors** pErrors) - { - return SUCCEEDED(pInterface->get_Errors(pErrors)); - } + ::rtl::OUString GetDefaultDatabase() const; - inline ::rtl::OUString GetDefaultDatabase() const - { - OLEString aBSTR; pInterface->get_DefaultDatabase(&aBSTR); - return aBSTR; - } + sal_Bool PutDefaultDatabase(const ::rtl::OUString& _bstr); - inline sal_Bool PutDefaultDatabase(const ::rtl::OUString& _bstr) - { - OLEString bstr(_bstr); - sal_Bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr)); + IsolationLevelEnum get_IsolationLevel() const ; - return bErg; - } + sal_Bool put_IsolationLevel(const IsolationLevelEnum& eNum) ; - inline IsolationLevelEnum get_IsolationLevel() const - { - IsolationLevelEnum eNum=adXactUnspecified; - pInterface->get_IsolationLevel(&eNum); - return eNum; - } - - inline sal_Bool put_IsolationLevel(const IsolationLevelEnum& eNum) - { - return SUCCEEDED(pInterface->put_IsolationLevel(eNum)); - } - - inline sal_Int32 get_Attributes() const - { - sal_Int32 nRet=0; - pInterface->get_Attributes(&nRet); - return nRet; - } - - inline sal_Bool put_Attributes(sal_Int32 nRet) - { - return SUCCEEDED(pInterface->put_Attributes(nRet)); - } + sal_Int32 get_Attributes() const; - inline CursorLocationEnum get_CursorLocation() const - { - CursorLocationEnum eNum=adUseNone; - pInterface->get_CursorLocation(&eNum); - return eNum; - } + sal_Bool put_Attributes(sal_Int32 nRet); - inline sal_Bool put_CursorLocation(const CursorLocationEnum &eNum) - { - return SUCCEEDED(pInterface->put_CursorLocation(eNum)); - } + CursorLocationEnum get_CursorLocation() const; - inline ConnectModeEnum get_Mode() const - { - ConnectModeEnum eNum=adModeUnknown; - pInterface->get_Mode(&eNum); - return eNum; - } + sal_Bool put_CursorLocation(const CursorLocationEnum &eNum) ; - inline sal_Bool put_Mode(const ConnectModeEnum &eNum) - { + ConnectModeEnum get_Mode() const; - return SUCCEEDED(pInterface->put_Mode(eNum)); - } + sal_Bool put_Mode(const ConnectModeEnum &eNum) ; - inline ::rtl::OUString get_Provider() const - { - OLEString aBSTR; pInterface->get_Provider(&aBSTR); - return aBSTR; - } + ::rtl::OUString get_Provider() const; - inline sal_Bool put_Provider(const ::rtl::OUString& _bstr) - { - OLEString bstr(_bstr); - return SUCCEEDED(pInterface->put_Provider(bstr)); - } + sal_Bool put_Provider(const ::rtl::OUString& _bstr); - inline sal_Int32 get_State() const - { - sal_Int32 nRet=0; - pInterface->get_State(&nRet); - return nRet; - } + sal_Int32 get_State() const; - inline sal_Bool OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset) - { - return SUCCEEDED(pInterface->OpenSchema(eNum,Restrictions,SchemaID,pprset)); - } + sal_Bool OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset); - inline ::rtl::OUString get_Version() const - { - OLEString aBSTR; - pInterface->get_Version(&aBSTR); - return aBSTR; - } + ::rtl::OUString get_Version() const; }; //------------------------------------------------------------------------ @@ -306,153 +182,36 @@ namespace connectivity WpADOCommand(const WpADOCommand& rhs){operator=(rhs);} - inline WpADOCommand& operator=(const WpADOCommand& rhs) + WpADOCommand& operator=(const WpADOCommand& rhs) { WpOLEBase<ADOCommand>::operator=(rhs); return *this;} ////////////////////////////////////////////////////////////////////// - sal_Bool putref_ActiveConnection( WpADOConnection *pCon) - { - return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface)); - } - - void put_ActiveConnection(/* [in] */ const OLEVariant& vConn) - { - pInterface->put_ActiveConnection(vConn); - } - - inline void Create() - { - IClassFactory2* pIUnknown = NULL; - IUnknown *pOuter = NULL; - HRESULT hr; - hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21, - CLSCTX_INPROC_SERVER, - NULL, - IID_IClassFactory2, - (void**)&pIUnknown ); - - if( !FAILED( hr ) ) - { - pIUnknown->AddRef(); - ADOCommand* pCommand=NULL; - - hr = pIUnknown->CreateInstanceLic( pOuter, - NULL, - ADOS::IID_ADOCOMMAND_21, - ADOS::GetKeyStr(), - (void**) &pCommand); - - if( !FAILED( hr ) ) - { - pInterface = pCommand; - pInterface->AddRef(); - } - pIUnknown->Release(); - } - } - - inline sal_Int32 get_State() const - { - sal_Int32 nRet=0; - pInterface->get_State(&nRet); - return nRet; - } - - inline ::rtl::OUString get_CommandText() const - { - OLEString aBSTR; pInterface->get_CommandText(&aBSTR); - return aBSTR; - } - - inline sal_Bool put_CommandText(const ::rtl::OUString &aCon) - { - OLEString bstr(aCon); - sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr)); - - return bErg; - } - - inline sal_Int32 get_CommandTimeout() const - { - sal_Int32 nRet=0; - pInterface->get_CommandTimeout(&nRet); - return nRet; - } - - inline void put_CommandTimeout(sal_Int32 nRet) - { - pInterface->put_CommandTimeout(nRet); - } - - inline sal_Bool get_Prepared() const - { - VARIANT_BOOL bPrepared = VARIANT_FALSE; - pInterface->get_Prepared(&bPrepared); - return bPrepared == VARIANT_TRUE; - } - - inline sal_Bool put_Prepared(VARIANT_BOOL bPrepared) const - { - return SUCCEEDED(pInterface->put_Prepared(bPrepared)); - } - - inline sal_Bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset) - { - return SUCCEEDED(pInterface->Execute(&RecordsAffected,&Parameters,Options,ppiRset)); - } - - inline ADOParameter* CreateParameter(const ::rtl::OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value) - { - ADOParameter* pPara = NULL; - OLEString bstr(_bstr); - sal_Bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr,Type,Direction,nSize,Value,&pPara)); - - return bErg ? pPara : NULL; - } - - inline ADOParameters* get_Parameters() const - { - ADOParameters* pPara=NULL; - pInterface->get_Parameters(&pPara); - return pPara; - } - - inline sal_Bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType) - { - return SUCCEEDED(pInterface->put_CommandType(lCmdType)); - } - - inline CommandTypeEnum get_CommandType( ) const - { - CommandTypeEnum eNum=adCmdUnspecified; - pInterface->get_CommandType(&eNum); - return eNum; - } - + sal_Bool putref_ActiveConnection( WpADOConnection *pCon); + + void put_ActiveConnection(/* [in] */ const OLEVariant& vConn); + void Create(); + sal_Int32 get_State() const; + ::rtl::OUString get_CommandText() const; + sal_Bool put_CommandText(const ::rtl::OUString &aCon) ; + sal_Int32 get_CommandTimeout() const; + void put_CommandTimeout(sal_Int32 nRet); + sal_Bool get_Prepared() const; + sal_Bool put_Prepared(VARIANT_BOOL bPrepared) const; + sal_Bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset); + ADOParameter* CreateParameter(const ::rtl::OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value); + + ADOParameters* get_Parameters() const; + sal_Bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType); + CommandTypeEnum get_CommandType( ) const ; // gibt den Namen des Feldes zur"ueck - inline ::rtl::OUString GetName() const - { - OLEString aBSTR; - pInterface->get_Name(&aBSTR); - return aBSTR; - } - - inline sal_Bool put_Name(const ::rtl::OUString& _Name) - { - OLEString bstr(_Name); - sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr)); - - return bErg; - } - inline sal_Bool Cancel() - { - return SUCCEEDED(pInterface->Cancel()); - } + ::rtl::OUString GetName() const ; + sal_Bool put_Name(const ::rtl::OUString& _Name); + sal_Bool Cancel(); }; //------------------------------------------------------------------------ - class WpADOError:public WpOLEBase<ADOError> + class WpADOError : public WpOLEBase<ADOError> { public: @@ -463,45 +222,18 @@ namespace connectivity WpADOError(const WpADOError& rhs){operator=(rhs);} - inline WpADOError& operator=(const WpADOError& rhs) + WpADOError& operator=(const WpADOError& rhs) {WpOLEBase<ADOError>::operator=(rhs); return *this;} ////////////////////////////////////////////////////////////////////// - inline ::rtl::OUString GetDescription() const - { - OLEString aBSTR; - pInterface->get_Description(&aBSTR); - return aBSTR; - } + ::rtl::OUString GetDescription() const; - inline ::rtl::OUString GetSource() const - { - OLEString aBSTR; - pInterface->get_Source(&aBSTR); - return aBSTR; - } - - inline sal_Int32 GetNumber() const - { - sal_Int32 nErrNr=0; - pInterface->get_Number(&nErrNr); - return nErrNr; - } - - inline ::rtl::OUString GetSQLState() const - { - OLEString aBSTR; - pInterface->get_SQLState(&aBSTR); - return aBSTR; - } + ::rtl::OUString GetSource() const ; - inline sal_Int32 GetNativeError() const - { - sal_Int32 nErrNr=0; - pInterface->get_NativeError(&nErrNr); - return nErrNr; - } + sal_Int32 GetNumber() const ; + ::rtl::OUString GetSQLState() const ; + sal_Int32 GetNativeError() const ; }; @@ -517,157 +249,41 @@ namespace connectivity WpADOField(ADOField* pInt=NULL):WpOLEBase<ADOField>(pInt){} WpADOField(const WpADOField& rhs){operator=(rhs);} - inline WpADOField& operator=(const WpADOField& rhs) + WpADOField& operator=(const WpADOField& rhs) {WpOLEBase<ADOField>::operator=(rhs); return *this;} ////////////////////////////////////////////////////////////////////// - inline ADOProperties* get_Properties() - { - ADOProperties* pProps = NULL; - pInterface->get_Properties(&pProps); - return pProps; - } - - inline sal_Int32 GetActualSize() const - { - sal_Int32 nActualSize=0; - pInterface->get_ActualSize(&nActualSize); - return nActualSize; - } - - inline sal_Int32 GetAttributes() const - { - sal_Int32 eADOSFieldAttributes=0; - pInterface->get_Attributes(&eADOSFieldAttributes); - return eADOSFieldAttributes; - } - - inline sal_Int32 GetStatus() const - { - sal_Int32 eADOSFieldAttributes=0; - // pInterface->get_Status(&eADOSFieldAttributes); - return eADOSFieldAttributes; - } - - inline sal_Int32 GetDefinedSize() const - { - sal_Int32 nDefinedSize=0; - pInterface->get_DefinedSize(&nDefinedSize); - return nDefinedSize; - } - + ADOProperties* get_Properties(); + sal_Int32 GetActualSize() const ; + sal_Int32 GetAttributes() const ; + sal_Int32 GetStatus() const ; + sal_Int32 GetDefinedSize() const ; // gibt den Namen des Feldes zur"ueck - inline ::rtl::OUString GetName() const - { - OLEString aBSTR; - pInterface->get_Name(&aBSTR); - return aBSTR; - } - - inline DataTypeEnum GetADOType() const - { - DataTypeEnum eType=adEmpty; - pInterface->get_Type(&eType); - return eType; - } - - inline void get_Value(OLEVariant& aValVar) const - { - aValVar.setEmpty(); - pInterface->get_Value(&aValVar); - } + ::rtl::OUString GetName() const ; + DataTypeEnum GetADOType() const ; + void get_Value(OLEVariant& aValVar) const ; + OLEVariant get_Value() const; + sal_Bool PutValue(const OLEVariant& aVariant); + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + sal_Bool AppendChunk(const OLEVariant& _Variant); + OLEVariant GetChunk(long Length) const; + void GetChunk(long Length,OLEVariant &aValVar) const; + OLEVariant GetOriginalValue() const; + void GetOriginalValue(OLEVariant &aValVar) const; + OLEVariant GetUnderlyingValue() const; - inline OLEVariant get_Value() const - { - OLEVariant aValVar; - pInterface->get_Value(&aValVar); - return aValVar; - } + void GetUnderlyingValue(OLEVariant &aValVar) const; - inline sal_Bool PutValue(const OLEVariant& aVariant) - { - return (SUCCEEDED(pInterface->put_Value(aVariant))); - } + sal_Bool PutPrecision(sal_Int8 _prec); - inline sal_Int32 GetPrecision() const - { - sal_uInt8 eType=0; - pInterface->get_Precision(&eType); - return eType; - } + sal_Bool PutNumericScale(sal_Int8 _prec); - inline sal_Int32 GetNumericScale() const - { - sal_uInt8 eType=0; - pInterface->get_NumericScale(&eType); - return eType; - } + void PutADOType(DataTypeEnum eType) ; - inline sal_Bool AppendChunk(const OLEVariant& _Variant) - { - return (SUCCEEDED(pInterface->AppendChunk(_Variant))); - } + sal_Bool PutDefinedSize(sal_Int32 _nDefSize); - inline OLEVariant GetChunk(long Length) const - { - OLEVariant aValVar; - pInterface->GetChunk(Length,&aValVar); - return aValVar; - } - - inline void GetChunk(long Length,OLEVariant &aValVar) const - { - pInterface->GetChunk(Length,&aValVar); - } - - inline OLEVariant GetOriginalValue() const - { - OLEVariant aValVar; - pInterface->get_OriginalValue(&aValVar); - return aValVar; - } - - inline void GetOriginalValue(OLEVariant &aValVar) const - { - pInterface->get_OriginalValue(&aValVar); - } - - inline OLEVariant GetUnderlyingValue() const - { - OLEVariant aValVar; - pInterface->get_UnderlyingValue(&aValVar); - return aValVar; - } - - inline void GetUnderlyingValue(OLEVariant &aValVar) const - { - pInterface->get_UnderlyingValue(&aValVar); - } - - inline sal_Bool PutPrecision(sal_Int8 _prec) - { - return (SUCCEEDED(pInterface->put_Precision(_prec))); - } - - inline sal_Bool PutNumericScale(sal_Int8 _prec) - { - return (SUCCEEDED(pInterface->put_NumericScale(_prec))); - } - - inline void PutADOType(DataTypeEnum eType) - { - pInterface->put_Type(eType); - } - - inline sal_Bool PutDefinedSize(sal_Int32 _nDefSize) - { - return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize))); - } - - inline sal_Bool PutAttributes(sal_Int32 _nDefSize) - { - return (SUCCEEDED(pInterface->put_Attributes(_nDefSize))); - } + sal_Bool PutAttributes(sal_Int32 _nDefSize); }; @@ -682,56 +298,21 @@ namespace connectivity // diese rufen nur die Oberklasse WpADOProperty(ADOProperty* pInt):WpOLEBase<ADOProperty>(pInt){} WpADOProperty(const WpADOProperty& rhs){operator=(rhs);} - inline WpADOProperty& operator=(const WpADOProperty& rhs) + WpADOProperty& operator=(const WpADOProperty& rhs) {WpOLEBase<ADOProperty>::operator=(rhs); return *this;} ////////////////////////////////////////////////////////////////////// - inline OLEVariant GetValue() const - { - OLEVariant aValVar; - pInterface->get_Value(&aValVar); - return aValVar; - } - - inline void GetValue(OLEVariant &aValVar) const - { - pInterface->get_Value(&aValVar); - } - - inline sal_Bool PutValue(const OLEVariant &aValVar) - { - return (SUCCEEDED(pInterface->put_Value(aValVar))); - } - - inline ::rtl::OUString GetName() const - { - OLEString aBSTR; - pInterface->get_Name(&aBSTR); - return aBSTR; - } - - inline DataTypeEnum GetADOType() const - { - DataTypeEnum eType=adEmpty; - pInterface->get_Type(&eType); - return eType; - } - - inline sal_Int32 GetAttributes() const - { - sal_Int32 eADOSFieldAttributes=0; - pInterface->get_Attributes(&eADOSFieldAttributes); - return eADOSFieldAttributes; - } - - inline sal_Bool PutAttributes(sal_Int32 _nDefSize) - { - return (SUCCEEDED(pInterface->put_Attributes(_nDefSize))); - } + OLEVariant GetValue() const; + void GetValue(OLEVariant &aValVar) const; + sal_Bool PutValue(const OLEVariant &aValVar) ; + ::rtl::OUString GetName() const ; + DataTypeEnum GetADOType() const ; + sal_Int32 GetAttributes() const ; + sal_Bool PutAttributes(sal_Int32 _nDefSize); }; - class WpADORecordset:public WpOLEBase<ADORecordset> + class WpADORecordset : public WpOLEBase<ADORecordset> { public: @@ -739,7 +320,7 @@ namespace connectivity // diese rufen nur die Oberklasse WpADORecordset(ADORecordset* pInt=NULL):WpOLEBase<ADORecordset>(pInt){} WpADORecordset(const WpADORecordset& rhs){operator=(rhs);} - inline WpADORecordset& operator=(const WpADORecordset& rhs) + WpADORecordset& operator=(const WpADORecordset& rhs) { WpOLEBase<ADORecordset>::operator=(rhs); return *this; @@ -750,230 +331,50 @@ namespace connectivity // Close(); } ////////////////////////////////////////////////////////////////////// - inline void Create() - { - IClassFactory2* pIUnknown = NULL; - IUnknown *pOuter = NULL; - HRESULT hr; - hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21, - CLSCTX_INPROC_SERVER, - NULL, - IID_IClassFactory2, - (void**)&pIUnknown ); - - if( !FAILED( hr ) ) - { - pIUnknown->AddRef(); - - ADORecordset *pRec = NULL; - hr = pIUnknown->CreateInstanceLic( pOuter, - NULL, - ADOS::IID_ADORECORDSET_21, - ADOS::GetKeyStr(), - (void**) &pRec); - - if( !FAILED( hr ) ) - { - pInterface = pRec; - pInterface->AddRef(); - } - pIUnknown->Release(); - } - } - - inline sal_Bool Open( + void Create(); + sal_Bool Open( /* [optional][in] */ VARIANT Source, /* [optional][in] */ VARIANT ActiveConnection, /* [defaultvalue][in] */ CursorTypeEnum CursorType, /* [defaultvalue][in] */ LockTypeEnum LockType, - /* [defaultvalue][in] */ sal_Int32 Options) - { - return (SUCCEEDED(pInterface->Open(Source,ActiveConnection,CursorType,LockType,Options))); - } - - - inline LockTypeEnum GetLockType() - { - LockTypeEnum eType=adLockUnspecified; - pInterface->get_LockType(&eType); - return eType; - } - - inline void Close() - { - pInterface->Close(); - } - - inline sal_Bool Cancel() const - { - return (SUCCEEDED(pInterface->Cancel())); - } - - inline sal_Int32 get_State( ) - { - sal_Int32 nState = 0; - pInterface->get_State(&nState); - return nState; - } - - inline sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions) - { - VARIANT_BOOL bSupports=VARIANT_FALSE; - pInterface->Supports(CursorOptions,&bSupports); - return bSupports == VARIANT_TRUE; - } - - PositionEnum get_AbsolutePosition() - { - PositionEnum aTemp=adPosUnknown; - pInterface->get_AbsolutePosition(&aTemp); - return aTemp; - } - - inline void GetDataSource(IUnknown** pIUnknown) const - { - pInterface->get_DataSource(pIUnknown); - } - - inline void PutRefDataSource(IUnknown* pIUnknown) - { - pInterface->putref_DataSource(pIUnknown); - } - - inline void GetBookmark(VARIANT& var) - { - pInterface->get_Bookmark(&var); - } - - inline OLEVariant GetBookmark() - { - OLEVariant var; - pInterface->get_Bookmark(&var); - return var; - } - - CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right) - { - CompareEnum eNum=adCompareNotComparable; - pInterface->CompareBookmarks(left,right,&eNum); - return eNum; - } - - inline sal_Bool SetBookmark(const OLEVariant &pSafeAr) - { - return SUCCEEDED(pInterface->put_Bookmark(pSafeAr)); - } - - - inline ADOFields* GetFields() const - { - ADOFields* pFields=NULL; - pInterface->get_Fields(&pFields); - return pFields; - } - - - inline sal_Bool Move(sal_Int32 nRows, VARIANT aBmk) {return SUCCEEDED(pInterface->Move(nRows, aBmk));} - inline sal_Bool MoveNext() {return SUCCEEDED(pInterface->MoveNext());} - inline sal_Bool MovePrevious() {return SUCCEEDED(pInterface->MovePrevious());} - inline sal_Bool MoveFirst() {return SUCCEEDED(pInterface->MoveFirst());} - inline sal_Bool MoveLast() {return SUCCEEDED(pInterface->MoveLast());} - - inline sal_Bool IsAtBOF() const - { - VARIANT_BOOL bIsAtBOF=VARIANT_FALSE; - pInterface->get_BOF(&bIsAtBOF); - return bIsAtBOF == VARIANT_TRUE; - } - - inline sal_Bool IsAtEOF() const - { - VARIANT_BOOL bIsAtEOF=VARIANT_FALSE; - pInterface->get_EOF(&bIsAtEOF); - return bIsAtEOF == VARIANT_TRUE; - } - - inline sal_Bool Delete(AffectEnum eNum) - { - return SUCCEEDED(pInterface->Delete(eNum)); - } - - inline sal_Bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values) - { - return SUCCEEDED(pInterface->AddNew(FieldList,Values)); - } - - inline sal_Bool Update(const OLEVariant &FieldList,const OLEVariant &Values) - { - return SUCCEEDED(pInterface->Update(FieldList,Values)); - } - - inline sal_Bool CancelUpdate() - { - return SUCCEEDED(pInterface->CancelUpdate()); - } - - inline ADOProperties* get_Properties() const - { - ADOProperties* pProps=NULL; - pInterface->get_Properties(&pProps); - return pProps; - } - - inline sal_Bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset) - { - return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset)); - } - - inline sal_Bool get_RecordCount(sal_Int32 &_nRet) const - { - return SUCCEEDED(pInterface->get_RecordCount(&_nRet)); - } - - inline sal_Bool get_MaxRecords(sal_Int32 &_nRet) const - { - return SUCCEEDED(pInterface->get_MaxRecords(&_nRet)); - } - - inline sal_Bool put_MaxRecords(sal_Int32 _nRet) - { - return SUCCEEDED(pInterface->put_MaxRecords(_nRet)); - } - - inline sal_Bool get_CursorType(CursorTypeEnum &_nRet) const - { - return SUCCEEDED(pInterface->get_CursorType(&_nRet)); - } - - inline sal_Bool put_CursorType(CursorTypeEnum _nRet) - { - return SUCCEEDED(pInterface->put_CursorType(_nRet)); - } - - inline sal_Bool get_LockType(LockTypeEnum &_nRet) const - { - return SUCCEEDED(pInterface->get_LockType(&_nRet)); - } - - inline sal_Bool put_LockType(LockTypeEnum _nRet) - { - return SUCCEEDED(pInterface->put_LockType(_nRet)); - } - - inline sal_Bool get_CacheSize(sal_Int32 &_nRet) const - { - return SUCCEEDED(pInterface->get_CacheSize(&_nRet)); - } - - inline sal_Bool put_CacheSize(sal_Int32 _nRet) - { - return SUCCEEDED(pInterface->put_CacheSize(_nRet)); - } - - inline sal_Bool UpdateBatch(AffectEnum AffectRecords) - { - return SUCCEEDED(pInterface->UpdateBatch(AffectRecords)); - } + /* [defaultvalue][in] */ sal_Int32 Options); + LockTypeEnum GetLockType(); + void Close(); + sal_Bool Cancel() const; + sal_Int32 get_State( ); + sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions); + PositionEnum get_AbsolutePosition(); + void GetDataSource(IUnknown** pIUnknown) const ; + void PutRefDataSource(IUnknown* pIUnknown); + void GetBookmark(VARIANT& var); + OLEVariant GetBookmark(); + CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right); + sal_Bool SetBookmark(const OLEVariant &pSafeAr); + ADOFields* GetFields() const; + sal_Bool Move(sal_Int32 nRows, VARIANT aBmk); + sal_Bool MoveNext(); + sal_Bool MovePrevious(); + sal_Bool MoveFirst(); + sal_Bool MoveLast(); + + sal_Bool IsAtBOF() const; + sal_Bool IsAtEOF() const; + sal_Bool Delete(AffectEnum eNum); + sal_Bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values); + sal_Bool Update(const OLEVariant &FieldList,const OLEVariant &Values); + sal_Bool CancelUpdate(); + ADOProperties* get_Properties() const; + sal_Bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset); + sal_Bool get_RecordCount(sal_Int32 &_nRet) const; + sal_Bool get_MaxRecords(sal_Int32 &_nRet) const; + sal_Bool put_MaxRecords(sal_Int32 _nRet); + sal_Bool get_CursorType(CursorTypeEnum &_nRet) const; + sal_Bool put_CursorType(CursorTypeEnum _nRet); + sal_Bool get_LockType(LockTypeEnum &_nRet) const; + sal_Bool put_LockType(LockTypeEnum _nRet); + sal_Bool get_CacheSize(sal_Int32 &_nRet) const; + sal_Bool put_CacheSize(sal_Int32 _nRet); + sal_Bool UpdateBatch(AffectEnum AffectRecords); }; //------------------------------------------------------------------------ @@ -984,68 +385,19 @@ namespace connectivity // diese rufen nur die Oberklasse WpADOParameter(ADOParameter* pInt):WpOLEBase<ADOParameter>(pInt){} WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){} - inline WpADOParameter& operator=(const WpADOParameter& rhs) + WpADOParameter& operator=(const WpADOParameter& rhs) {WpOLEBase<ADOParameter>::operator=(rhs); return *this;} ////////////////////////////////////////////////////////////////////// - inline ::rtl::OUString GetName() const - { - OLEString aBSTR; - pInterface->get_Name(&aBSTR); - return aBSTR; - } - - inline DataTypeEnum GetADOType() const - { - DataTypeEnum eType=adEmpty; - pInterface->get_Type(&eType); - return eType; - } - - inline sal_Int32 GetAttributes() const - { - sal_Int32 eADOSFieldAttributes=0; - pInterface->get_Attributes(&eADOSFieldAttributes); - return eADOSFieldAttributes; - } - - inline sal_Int32 GetPrecision() const - { - sal_uInt8 eType=0; - pInterface->get_Precision(&eType); - return eType; - } - - inline sal_Int32 GetNumericScale() const - { - sal_uInt8 eType=0; - pInterface->get_NumericScale(&eType); - return eType; - } - - inline ParameterDirectionEnum get_Direction() const - { - ParameterDirectionEnum alParmDirection=adParamUnknown; - pInterface->get_Direction(&alParmDirection); - return alParmDirection; - } - - inline void GetValue(OLEVariant& aValVar) const - { - pInterface->get_Value(&aValVar); - } - - inline OLEVariant GetValue() const - { - OLEVariant aValVar; - pInterface->get_Value(&aValVar); - return aValVar; - } - - inline sal_Bool PutValue(const OLEVariant& aVariant) - { - return (SUCCEEDED(pInterface->put_Value(aVariant))); - } + ::rtl::OUString GetName() const ; + DataTypeEnum GetADOType() const ; + sal_Int32 GetAttributes() const ; + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + ParameterDirectionEnum get_Direction() const; + void GetValue(OLEVariant& aValVar) const ; + OLEVariant GetValue() const; + sal_Bool PutValue(const OLEVariant& aVariant); }; } } diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx index af351c6a3e3d..92c4c702685a 100644 --- a/connectivity/source/inc/ado/adoimp.hxx +++ b/connectivity/source/inc/ado/adoimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: adoimp.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,7 +114,7 @@ namespace connectivity static const CLSID CLSID_ADOVIEW_25; static const IID IID_ADOVIEW_25; - static void ThrowException(ADOConnection* _pAdoCon,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + static void ThrowException(ADOConnection* _pAdoCon,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); static DataTypeEnum MapJdbc2ADOType(sal_Int32 _nType); }; @@ -137,10 +137,10 @@ namespace connectivity m_pRecordSet->get_Fields(&pFields); \ WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields); \ if(Name <= 0 || Name > aFields.GetItemCount()) \ - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); \ + ::dbtools::throwInvalidIndexException(*this); \ WpADOField aField(aFields.GetItem(Name-1)); \ if(!aField.IsValid()) \ - throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + ::dbtools::throwInvalidIndexException(*this); #endif //_CONNECTIVITY_ADO_ADOIMP_HXX_ diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx index ea9ea88d5fb1..dd188d344bba 100644 --- a/connectivity/source/inc/file/fcode.hxx +++ b/connectivity/source/inc/file/fcode.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fcode.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-05-07 12:23:42 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,10 +71,6 @@ #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #include "connectivity/CommonTools.hxx" #endif -//#define CONNECTIVITY_PROPERTY_NAME_SPACE file -//#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -//#include "propertyids.hxx" -//#endif #ifndef _RTTI_HXX //autogen #include <tools/rtti.hxx> #endif diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx index 621478d9a2e9..834a47d43ee7 100644 --- a/connectivity/source/inc/odbc/OResultSet.hxx +++ b/connectivity/source/inc/odbc/OResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: OResultSet.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:25 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,7 +139,6 @@ namespace connectivity public ::cppu::OPropertySetHelper, public ::comphelper::OPropertyArrayUsageHelper<OResultSet> { - protected: ::std::vector<void*> m_aBindVector; ::std::vector<sal_Int32> m_aLengthVector; diff --git a/connectivity/source/inc/odbc/OTools.hxx b/connectivity/source/inc/odbc/OTools.hxx index dc10cea03fef..8698c30220d3 100644 --- a/connectivity/source/inc/odbc/OTools.hxx +++ b/connectivity/source/inc/odbc/OTools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: OTools.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-05-02 12:52:25 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -152,430 +152,56 @@ namespace connectivity static ::com::sun::star::uno::Sequence<sal_Int8> OTools::getBytesValue(SQLHANDLE _aStatementHandle,sal_Int32 columnIndex,SWORD _fSqlType,sal_Bool &_bWasNull, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - }; - - template <class T> void getValue( SQLHANDLE _aStatementHandle, + static void getValue( SQLHANDLE _aStatementHandle, sal_Int32 columnIndex, SQLSMALLINT _nType, sal_Bool &_bWasNull, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, - T& _rValue) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) - { - SQLINTEGER pcbValue; - // T nValue = _rValue; - OTools::ThrowException(N3SQLGetData(_aStatementHandle, - (SQLUSMALLINT)columnIndex, - _nType, - &_rValue, - (SQLINTEGER)sizeof _rValue, - &pcbValue), - _aStatementHandle,SQL_HANDLE_STMT,_xInterface,sal_False); - _bWasNull = pcbValue == SQL_NULL_DATA; - // return nValue; - } + void* _pValue, + SQLINTEGER _rSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - //----------------------------------------------------------------------------- - template < class T > void bindData( SWORD fSqlType, + static void bindData( SWORD fSqlType, sal_Bool _bUseWChar, void *&_pData, SDWORD*& pLen, - const T* _pValue, - rtl_TextEncoding _nTextEncoding) - { - SDWORD nMaxLen = 0; - - switch (fSqlType) - { - case SQL_CHAR: - case SQL_VARCHAR: - if(_bUseWChar) - { - *pLen = SQL_NTS; - *((rtl::OUString*)_pData) = *(::rtl::OUString*)_pValue; - - // Zeiger auf Char* - _pData = (void*)((rtl::OUString*)_pData)->getStr(); - } - else - { - ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding)); - *pLen = SQL_NTS; - memcpy(_pData,aString.getStr(),aString.getLength()); - ((sal_Int8*)_pData)[aString.getLength()] = '\0'; - } break; - - case SQL_BIGINT: - case SQL_DECIMAL: - case SQL_NUMERIC: - if(_bUseWChar) - { - ::rtl::OUString aString = rtl::OUString::valueOf(*(double*)_pValue); - nMaxLen = aString.getLength(); - *pLen = nMaxLen; - *((rtl::OUString*)_pData) = aString; - // Zeiger auf Char* - _pData = (void*)((rtl::OUString*)_pData)->getStr(); - } - else - { - ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue); - nMaxLen = aString.getLength(); - *pLen = nMaxLen; - memcpy(_pData,aString.getStr(),aString.getLength()); - ((sal_Int8*)_pData)[aString.getLength()] = '\0'; - } break; - case SQL_BIT: - *((sal_Int8*)_pData) = *(sal_Int8*)_pValue; - *pLen = sizeof(sal_Int8); - break; - case SQL_TINYINT: - case SQL_SMALLINT: - *((sal_Int16*)_pData) = *(sal_Int16*)_pValue; - *pLen = sizeof(sal_Int16); - break; - case SQL_INTEGER: - *((sal_Int32*)_pData) = *(sal_Int32*)_pValue; - *pLen = sizeof(sal_Int32); - break; - case SQL_REAL: - *((float*)_pData) = *(float*)_pValue; - *pLen = sizeof(float); - break; - case SQL_DOUBLE: - *((double*)_pData) = *(double*)_pValue; - *pLen = sizeof(double); - break; - case SQL_BINARY: - case SQL_VARBINARY: - _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); - *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); - break; - case SQL_LONGVARBINARY: - { - sal_Int32 nLen = 0; - nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); - *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); - } - break; - case SQL_LONGVARCHAR: - { - _pData = 0;//(void*)&rCol; - sal_Int32 nLen = 0; - if(_bUseWChar) - nLen = sizeof(sal_Unicode) * ((::rtl::OUString*)_pValue)->getLength(); - else - { - ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding)); - nLen = aString.getLength(); - } - *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); - } break; - case SQL_DATE: - *(DATE_STRUCT*)_pData = *(DATE_STRUCT*)_pValue; - *pLen = (SDWORD)sizeof(DATE_STRUCT); - break; - case SQL_TIME: - *(TIME_STRUCT*)_pData = *(TIME_STRUCT*)_pValue; - *pLen = (SDWORD)sizeof(TIME_STRUCT); - break; - case SQL_TIMESTAMP: - *(TIMESTAMP_STRUCT*)_pData = *(TIMESTAMP_STRUCT*)_pValue; - *pLen = (SDWORD)sizeof(TIMESTAMP_STRUCT); - break; - } - } - - //----------------------------------------------------------------------------- - template < class T > void bindParameter(SQLHANDLE _hStmt, - sal_Int32 nPos, - sal_Int8* pDataBuffer, - sal_Int8* pLenBuffer, - SQLSMALLINT _nJDBCtype, - sal_Bool _bUseWChar, - sal_Bool _bUseOldTimeDate, - const T* _pValue, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, - rtl_TextEncoding _nTextEncoding) - throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) - { - SQLRETURN nRetcode; - SWORD fSqlType; - SWORD fCType; - SDWORD nMaxLen = 0; - void* pData = pDataBuffer; - SDWORD* pLen = (SDWORD*)pLenBuffer; - SQLUINTEGER nColumnSize=0; - SQLSMALLINT nDecimalDigits=0; - SQLSMALLINT nNullable=0; - - OTools::getBindTypes(_bUseWChar,_bUseOldTimeDate,_nJDBCtype,fSqlType,fCType,nColumnSize,nDecimalDigits); - - bindData< T >(fSqlType,_bUseWChar,pData,pLen,_pValue,_nTextEncoding); - if(fSqlType == SQL_LONGVARCHAR || fSqlType == SQL_LONGVARBINARY) - memcpy(pData,&nPos,sizeof(nPos)); - - nRetcode = N3SQLDescribeParam(_hStmt,(SQLUSMALLINT)nPos,&fSqlType,&nColumnSize,&nDecimalDigits,&nNullable); - - nRetcode = N3SQLBindParameter(_hStmt, - (SQLUSMALLINT)nPos, - SQL_PARAM_INPUT, - fCType, - fSqlType, - nColumnSize, - nDecimalDigits, - pData, - nMaxLen, - pLen); - - OTools::ThrowException(nRetcode,_hStmt,SQL_HANDLE_STMT,_xInterface); - } - - - template <class T> void bindValue( SQLHANDLE _aStatementHandle, + const void* _pValue, + rtl_TextEncoding _nTextEncoding); + + static void bindParameter(SQLHANDLE _hStmt, + sal_Int32 nPos, + sal_Int8* pDataBuffer, + sal_Int8* pLenBuffer, + SQLSMALLINT _nJDBCtype, + sal_Bool _bUseWChar, + sal_Bool _bUseOldTimeDate, + const void* _pValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + rtl_TextEncoding _nTextEncoding) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + static void bindValue( SQLHANDLE _aStatementHandle, sal_Int32 columnIndex, SQLSMALLINT _nType, SQLSMALLINT _nMaxLen, SQLSMALLINT _nScale, - const T* _pValue, + const void* _pValue, void* _pData, SQLINTEGER *pLen, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, - rtl_TextEncoding _nTextEncoding) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) - { - SQLRETURN nRetcode; - SWORD fSqlType; - SWORD fCType; - - switch(_nType) - { - case SQL_CHAR: //if(GetODBCConnection()->m_bUserWChar) - // { - // fCType = SQL_C_WCHAR; - // fSqlType = SQL_WCHAR; - // } - // else - { - fCType = SQL_C_CHAR; - fSqlType = SQL_CHAR; - } - break; - case SQL_VARCHAR: //if(GetODBCConnection()->m_bUserWChar) - // { - // fCType = SQL_C_WCHAR; - // fSqlType = SQL_WVARCHAR; - // } - // else - { - fCType = SQL_C_CHAR; - fSqlType = SQL_VARCHAR; - } - break; - case SQL_LONGVARCHAR: //if(GetODBCConnection()->m_bUserWChar) - // { - // fCType = SQL_C_WCHAR; - // fSqlType = SQL_WLONGVARCHAR; - // } - // else - { - fCType = SQL_C_CHAR; - fSqlType = SQL_LONGVARCHAR; - } - break; - case SQL_DECIMAL: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; - fSqlType = SQL_DECIMAL; break; - case SQL_NUMERIC: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; - fSqlType = SQL_NUMERIC; break; - case SQL_BIT: fCType = SQL_C_TINYINT; - fSqlType = SQL_INTEGER; break; - case SQL_TINYINT: fCType = SQL_C_SHORT; - fSqlType = SQL_TINYINT; break; - case SQL_SMALLINT: fCType = SQL_C_SHORT; - fSqlType = SQL_SMALLINT; break; - case SQL_INTEGER: fCType = SQL_C_LONG; - fSqlType = SQL_INTEGER; break; - case SQL_BIGINT: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; - fSqlType = SQL_BIGINT; break; - case SQL_REAL: fCType = SQL_C_FLOAT; - fSqlType = SQL_REAL; break; - case SQL_DOUBLE: fCType = SQL_C_DOUBLE; - fSqlType = SQL_DOUBLE; break; - case SQL_BINARY: fCType = SQL_C_BINARY; - fSqlType = SQL_BINARY; break; - case SQL_VARBINARY: - fCType = SQL_C_BINARY; - fSqlType = SQL_VARBINARY; break; - case SQL_LONGVARBINARY: fCType = SQL_C_BINARY; - fSqlType = SQL_LONGVARBINARY; break; - case SQL_DATE: - // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) - { - fCType = SQL_C_DATE; - fSqlType = SQL_DATE; - } - // else - // { - // fCType = SQL_C_TYPE_DATE; - // fSqlType = SQL_TYPE_DATE; - // } - break; - case SQL_TIME: - // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) - { - fCType = SQL_C_TIME; - fSqlType = SQL_TIME; - } - // else - // { - // fCType = SQL_C_TYPE_TIME; - // fSqlType = SQL_TYPE_TIME; - // } - break; - case SQL_TIMESTAMP: - // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) - { - fCType = SQL_C_TIMESTAMP; - fSqlType = SQL_TIMESTAMP; - } - // else - // { - // fCType = SQL_C_TYPE_TIMESTAMP; - // fSqlType = SQL_TYPE_TIMESTAMP; - // } - break; - default: fCType = SQL_C_BINARY; - fSqlType = SQL_LONGVARBINARY; break; - } - - if (columnIndex != 0 && !_pValue) - { - *pLen = SQL_NULL_DATA; - nRetcode = N3SQLBindCol(_aStatementHandle, - columnIndex, - fCType, - _pData, - _nMaxLen, - pLen - ); - } - else - { - try - { - switch (_nType) - { - case SQL_CHAR: - case SQL_VARCHAR: - //if(GetODBCConnection()->m_bUserWChar) - // { - // _nMaxLen = rCol.GetPrecision(); - // *pLen = SQL_NTS; - // *((rtl::OUString*)pData) = (rtl::OUString)_aValue; - // - // // Zeiger auf Char* - // pData = (void*)((rtl::OUString*)pData)->getStr(); - // } - // else - { - ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding)); - *pLen = SQL_NTS; - *((::rtl::OString*)_pData) = aString; - _nMaxLen = aString.getLength(); - - // Zeiger auf Char* - _pData = (void*)aString.getStr(); - } break; - case SQL_BIGINT: - case SQL_DECIMAL: - case SQL_NUMERIC: - //if(GetODBCConnection()->m_bUserWChar) - // { - // rtl::OUString aString(rtl::OUString(SdbTools::ToString(ODbTypeConversion::toDouble(*pVariable),rCol.GetScale()))); - // *pLen = _nMaxLen; - // *((rtl::OUString*)_pData) = aString; - // // Zeiger auf Char* - // _pData = (void*)((rtl::OUString*)_pData)->getStr(); - // } - // else - { - ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue); - _nMaxLen = aString.getLength(); - *pLen = _nMaxLen; - *((::rtl::OString*)_pData) = aString; - // Zeiger auf Char* - _pData = (void*)((::rtl::OString*)_pData)->getStr(); - } break; - case SQL_BIT: - *((sal_Int8*)_pData) = *(sal_Int8*)_pValue; - *pLen = sizeof(sal_Int8); - break; - case SQL_TINYINT: - case SQL_SMALLINT: - *((sal_Int16*)_pData) = *(sal_Int16*)_pValue; - *pLen = sizeof(sal_Int16); - break; - case SQL_INTEGER: - *((sal_Int32*)_pData) = *(sal_Int32*)_pValue; - *pLen = sizeof(sal_Int32); - break; - case SQL_REAL: - *((float*)_pData) = *(float*)_pValue; - *pLen = sizeof(float); - break; - case SQL_DOUBLE: - *((double*)_pData) = *(double*)_pValue; - *pLen = sizeof(double); - break; - case SQL_BINARY: - case SQL_VARBINARY: - // if (_pValue == ::getCppuType((const ::com::sun::star::uno::Sequence< sal_Int8 > *)0)) - { - _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); - *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); - } break; - case SQL_LONGVARBINARY: - { - sal_Int32 nLen = 0; - nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); - *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); - } - break; - case SQL_LONGVARCHAR: - { - sal_Int32 nLen = 0; - nLen = ((::rtl::OUString*)_pValue)->getLength(); - *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); - } break; - case SQL_DATE: - *pLen = sizeof(DATE_STRUCT); - *((DATE_STRUCT*)_pData) = *(DATE_STRUCT*)_pValue; - break; - case SQL_TIME: - *pLen = sizeof(TIME_STRUCT); - *((TIME_STRUCT*)_pData) = *(TIME_STRUCT*)_pValue; - break; - case SQL_TIMESTAMP: - *pLen = sizeof(TIMESTAMP_STRUCT); - *((TIMESTAMP_STRUCT*)_pData) = *(TIMESTAMP_STRUCT*)_pValue; - } - } - catch ( ... ) - { - } -// SQLINTEGER *pLen = &aLen; -// bindData< T >(fSqlType,sal_False,_pData,pLen,_pValue); + rtl_TextEncoding _nTextEncoding) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + template <class T> void getValue( SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _nType, + sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + T& _rValue) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) + { + OTools::getValue(_aStatementHandle,columnIndex,_nType,_bWasNull,_xInterface,&_rValue,sizeof _rValue); + } + //----------------------------------------------------------------------------- - nRetcode = N3SQLBindCol(_aStatementHandle, - columnIndex, - fCType, - _pData, - _nMaxLen, - pLen - ); - } - OTools::ThrowException(nRetcode,_aStatementHandle,SQL_HANDLE_STMT,_xInterface); - } } } #endif // _CONNECTIVITY_OTOOLS_HXX_ diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx index a77ecc6ac1e3..5bb04a2680b4 100644 --- a/connectivity/source/inc/propertyids.hxx +++ b/connectivity/source/inc/propertyids.hxx @@ -2,9 +2,9 @@ * * $RCSfile: propertyids.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-03-30 14:01:49 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,18 +63,28 @@ // this define has to be set to split the names into different dll's or so's // every dll has his own set of property names -#ifndef CONNECTIVITY_PROPERTY_NAME_SPACE -#pragma warning("CONNECTIVITY_PROPERTY_NAME_SPACE not set") -#endif - #ifndef _RTL_USTRING_ #include <rtl/ustring> #endif +#ifndef _MAP_ +#include <map> +#endif -namespace connectivity -{ namespace dbtools { + class OPropertyMap + { + ::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap; + + ::rtl::OUString fillValue(sal_Int32 _nIndex); + public: + OPropertyMap() + { + } + ~OPropertyMap(); + ::rtl::OUString getNameByIndex(sal_Int32 _nIndex) const; + }; + extern const sal_Char* getPROPERTY_QUERYTIMEOUT(); extern const sal_Char* getPROPERTY_MAXFIELDSIZE(); extern const sal_Char* getPROPERTY_MAXROWS(); @@ -129,7 +139,6 @@ namespace dbtools extern const sal_Char* getSQLSTATE_GENERAL(); extern const sal_Char* getSTR_DELIMITER(); } -} namespace connectivity { @@ -149,61 +158,61 @@ namespace connectivity UStringDescription(); }; -#define DECLARE_CONSTASCII_USTRING(name,nsp) \ - extern connectivity::nsp::UStringDescription name; - - DECLARE_CONSTASCII_USTRING(PROPERTY_CURSORNAME,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSETCONCURRENCY,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSETTYPE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHDIRECTION,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHSIZE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_QUERYTIMEOUT,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_MAXFIELDSIZE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_MAXROWS,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ESCAPEPROCESSING,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_USEBOOKMARKS,CONNECTIVITY_PROPERTY_NAME_SPACE) - - DECLARE_CONSTASCII_USTRING(PROPERTY_NAME,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_TYPE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_TYPENAME,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_PRECISION,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_SCALE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISNULLABLE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISAUTOINCREMENT,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISROWVERSION,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_DESCRIPTION,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTVALUE,CONNECTIVITY_PROPERTY_NAME_SPACE) - - DECLARE_CONSTASCII_USTRING(PROPERTY_REFERENCEDTABLE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_UPDATERULE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_DELETERULE,CONNECTIVITY_PROPERTY_NAME_SPACE) - - DECLARE_CONSTASCII_USTRING(PROPERTY_CATALOG,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISUNIQUE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISPRIMARYKEYINDEX,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISCLUSTERED,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISASCENDING,CONNECTIVITY_PROPERTY_NAME_SPACE) - - DECLARE_CONSTASCII_USTRING(PROPERTY_SCHEMANAME,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_CATALOGNAME,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_COMMAND,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_CHECKOPTION,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_PASSWORD,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_RELATEDCOLUMN,CONNECTIVITY_PROPERTY_NAME_SPACE) - - DECLARE_CONSTASCII_USTRING(PROPERTY_FUNCTION,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_TABLENAME,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_REALNAME,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_DBASEPRECISIONCHANGED,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISCURRENCY,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(PROPERTY_ISBOOKMARKABLE,CONNECTIVITY_PROPERTY_NAME_SPACE) - - // error msg - DECLARE_CONSTASCII_USTRING(STAT_INVALID_INDEX,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(ERRORMSG_SEQUENCE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(SQLSTATE_SEQUENCE,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(SQLSTATE_GENERAL,CONNECTIVITY_PROPERTY_NAME_SPACE) - DECLARE_CONSTASCII_USTRING(STR_DELIMITER,CONNECTIVITY_PROPERTY_NAME_SPACE) +//#define DECLARE_CONSTASCII_USTRING(name,nsp) \ +// extern connectivity::nsp::UStringDescription name; +// +// DECLARE_CONSTASCII_USTRING(PROPERTY_CURSORNAME,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSETCONCURRENCY,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSETTYPE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHDIRECTION,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHSIZE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_QUERYTIMEOUT,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_MAXFIELDSIZE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_MAXROWS,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ESCAPEPROCESSING,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_USEBOOKMARKS,CONNECTIVITY_PROPERTY_NAME_SPACE) +// +// DECLARE_CONSTASCII_USTRING(PROPERTY_NAME,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_TYPE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_TYPENAME,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_PRECISION,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_SCALE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISNULLABLE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISAUTOINCREMENT,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISROWVERSION,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_DESCRIPTION,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTVALUE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// +// DECLARE_CONSTASCII_USTRING(PROPERTY_REFERENCEDTABLE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_UPDATERULE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_DELETERULE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// +// DECLARE_CONSTASCII_USTRING(PROPERTY_CATALOG,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISUNIQUE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISPRIMARYKEYINDEX,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISCLUSTERED,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISASCENDING,CONNECTIVITY_PROPERTY_NAME_SPACE) +// +// DECLARE_CONSTASCII_USTRING(PROPERTY_SCHEMANAME,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_CATALOGNAME,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_COMMAND,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_CHECKOPTION,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_PASSWORD,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_RELATEDCOLUMN,CONNECTIVITY_PROPERTY_NAME_SPACE) +// +// DECLARE_CONSTASCII_USTRING(PROPERTY_FUNCTION,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_TABLENAME,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_REALNAME,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_DBASEPRECISIONCHANGED,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISCURRENCY,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(PROPERTY_ISBOOKMARKABLE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// +// // error msg +// DECLARE_CONSTASCII_USTRING(STAT_INVALID_INDEX,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(ERRORMSG_SEQUENCE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(SQLSTATE_SEQUENCE,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(SQLSTATE_GENERAL,CONNECTIVITY_PROPERTY_NAME_SPACE) +// DECLARE_CONSTASCII_USTRING(STR_DELIMITER,CONNECTIVITY_PROPERTY_NAME_SPACE) } } @@ -211,13 +220,13 @@ namespace connectivity //------------------------------------------------------------------------------ #define DECL_PROP1IMPL(varname, type) \ -pProperties[nPos++] = ::com::sun::star::beans::Property(connectivity::CONNECTIVITY_PROPERTY_NAME_SPACE::PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type*>(NULL)), +pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type*>(NULL)), //------------------------------------------------------------------------------ #define DECL_PROP0(varname, type) \ DECL_PROP1IMPL(varname, type) 0) //------------------------------------------------------------------------------ #define DECL_BOOL_PROP1IMPL(varname) \ - pProperties[nPos++] = ::com::sun::star::beans::Property(connectivity::CONNECTIVITY_PROPERTY_NAME_SPACE::PROPERTY_##varname, PROPERTY_ID_##varname, ::getBooleanCppuType(), + pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getBooleanCppuType(), //------------------------------------------------------------------------------ #define DECL_BOOL_PROP0(varname) \ DECL_BOOL_PROP1IMPL(varname) 0) @@ -268,6 +277,12 @@ pProperties[nPos++] = ::com::sun::star::beans::Property(connectivity::CONNECTIVI #define PROPERTY_ID_ISCURRENCY 39 #define PROPERTY_ID_ISBOOKMARKABLE 40 +#define PROPERTY_ID_INVALID_INDEX 41 +#define PROPERTY_ID_ERRORMSG_SEQUENCE 42 +#define PROPERTY_ID_HY010 43 +#define PROPERTY_ID_HY0000 44 +#define PROPERTY_ID_DELIMITER 45 + #endif // _CONNECTIVITY_PROPERTYIDS_HXX_ diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index b15f1f44d0e8..bef313ec2dab 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PColumn.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:55 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,9 +62,8 @@ #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include "connectivity/PColumn.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif using namespace connectivity; @@ -74,16 +73,16 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; // ------------------------------------------------------------------------- OParseColumn::OParseColumn(const Reference<XPropertySet>& _xColumn,sal_Bool _bCase) - : connectivity::sdbcx::OColumn( getString(_xColumn->getPropertyValue(PROPERTY_NAME)) - , getString(_xColumn->getPropertyValue(PROPERTY_TYPENAME)) - , getString(_xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)) - , getINT32(_xColumn->getPropertyValue(PROPERTY_ISNULLABLE)) - , getINT32(_xColumn->getPropertyValue(PROPERTY_PRECISION)) - , getINT32(_xColumn->getPropertyValue(PROPERTY_SCALE)) - , getINT32(_xColumn->getPropertyValue(PROPERTY_TYPE)) - , getBOOL(_xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)) + : connectivity::sdbcx::OColumn( getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) + , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) + , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) + , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) + , getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))) , sal_False - , getBOOL(_xColumn->getPropertyValue(PROPERTY_ISCURRENCY)) + , getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))) , _bCase ) , m_bFunction(sal_False) @@ -127,10 +126,10 @@ void OParseColumn::construct() { sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_FUNCTION, PROPERTY_ID_FUNCTION, nAttrib,&m_bFunction, ::getCppuType(reinterpret_cast< sal_Bool*>(NULL))); - registerProperty(PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, nAttrib,&m_aTableName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_REALNAME, PROPERTY_ID_REALNAME, nAttrib,&m_aRealName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_DBASEPRECISIONCHANGED, PROPERTY_ID_DBASEPRECISIONCHANGED, nAttrib,&m_bDbasePrecisionChanged, ::getCppuType(reinterpret_cast<sal_Bool*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION), PROPERTY_ID_FUNCTION, nAttrib,&m_bFunction, ::getCppuType(reinterpret_cast< sal_Bool*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME), PROPERTY_ID_TABLENAME, nAttrib,&m_aTableName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME), PROPERTY_ID_REALNAME, nAttrib,&m_aRealName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DBASEPRECISIONCHANGED), PROPERTY_ID_DBASEPRECISIONCHANGED, nAttrib,&m_bDbasePrecisionChanged, ::getCppuType(reinterpret_cast<sal_Bool*>(NULL))); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 95a20e492b0a..263058fbe562 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sqliterator.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: oj $ $Date: 2001-05-07 10:37:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:37:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,16 +84,14 @@ #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include "connectivity/PColumn.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include "connectivity/dbtools.hxx" #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif using namespace ::connectivity; -using namespace ::connectivity::dbtools; using namespace ::dbtools; using namespace ::connectivity::parse; using namespace ::com::sun::star::uno; @@ -1198,14 +1196,14 @@ void OSQLParseTreeIterator::appendColumns(const ::rtl::OUString& _rTableAlias,co if(xColumns->hasByName(*pBegin) && (xColumns->getByName(*pBegin) >>= xColumn) && xColumn.is()) { OParseColumn* pColumn = new OParseColumn(aName - , getString(xColumn->getPropertyValue(PROPERTY_TYPENAME)) - , getString(xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)) - , getINT32(xColumn->getPropertyValue(PROPERTY_ISNULLABLE)) - , getINT32(xColumn->getPropertyValue(PROPERTY_PRECISION)) - , getINT32(xColumn->getPropertyValue(PROPERTY_SCALE)) - , getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)) - , getBOOL(xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)) - , getBOOL(xColumn->getPropertyValue(PROPERTY_ISCURRENCY)) + , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) + , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) + , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) + , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) + , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) + , getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))) + , getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))) , m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); pColumn->setTableName(_rTableAlias); diff --git a/connectivity/source/sdbcx/VCatalog.cxx b/connectivity/source/sdbcx/VCatalog.cxx index 86904c1649d9..dca34fae78c2 100644 --- a/connectivity/source/sdbcx/VCatalog.cxx +++ b/connectivity/source/sdbcx/VCatalog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VCatalog.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,18 +68,17 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include "connectivity/sdbcx/VCollection.hxx" #endif #ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ #include "connectivity/sdbcx/VDescriptor.hxx" #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif -using namespace connectivity::dbtools; +using namespace connectivity; using namespace connectivity::sdbcx; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -139,8 +138,8 @@ void SAL_CALL OCatalog::disposing() Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OCatalog_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OCatalog_BASE::rBHelper.bDisposed); + return const_cast<OCatalog*>(this)->m_pTables; } @@ -149,8 +148,8 @@ Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException Reference< XNameAccess > SAL_CALL OCatalog::getViews( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OCatalog_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OCatalog_BASE::rBHelper.bDisposed); + return const_cast<OCatalog*>(this)->m_pViews; } @@ -159,8 +158,8 @@ Reference< XNameAccess > SAL_CALL OCatalog::getViews( ) throw(RuntimeException) Reference< XNameAccess > SAL_CALL OCatalog::getUsers( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OCatalog_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OCatalog_BASE::rBHelper.bDisposed); + return const_cast<OCatalog*>(this)->m_pUsers; } @@ -169,8 +168,8 @@ Reference< XNameAccess > SAL_CALL OCatalog::getUsers( ) throw(RuntimeException) Reference< XNameAccess > SAL_CALL OCatalog::getGroups( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OCatalog_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OCatalog_BASE::rBHelper.bDisposed); + return const_cast<OCatalog*>(this)->m_pGroups; } @@ -178,7 +177,7 @@ Reference< XNameAccess > SAL_CALL OCatalog::getGroups( ) throw(RuntimeException void ODescriptor::construct() { sal_Int32 nAttrib = isNew() ? 0 : ::com::sun::star::beans::PropertyAttribute::READONLY; - registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME ,nAttrib,&m_Name,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME), PROPERTY_ID_NAME ,nAttrib,&m_Name,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ------------------------------------------------------------------------- ODescriptor::~ODescriptor() diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx index 55ce8341dac6..f32084b14a0c 100644 --- a/connectivity/source/sdbcx/VCollection.cxx +++ b/connectivity/source/sdbcx/VCollection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VCollection.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: oj $ $Date: 2001-05-04 09:58:45 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,9 +75,8 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif using namespace connectivity::sdbcx; @@ -295,7 +294,7 @@ sal_Int32 SAL_CALL OCollection::findColumn( const ::rtl::OUString& columnName ) { ObjectIter aIter = m_aNameMap.find(columnName); if(aIter == m_aNameMap.end()) - throw SQLException(::rtl::OUString::createFromAscii("Unknown column name!"),*this,connectivity::dbtools::SQLSTATE_GENERAL,1000,makeAny(NoSuchElementException(columnName,*this)) ); + throw SQLException(::rtl::OUString::createFromAscii("Unknown column name!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,makeAny(NoSuchElementException(columnName,*this)) ); return m_aElements.size() - (m_aElements.end() - ::std::find(m_aElements.begin(),m_aElements.end(),aIter)) +1; // because cloumns start at one } diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx index 62a1c1b70dc4..e6af610ef556 100644 --- a/connectivity/source/sdbcx/VColumn.cxx +++ b/connectivity/source/sdbcx/VColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VColumn.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,16 +64,15 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif // ------------------------------------------------------------------------- -using namespace connectivity::dbtools; +using namespace connectivity; using namespace connectivity::sdbcx; using namespace cppu; using namespace connectivity; @@ -207,16 +206,16 @@ void OColumn::construct() sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, nAttrib,&m_TypeName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, nAttrib,&m_Description, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, nAttrib,&m_DefaultValue, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_PRECISION, PROPERTY_ID_PRECISION, nAttrib,&m_Precision, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_TYPE, PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_SCALE, PROPERTY_ID_SCALE, nAttrib,&m_Scale, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, nAttrib,&m_IsNullable, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, nAttrib,&m_IsAutoIncrement, ::getBooleanCppuType()); - registerProperty(PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, nAttrib,&m_IsRowVersion, ::getBooleanCppuType()); - registerProperty(PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, nAttrib,&m_IsCurrency, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME), PROPERTY_ID_TYPENAME, nAttrib,&m_TypeName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION), PROPERTY_ID_DESCRIPTION, nAttrib,&m_Description, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE), PROPERTY_ID_DEFAULTVALUE, nAttrib,&m_DefaultValue, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION), PROPERTY_ID_PRECISION, nAttrib,&m_Precision, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE), PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE), PROPERTY_ID_SCALE, nAttrib,&m_Scale, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE), PROPERTY_ID_ISNULLABLE, nAttrib,&m_IsNullable, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT), PROPERTY_ID_ISAUTOINCREMENT, nAttrib,&m_IsAutoIncrement, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISROWVERSION), PROPERTY_ID_ISROWVERSION, nAttrib,&m_IsRowVersion, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY), PROPERTY_ID_ISCURRENCY, nAttrib,&m_IsCurrency, ::getBooleanCppuType()); } // ------------------------------------------------------------------------- void OColumn::disposing(void) @@ -224,15 +223,15 @@ void OColumn::disposing(void) OPropertySetHelper::disposing(); ::osl::MutexGuard aGuard(m_aMutex); - if (OColumnDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed); + } // ------------------------------------------------------------------------- Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OColumnDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed); + OColumn* pNewColumn = new OColumn( m_Name, m_TypeName, diff --git a/connectivity/source/sdbcx/VGroup.cxx b/connectivity/source/sdbcx/VGroup.cxx index beb0637276b9..46143cf57e78 100644 --- a/connectivity/source/sdbcx/VGroup.cxx +++ b/connectivity/source/sdbcx/VGroup.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VGroup.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,17 +74,12 @@ #ifndef _COM_SUN_STAR_SDBCX_PRIVILEGEOBJECT_HPP_ #include <com/sun/star/sdbcx/PrivilegeObject.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif // ------------------------------------------------------------------------- -using namespace connectivity::dbtools; using namespace connectivity::sdbcx; using namespace connectivity; using namespace ::com::sun::star::sdbc; @@ -151,8 +146,8 @@ void OGroup::disposing(void) Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OGroup_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OGroup_BASE::rBHelper.bDisposed); + return const_cast<OGroup*>(this)->m_pUsers; } @@ -161,8 +156,8 @@ Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException) sal_Int32 SAL_CALL OGroup::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OGroup_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OGroup_BASE::rBHelper.bDisposed); + return 0; } @@ -170,8 +165,8 @@ sal_Int32 SAL_CALL OGroup::getPrivileges( const ::rtl::OUString& objName, sal_In sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OGroup_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OGroup_BASE::rBHelper.bDisposed); + return 0; } @@ -179,15 +174,15 @@ sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const ::rtl::OUString& objNam void SAL_CALL OGroup::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OGroup_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OGroup_BASE::rBHelper.bDisposed); + } // ------------------------------------------------------------------------- void SAL_CALL OGroup::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OGroup_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OGroup_BASE::rBHelper.bDisposed); + } // ----------------------------------------------------------------------------- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) diff --git a/connectivity/source/sdbcx/VIndex.cxx b/connectivity/source/sdbcx/VIndex.cxx index 23e12c5554d0..a9e64fd60730 100644 --- a/connectivity/source/sdbcx/VIndex.cxx +++ b/connectivity/source/sdbcx/VIndex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VIndex.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,10 +65,6 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include "connectivity/sdbcx/VColumn.hxx" #endif @@ -78,8 +74,11 @@ #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include "connectivity/sdbcx/VCollection.hxx" #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif // ------------------------------------------------------------------------- -using namespace connectivity::dbtools; +using namespace connectivity; using namespace connectivity; using namespace connectivity::sdbcx; using namespace cppu; @@ -189,10 +188,10 @@ void OIndex::construct() sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_CATALOG, PROPERTY_ID_CATALOG, nAttrib,&m_Catalog, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_ISUNIQUE, PROPERTY_ID_ISUNIQUE, nAttrib,&m_IsUnique, ::getBooleanCppuType()); - registerProperty(PROPERTY_ISPRIMARYKEYINDEX,PROPERTY_ID_ISPRIMARYKEYINDEX, nAttrib,&m_IsPrimaryKeyIndex, ::getBooleanCppuType()); - registerProperty(PROPERTY_ISCLUSTERED, PROPERTY_ID_ISCLUSTERED, nAttrib,&m_IsClustered, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOG), PROPERTY_ID_CATALOG, nAttrib,&m_Catalog, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE), PROPERTY_ID_ISUNIQUE, nAttrib,&m_IsUnique, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISPRIMARYKEYINDEX),PROPERTY_ID_ISPRIMARYKEYINDEX, nAttrib,&m_IsPrimaryKeyIndex, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCLUSTERED), PROPERTY_ID_ISCLUSTERED, nAttrib,&m_IsClustered, ::getBooleanCppuType()); } // ------------------------------------------------------------------------- void OIndex::disposing(void) @@ -208,8 +207,8 @@ void OIndex::disposing(void) Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OIndex::getColumns( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (ODescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(ODescriptor_BASE::rBHelper.bDisposed); + if(!m_pColumns) refreshColumns(); @@ -220,8 +219,8 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OIndex::getColumn Reference< XPropertySet > SAL_CALL OIndex::createDataDescriptor( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (ODescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(ODescriptor_BASE::rBHelper.bDisposed); + return this; } diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx index c03de357e10d..8dd43e82297a 100644 --- a/connectivity/source/sdbcx/VIndexColumn.cxx +++ b/connectivity/source/sdbcx/VIndexColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VIndexColumn.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: fs $ $Date: 2001-03-16 16:28:45 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,12 +61,11 @@ #ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ #include "connectivity/sdbcx/VIndexColumn.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif -using namespace connectivity::dbtools; +using namespace connectivity; using namespace connectivity::sdbcx; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -150,7 +149,7 @@ OIndexColumn::OIndexColumn( sal_Bool _IsAscending, void OIndexColumn::construct() { sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_ISASCENDING, PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType()); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx index 99a6e41f89ed..e846a00a1613 100644 --- a/connectivity/source/sdbcx/VKey.cxx +++ b/connectivity/source/sdbcx/VKey.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VKey.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,12 +78,10 @@ #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include "connectivity/sdbcx/VCollection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif // ------------------------------------------------------------------------- -using namespace connectivity::dbtools; using namespace connectivity; using namespace connectivity::sdbcx; using namespace ::com::sun::star::beans; @@ -178,10 +176,10 @@ void OKey::construct() sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_REFERENCEDTABLE, PROPERTY_ID_REFERENCEDTABLE, nAttrib,&m_ReferencedTable, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_TYPE, PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_UPDATERULE, PROPERTY_ID_UPDATERULE, nAttrib,&m_UpdateRule, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_DELETERULE, PROPERTY_ID_DELETERULE, nAttrib,&m_DeleteRule, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE), PROPERTY_ID_REFERENCEDTABLE, nAttrib,&m_ReferencedTable, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE), PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_UPDATERULE), PROPERTY_ID_UPDATERULE, nAttrib,&m_UpdateRule, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE), PROPERTY_ID_DELETERULE, nAttrib,&m_DeleteRule, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); } // ------------------------------------------------------------------------- void OKey::disposing(void) @@ -212,8 +210,8 @@ void OKey::disposing(void) Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OKey::getColumns( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (ODescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(ODescriptor_BASE::rBHelper.bDisposed); + if(!m_pColumns) refreshColumns(); @@ -224,8 +222,8 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OKey::getColumns( Reference< XPropertySet > SAL_CALL OKey::createDataDescriptor( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (ODescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(ODescriptor_BASE::rBHelper.bDisposed); + return this; } diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx index f6978b47630b..ace1e097a977 100644 --- a/connectivity/source/sdbcx/VKeyColumn.cxx +++ b/connectivity/source/sdbcx/VKeyColumn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VKeyColumn.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-03-02 15:26:27 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,12 +62,11 @@ #ifndef _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_ #include "connectivity/sdbcx/VKeyColumn.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif -using namespace connectivity::dbtools; +using namespace connectivity; using namespace connectivity::sdbcx; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -155,7 +154,7 @@ OKeyColumn::~OKeyColumn() void OKeyColumn::construct() { sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_RELATEDCOLUMN, PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/sdbcx/VTable.cxx b/connectivity/source/sdbcx/VTable.cxx index 3524eb9e399f..41a20d0089f6 100644 --- a/connectivity/source/sdbcx/VTable.cxx +++ b/connectivity/source/sdbcx/VTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VTable.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,9 +74,8 @@ #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include "connectivity/sdbcx/VCollection.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include "connectivity/sdbcx/VColumn.hxx" @@ -87,7 +86,6 @@ // ------------------------------------------------------------------------- -using namespace connectivity::dbtools; using namespace connectivity; using namespace connectivity::sdbcx; using namespace ::com::sun::star::beans; @@ -165,10 +163,10 @@ void OTable::construct() sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION,nAttrib,&m_Description, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_TYPE, PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME), PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME), PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION), PROPERTY_ID_DESCRIPTION,nAttrib,&m_Description, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE), PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- void SAL_CALL OTable::acquire() throw(::com::sun::star::uno::RuntimeException) @@ -223,8 +221,8 @@ void SAL_CALL OTable::disposing(void) Reference< XNameAccess > SAL_CALL OTable::getColumns( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OTableDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); + if(!m_pColumns) refreshColumns(); @@ -237,8 +235,8 @@ Reference< XNameAccess > SAL_CALL OTable::getColumns( ) throw(RuntimeException) Reference< XIndexAccess > SAL_CALL OTable::getKeys( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OTableDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); + if(!m_pKeys) refreshKeys(); @@ -262,8 +260,8 @@ cppu::IPropertyArrayHelper & OTable::getInfoHelper() Reference< XPropertySet > SAL_CALL OTable::createDataDescriptor( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OTableDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); + return this; } @@ -272,8 +270,8 @@ Reference< XPropertySet > SAL_CALL OTable::createDataDescriptor( ) throw(Runtim Reference< XNameAccess > SAL_CALL OTable::getIndexes( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OTableDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); + if(!m_pIndexes) refreshIndexes(); @@ -285,8 +283,8 @@ Reference< XNameAccess > SAL_CALL OTable::getIndexes( ) throw(RuntimeException) void SAL_CALL OTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OTableDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); + } // ------------------------------------------------------------------------- @@ -294,16 +292,16 @@ void SAL_CALL OTable::rename( const ::rtl::OUString& newName ) throw(SQLExceptio void SAL_CALL OTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OTableDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); + } // ------------------------------------------------------------------------- void SAL_CALL OTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OTableDescriptor_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); + } // ------------------------------------------------------------------------- diff --git a/connectivity/source/sdbcx/VUser.cxx b/connectivity/source/sdbcx/VUser.cxx index fdb0326b8bf8..8e83142b8784 100644 --- a/connectivity/source/sdbcx/VUser.cxx +++ b/connectivity/source/sdbcx/VUser.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VUser.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,9 +73,8 @@ #ifndef _COM_SUN_STAR_SDBCX_PRIVILEGEOBJECT_HPP_ #include <com/sun/star/sdbcx/PrivilegeObject.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include "connectivity/sdbcx/VCollection.hxx" @@ -85,7 +84,6 @@ #endif // ------------------------------------------------------------------------- -using namespace connectivity::dbtools; using namespace connectivity; using namespace connectivity::sdbcx; using namespace ::com::sun::star::sdbc; @@ -152,18 +150,15 @@ Sequence< Type > SAL_CALL OUser::getTypes( ) throw(RuntimeException) void SAL_CALL OUser::changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OUser_BASE::rBHelper.bDisposed) - throw DisposedException(); - - + checkDisposed(OUser_BASE::rBHelper.bDisposed); } // ------------------------------------------------------------------------- // XGroupsSupplier Reference< XNameAccess > SAL_CALL OUser::getGroups( ) throw(RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OUser_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OUser_BASE::rBHelper.bDisposed); + return const_cast<OUser*>(this)->m_pGroups; } @@ -173,8 +168,8 @@ Reference< XNameAccess > SAL_CALL OUser::getGroups( ) throw(RuntimeException) sal_Int32 SAL_CALL OUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OUser_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OUser_BASE::rBHelper.bDisposed); + return 0; } @@ -182,8 +177,8 @@ sal_Int32 SAL_CALL OUser::getPrivileges( const ::rtl::OUString& objName, sal_Int sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OUser_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OUser_BASE::rBHelper.bDisposed); + return 0; } @@ -191,15 +186,15 @@ sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const ::rtl::OUString& objName void SAL_CALL OUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OUser_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OUser_BASE::rBHelper.bDisposed); + } // ------------------------------------------------------------------------- void SAL_CALL OUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - if (OUser_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OUser_BASE::rBHelper.bDisposed); + } // ----------------------------------------------------------------------------- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OUser::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) diff --git a/connectivity/source/sdbcx/VView.cxx b/connectivity/source/sdbcx/VView.cxx index 5b7bedbbda3f..d63103f02804 100644 --- a/connectivity/source/sdbcx/VView.cxx +++ b/connectivity/source/sdbcx/VView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VView.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-04-30 09:59:54 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,19 +66,18 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include "connectivity/dbtools.hxx" #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif + // ------------------------------------------------------------------------- using namespace connectivity; -using namespace connectivity::dbtools; using namespace connectivity::sdbcx; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -123,10 +122,10 @@ void OView::construct() sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; - registerProperty(PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, nAttrib,&m_Command, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(PROPERTY_CHECKOPTION, PROPERTY_ID_CHECKOPTION,nAttrib,&m_CheckOption, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME), PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME), PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND), PROPERTY_ID_COMMAND, nAttrib,&m_Command, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CHECKOPTION), PROPERTY_ID_CHECKOPTION,nAttrib,&m_CheckOption, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL))); } // ------------------------------------------------------------------------- void OView::disposing(void) |