diff options
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/CommonTools.cxx | 70 | ||||
-rw-r--r-- | connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx | 59 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools.cxx | 40 | ||||
-rw-r--r-- | connectivity/source/drivers/adabas/BTables.cxx | 62 | ||||
-rw-r--r-- | connectivity/source/drivers/adabas/makefile.mk | 21 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DIndex.cxx | 47 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FConnection.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 115 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcode.cxx | 28 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx | 246 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/OResultSet.cxx | 437 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/OStatement.cxx | 158 | ||||
-rw-r--r-- | connectivity/source/inc/OSubComponent.hxx | 62 | ||||
-rw-r--r-- | connectivity/version.mk | 20 |
14 files changed, 723 insertions, 652 deletions
diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx index 3e8c52b616c5..141cf2a3b7f5 100644 --- a/connectivity/source/commontools/CommonTools.cxx +++ b/connectivity/source/commontools/CommonTools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CommonTools.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: pl $ $Date: 2001-05-11 17:25:49 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:53:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,13 +76,21 @@ #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ +#include <com/sun/star/lang/XComponent.hpp> #endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif inline sal_Unicode rtl_ascii_toUpperCase( sal_Unicode ch ) { @@ -92,6 +100,7 @@ inline sal_Unicode rtl_ascii_toUpperCase( sal_Unicode ch ) namespace connectivity { using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace dbtools; //------------------------------------------------------------------------------ @@ -295,7 +304,7 @@ namespace connectivity const ::rtl::OUString& _rVal, const ::comphelper::UStringMixEqual& _rCase) { - while (__first != __last && !_rCase(getString((*__first)->getPropertyValue(PROPERTY_NAME)),_rVal)) + while (__first != __last && !_rCase(getString((*__first)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),_rVal)) ++__first; return __first; } @@ -305,7 +314,7 @@ namespace connectivity const ::rtl::OUString& _rVal, const ::comphelper::UStringMixEqual& _rCase) { - while (__first != __last && !_rCase(getString((*__first)->getPropertyValue(PROPERTY_REALNAME)),_rVal)) + while (__first != __last && !_rCase(getString((*__first)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME))),_rVal)) ++__first; return __first; } @@ -320,4 +329,51 @@ namespace connectivity ++__first; return __first; } + + void release(oslInterlockedCount& _refCount, + ::cppu::OBroadcastHelper& rBHelper, + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + ::com::sun::star::lang::XComponent* _pObject) + { + if (osl_decrementInterlockedCount( &_refCount ) == 0) + { + osl_incrementInterlockedCount( &_refCount ); + + if (!rBHelper.bDisposed && !rBHelper.bInDispose) + { + // remember the parent + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xParent; + { + ::osl::MutexGuard aGuard( rBHelper.rMutex ); + xParent = _xInterface; + _xInterface = NULL; + } + + // First dispose + _pObject->dispose(); + + // only the alive ref holds the object + OSL_ASSERT( _refCount == 1 ); + + // release the parent in the ~ + if (xParent.is()) + { + ::osl::MutexGuard aGuard( rBHelper.rMutex ); + _xInterface = xParent; + } + +// // destroy the object if xHoldAlive decrement the refcount to 0 +// m_pDerivedImplementation->WEAK::release(); + } + } + else + osl_incrementInterlockedCount( &_refCount ); + } + + void checkDisposed(sal_Bool _bThrow) throw ( DisposedException ) + { + if (_bThrow) + throw DisposedException(); + + } } diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx index 071c35abdbaa..de6787d88e5f 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDatabaseMetaDataResultSet.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: pl $ $Date: 2001-05-11 17:25:49 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:53:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,10 +63,6 @@ #ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ #include "FDatabaseMetaDataResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_DATABASEMETADATARESULTSETMETADATA_HXX_ #include "FDatabaseMetaDataResultSetMetaData.hxx" #endif @@ -109,9 +105,12 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include "connectivity/dbexception.hxx" #endif +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif using namespace connectivity; -using namespace connectivity::dbtools; +using namespace dbtools; using namespace cppu; //------------------------------------------------------------------------------ using namespace ::com::sun::star::beans; @@ -139,10 +138,10 @@ ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSet::construct() { - registerProperty(PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, 0, &m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, 0, &m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); } // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSet::disposing(void) @@ -213,7 +212,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResult return NULL; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return NULL; @@ -229,7 +228,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResult return NULL; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return NULL; @@ -245,7 +244,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex return sal_False; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return (*m_aRowsIter)[columnIndex]; } @@ -260,7 +259,7 @@ sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) t return 0; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return (*m_aRowsIter)[columnIndex]; @@ -276,7 +275,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co return Sequence< sal_Int8 >(); if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; @@ -293,7 +292,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co return ::com::sun::star::util::Date(0,0,0); if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; @@ -310,7 +309,7 @@ double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) t return 0.0; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; @@ -328,7 +327,7 @@ float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) thr return 0.0; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; @@ -346,7 +345,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) t return 0; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; @@ -374,7 +373,7 @@ sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex ) return sal_Int64(); if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; @@ -403,7 +402,7 @@ Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 col return NULL; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return NULL; @@ -420,7 +419,7 @@ Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 colum return NULL; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return NULL; @@ -435,7 +434,7 @@ Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 colum return NULL; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return NULL; @@ -451,7 +450,7 @@ Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 columnI return NULL; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return NULL; @@ -467,7 +466,7 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const return Any(); if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return (*m_aRowsIter)[columnIndex].makeAny(); } @@ -482,7 +481,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) return 0; if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; return (*m_aRowsIter)[columnIndex]; @@ -499,7 +498,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) return ::rtl::OUString(); if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; @@ -519,7 +518,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) return ::com::sun::star::util::Time(0,0,0,0); if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; @@ -539,7 +538,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) return ::com::sun::star::util::DateTime(0,0,0,0,0,0,0); if(columnIndex >= (sal_Int32)(*m_aRowsIter).size() || columnIndex < 1) - throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this); m_nColPos = columnIndex; ; diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 6ed2169f9b61..98b44406597e 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbtools.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: pl $ $Date: 2001-05-11 17:25:49 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:53:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -163,9 +163,8 @@ #ifndef _COM_SUN_STAR_UI_XEXECUTABLEDIALOG_HPP_ #include <com/sun/star/ui/XExecutableDialog.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; @@ -180,7 +179,7 @@ using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::form; -using namespace connectivity::dbtools; +using namespace connectivity; //......................................................................... namespace dbtools @@ -365,7 +364,7 @@ Reference< XConnection > getConnection_allowException( sal_Bool bPwdReq = sal_False; try { - xProp->getPropertyValue(PROPERTY_PASSWORD) >>= sPwd; + xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd; bPwdReq = ::cppu::any2bool(xProp->getPropertyValue(::rtl::OUString::createFromAscii("IsPasswordRequired"))); xProp->getPropertyValue(::rtl::OUString::createFromAscii("User")) >>= sUser; } @@ -458,8 +457,8 @@ Reference< XConnection> calcConnection( if (hasProperty(s_sUserProp, xRowSetProps)) xRowSetProps->getPropertyValue(s_sUserProp) >>= sUser; - if (hasProperty(PROPERTY_PASSWORD, xRowSetProps)) - xRowSetProps->getPropertyValue(PROPERTY_PASSWORD) >>= sPwd; + if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), xRowSetProps)) + xRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd; xReturn = getConnection_allowException(sDataSourceName, sUser, sPwd, _rxFactory); } else if (sURL.getLength()) @@ -472,8 +471,8 @@ Reference< XConnection> calcConnection( ::rtl::OUString sUser, sPwd; if (hasProperty(s_sUserProp, xRowSetProps)) xRowSetProps->getPropertyValue(s_sUserProp) >>= sUser; - if (hasProperty(PROPERTY_PASSWORD, xRowSetProps)) - xRowSetProps->getPropertyValue(PROPERTY_PASSWORD) >>= sPwd; + if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), xRowSetProps)) + xRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd; if (sUser.getLength()) { // use user and pwd together with the url Sequence< PropertyValue> aInfo(2); @@ -975,13 +974,13 @@ Reference< XSQLQueryComposer> getCurrentSettingsComposer( const ::rtl::OUString sPropApplyFilter = ::rtl::OUString::createFromAscii("ApplyFilter"); // first ensure we have all properties needed - if (hasProperty(PROPERTY_COMMAND, _rxRowSetProps) && hasProperty(sPropCommandType, _rxRowSetProps) + if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND), _rxRowSetProps) && hasProperty(sPropCommandType, _rxRowSetProps) && hasProperty(sPropFilter, _rxRowSetProps) && hasProperty(sPropOrder, _rxRowSetProps) - && hasProperty(PROPERTY_ESCAPEPROCESSING, _rxRowSetProps) && hasProperty(sPropApplyFilter, _rxRowSetProps)) + && hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING), _rxRowSetProps) && hasProperty(sPropApplyFilter, _rxRowSetProps)) { sal_Int32 nCommandType = getINT32(_rxRowSetProps->getPropertyValue(sPropCommandType)); - ::rtl::OUString sCommand = getString(_rxRowSetProps->getPropertyValue(PROPERTY_COMMAND)); - sal_Bool bEscapeProcessing = getBOOL(_rxRowSetProps->getPropertyValue(PROPERTY_ESCAPEPROCESSING)); + ::rtl::OUString sCommand = getString(_rxRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))); + sal_Bool bEscapeProcessing = getBOOL(_rxRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING))); switch (nCommandType) { case CommandType::COMMAND: @@ -1021,16 +1020,16 @@ Reference< XSQLQueryComposer> getCurrentSettingsComposer( break; // a native query ? - if (!hasProperty(PROPERTY_ESCAPEPROCESSING, xQueryProps)) + if (!hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING), xQueryProps)) break; - if (!getBOOL(xQueryProps->getPropertyValue(PROPERTY_ESCAPEPROCESSING))) + if (!getBOOL(xQueryProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING)))) break; - if (!hasProperty(PROPERTY_COMMAND, xQueryProps)) + if (!hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND), xQueryProps)) break; // the command used by the query - sStatement = getString(xQueryProps->getPropertyValue(PROPERTY_COMMAND)); + sStatement = getString(xQueryProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))); OSL_ENSURE(sStatement.getLength(),"Statement is empty!"); // use an additional composer to build a statement from the query filter/order props @@ -1262,6 +1261,9 @@ void showError(const SQLExceptionInfo& _rInfo, /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.24 2001/05/11 17:25:49 pl + * rtl string api changes + * * Revision 1.23 2001/04/27 10:09:14 oj * comment out the OSL_ESNURE in QualifiedNameComponents * diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx index db3497f10b1f..756049e742f4 100644 --- a/connectivity/source/drivers/adabas/BTables.cxx +++ b/connectivity/source/drivers/adabas/BTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BTables.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: pl $ $Date: 2001-05-11 18:11:58 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:48:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,10 +86,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 @@ -164,7 +160,7 @@ Reference< XPropertySet > OTables::createEmptyObject() void SAL_CALL OTables::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); @@ -185,10 +181,10 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); Reference< XStatement > xStmt = pConnection->createStatement( ); aSql = ::rtl::OUString::createFromAscii("COMMENT ON TABLE ") - + aQuote + getString(descriptor->getPropertyValue(PROPERTY_SCHEMANAME)) + aQuote + aDot - + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))) + aQuote + aDot + + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + ::rtl::OUString::createFromAscii(" '") - + getString(descriptor->getPropertyValue(PROPERTY_DESCRIPTION)) + + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) + ::rtl::OUString::createFromAscii("'"); xStmt->execute(aSql); @@ -198,8 +194,8 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ Reference< XPropertySet > xColProp; aSql = ::rtl::OUString::createFromAscii("COMMENT ON COLUMN ") - + aQuote + getString(descriptor->getPropertyValue(PROPERTY_SCHEMANAME)) + aQuote + aDot - + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + aDot + + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))) + aQuote + aDot + + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + aDot + aQuote; for(sal_Int32 i=0;i<xColumns->getCount();++i) @@ -207,10 +203,10 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ ::cppu::extractInterface(xColProp,xColumns->getByIndex(i)); if(xColProp.is()) { - ::rtl::OUString aDescription = getString(xColProp->getPropertyValue(PROPERTY_DESCRIPTION)); + ::rtl::OUString aDescription = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))); if(aDescription.getLength()) { - ::rtl::OUString aCom = aSql + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote + ::rtl::OUString aCom = aSql + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + ::rtl::OUString::createFromAscii(" '") + aDescription + ::rtl::OUString::createFromAscii("'"); @@ -250,7 +246,7 @@ void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQ aName = elementName.copy(nLen+1); ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP "); Reference<XPropertySet> xProp(xTunnel,UNO_QUERY); - if(xProp.is() && ::comphelper::getString(xProp->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW")) // here we have a view + if(xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString::createFromAscii("VIEW")) // here we have a view aSql += ::rtl::OUString::createFromAscii("VIEW "); else aSql += ::rtl::OUString::createFromAscii("TABLE "); @@ -279,13 +275,13 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."),sSchema; - 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(static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getUserName().toAsciiUpperCase())); + descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),makeAny(static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getUserName().toAsciiUpperCase())); - 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(" ("); // columns @@ -303,37 +299,37 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) if(::cppu::extractInterface(xColProp,xColumns->getByIndex(i)) && xColProp.is()) { - aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; aSql = aSql + ::rtl::OUString::createFromAscii(" "); - aTypeName = xColProp->getPropertyValue(PROPERTY_TYPENAME); + aTypeName = xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); if(aTypeName.hasValue() && getString(aTypeName).getLength()) aSql = aSql + getString(aTypeName); else aSql = aSql + getTypeString(xColProp) + ::rtl::OUString::createFromAscii(" "); - switch(getINT32(xColProp->getPropertyValue(PROPERTY_TYPE))) + switch(getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { case DataType::CHAR: case DataType::VARCHAR: aSql = aSql + ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) + ::rtl::OUString::createFromAscii(")"); break; case DataType::DECIMAL: case DataType::NUMERIC: aSql = aSql + ::rtl::OUString::createFromAscii("(") - + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) + ::rtl::OUString::createFromAscii(",") - + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))) + ::rtl::OUString::createFromAscii(")"); break; } - ::rtl::OUString aDefault = getString(xColProp->getPropertyValue(PROPERTY_DEFAULTVALUE)); - if(getINT32(xColProp->getPropertyValue(PROPERTY_ISNULLABLE)) == ColumnValue::NO_NULLS) + ::rtl::OUString aDefault = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); + if(getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS) { aSql = aSql + ::rtl::OUString::createFromAscii(" NOT NULL"); if(aDefault.getLength()) @@ -359,7 +355,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) if(::cppu::extractInterface(xColProp,xKeys->getByIndex(i)) && xColProp.is()) { - sal_Int32 nKeyType = getINT32(xColProp->getPropertyValue(PROPERTY_TYPE)); + sal_Int32 nKeyType = getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); if(nKeyType == KeyType::PRIMARY) { @@ -376,7 +372,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) for(sal_Int32 i=0;i<xColumns->getCount();++i) { if(::cppu::extractInterface(xColProp,xColumns->getByIndex(i)) && xColProp.is()) - 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(","); } @@ -393,7 +389,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) for(sal_Int32 i=0;i<xColumns->getCount();++i) { if(::cppu::extractInterface(xColProp,xColumns->getByIndex(i)) && xColProp.is()) - 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(","); } @@ -401,7 +397,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) } else if(nKeyType == KeyType::FOREIGN) { - sal_Int32 nDeleteRule = getINT32(xColProp->getPropertyValue(PROPERTY_DELETERULE)); + sal_Int32 nDeleteRule = getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE))); xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY); xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY); @@ -409,7 +405,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) throw SQLException(); aSql = aSql + ::rtl::OUString::createFromAscii(" FOREIGN KEY "); - ::rtl::OUString aName,aSchema,aRefTable = getString(xColProp->getPropertyValue(PROPERTY_REFERENCEDTABLE)); + ::rtl::OUString aName,aSchema,aRefTable = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE))); sal_Int32 nLen = aRefTable.indexOf('.'); aSchema = aRefTable.copy(0,nLen); aName = aRefTable.copy(nLen+1); @@ -421,7 +417,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) for(sal_Int32 i=0;i<xColumns->getCount();++i) { if(::cppu::extractInterface(xColProp,xColumns->getByIndex(i)) && xColProp.is()) - 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(","); } @@ -458,7 +454,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) Reference< XStatement > xStmt = pConnection->createStatement( ); xStmt->execute(aSql); - if(getString(descriptor->getPropertyValue(PROPERTY_DESCRIPTION)).getLength()) + if(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))).getLength()) setComments(descriptor); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/makefile.mk b/connectivity/source/drivers/adabas/makefile.mk index cedc68b8a1ba..0d54d9766c43 100644 --- a/connectivity/source/drivers/adabas/makefile.mk +++ b/connectivity/source/drivers/adabas/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.16 $ +# $Revision: 1.17 $ # -# last change: $Author: rt $ $Date: 2001-05-09 08:21:05 $ +# last change: $Author: oj $ $Date: 2001-05-14 11:48:18 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -100,17 +100,7 @@ SLOFILES=\ $(SLO)$/BDatabaseMetaData.obj \ $(SLO)$/BPreparedStatement.obj \ $(SLO)$/BStatement.obj \ - $(SLO)$/BResultSet.obj \ - $(SLO)$/OPreparedStatement.obj \ - $(SLO)$/OStatement.obj \ - $(SLO)$/OResultSetMetaData.obj \ - $(SLO)$/OResultSet.obj \ - $(SLO)$/OTools.obj \ - $(SLO)$/ODatabaseMetaData.obj \ - $(SLO)$/ODatabaseMetaDataResultSet.obj \ - $(SLO)$/ODriver.obj \ - $(SLO)$/OFunctions.obj \ - $(SLO)$/OConnection.obj + $(SLO)$/BResultSet.obj .IF "$(OS)"=="MACOSX" #SHL1VERSIONMAP=$(ADABAS_TARGET).$(DLLPOSTFIX).map @@ -129,9 +119,12 @@ SHL1STDLIBS=\ $(OSLLIB) \ $(SALLIB) \ $(DBTOOLSLIB) \ + $(ODBCBASELIB) \ $(COMPHELPERLIB) -#SHL1LIBS+= $(SLB)$/odbc.lib +.IF "$(ODBCBASELIB)" == "" +SHL1STDLIBS+= iodbcbase.lib +.ENDIF SHL1DEPN= SHL1IMPLIB= i$(SHL1TARGET) diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 036940588246..0f6828473512 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DIndex.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: rt $ $Date: 2001-05-11 09:18:49 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:50:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,10 +68,6 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE dbase -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include "connectivity/sdbcx/VColumn.hxx" #endif @@ -126,17 +122,6 @@ #ifndef _CONNECTIVITY_DBASE_DRESULTSET_HXX_ #include "dbase/DResultSet.hxx" #endif -// define the properties of this lib -// this file includes the properties for this dll -namespace connectivity -{ - namespace dbase - { -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" -#endif - } -} // ------------------------------------------------------------------------- using namespace connectivity; using namespace ucb; @@ -257,7 +242,7 @@ sal_Bool ODbaseIndex::openIndexFile() { ::rtl::OUString sErrMsg = ::rtl::OUString::createFromAscii("Could not open index: "); sErrMsg += sFile; - throw SQLException(sErrMsg,*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(sErrMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } } @@ -477,7 +462,7 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rInd ::rtl::OUString ODbaseIndex::getCompletePath() { ::rtl::OUString sDir = m_pTable->getConnection()->getURL(); - sDir += STR_DELIMITER; + sDir += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sDir += m_Name; sDir += ::rtl::OUString::createFromAscii(".ndx"); return sDir; @@ -490,7 +475,7 @@ void ODbaseIndex::createINFEntry() sEntry += String::CreateFromAscii(".ndx"); ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL()); - sCfgFile += STR_DELIMITER; + sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sCfgFile += m_pTable->getName(); sCfgFile += ::rtl::OUString::createFromAscii(".inf"); @@ -528,13 +513,13 @@ BOOL ODbaseIndex::DropImpl() if(UCBContentHelper::Exists(sPath)) { if(!UCBContentHelper::Kill(sPath)) - throw SQLException(::rtl::OUString::createFromAscii("Could not delete index!"),*m_pTable,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not delete index!"),*m_pTable,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } // InfDatei abgleichen ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL()); - sCfgFile += STR_DELIMITER; + sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER);; sCfgFile += m_pTable->getName(); sCfgFile += ::rtl::OUString::createFromAscii(".inf"); @@ -573,11 +558,11 @@ BOOL ODbaseIndex::CreateImpl() // Anlegen des Index ::rtl::OUString sFile = getCompletePath(); if(UCBContentHelper::Exists(sFile)) - throw SQLException(::rtl::OUString::createFromAscii("Object already exists!"),*this,SQLSTATE_SEQUENCE,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Object already exists!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); // Index ist nur einstufig if (m_pColumns->getCount() > 1) - throw SQLException(::rtl::OUString::createFromAscii("Not capable! Only one column per index."),*this,SQLSTATE_SEQUENCE,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Not capable! Only one column per index."),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); Reference<XFastPropertySet> xCol; ::cppu::extractInterface(xCol,m_pColumns->getByIndex(0)); @@ -599,7 +584,7 @@ BOOL ODbaseIndex::CreateImpl() // create the index file m_pFileStream = UcbStreamHelper::CreateStream(sFile,STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC); if (!m_pFileStream) - throw SQLException(::rtl::OUString::createFromAscii("Could not access index file!"),*this,SQLSTATE_SEQUENCE,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not access index file!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); m_pFileStream->SetBufferSize(512); @@ -646,7 +631,7 @@ BOOL ODbaseIndex::CreateImpl() closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,SQLSTATE_SEQUENCE,1000,makeAny(e)); + throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,makeAny(e)); } if (!xSet.is()) { @@ -654,7 +639,7 @@ BOOL ODbaseIndex::CreateImpl() closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,SQLSTATE_SEQUENCE,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); } // Setzen der Headerinfo @@ -666,10 +651,10 @@ BOOL ODbaseIndex::CreateImpl() Reference< XPropertySet > xTableCol(*find(aCols->begin(),aCols->end(),aName,::comphelper::UStringMixEqual(isCaseSensitive()))); - xTableCol->getPropertyValue(PROPERTY_TYPE) >>= nType; + xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType; m_aHeader.db_keytype = (nType == DataType::VARCHAR || nType == DataType::CHAR) ? 0 : 1; - m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (USHORT)getINT32(xTableCol->getPropertyValue(PROPERTY_PRECISION)); + m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (USHORT)getINT32(xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); m_aHeader.db_maxkeys = (512 - 8) / (8 + m_aHeader.db_keylen); ByteString aCol(aName,m_pTable->getConnection()->getTextEncoding()); @@ -723,7 +708,7 @@ BOOL ODbaseIndex::CreateImpl() closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - throw SQLException(::rtl::OUString::createFromAscii("Can not create index values are not unique!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Can not create index values are not unique!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } } aInsertKey.setValue(aValue); @@ -743,7 +728,7 @@ BOOL ODbaseIndex::CreateImpl() closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,SQLSTATE_SEQUENCE,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); } Release(); createINFEntry(); diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 2644654be0fb..1369898e8adc 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FConnection.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: pl $ $Date: 2001-05-11 18:45:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:51:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,10 +119,12 @@ #ifndef _OSL_THREAD_H_ #include <osl/thread.h> #endif +#ifndef _CONNECTIVITY_MODULECONTEXT_HXX_ +#include "ModuleContext.hxx" +#endif using namespace connectivity::file; -using namespace connectivity::dbtools; - +using namespace dbtools; //------------------------------------------------------------------------------ using namespace com::sun::star::uno; using namespace com::sun::star::lang; diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index a0372433e977..beefbc2c475e 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSet.cxx,v $ * - * $Revision: 1.52 $ + * $Revision: 1.53 $ * - * last change: $Author: pl $ $Date: 2001-05-11 18:45:41 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:51:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -69,10 +69,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 _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ #include "file/FResultSetMetaData.hxx" #endif @@ -139,6 +135,7 @@ using namespace connectivity; using namespace connectivity::file; using namespace cppu; +using namespace dbtools; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -205,10 +202,10 @@ OResultSet::~OResultSet() // ------------------------------------------------------------------------- void OResultSet::construct() { - registerProperty(PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY,PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY,PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); } // ------------------------------------------------------------------------- void OResultSet::disposing(void) @@ -291,7 +288,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinarySt throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return NULL; } @@ -303,7 +300,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacte throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return NULL; } @@ -316,7 +313,7 @@ sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLExcep throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; @@ -330,7 +327,7 @@ sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLExceptio throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; @@ -344,7 +341,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); // it could happen that values are updated as string and then called for as getBytes @@ -366,7 +363,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); @@ -381,7 +378,7 @@ double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLExceptio throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; @@ -395,7 +392,7 @@ float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; @@ -409,7 +406,7 @@ sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLExceptio throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; @@ -438,7 +435,7 @@ sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLExcepti if (OResultSet_BASE::rBHelper.bDisposed) throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return sal_Int64(); @@ -463,7 +460,7 @@ Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return NULL; } @@ -477,7 +474,7 @@ Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(S throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return NULL; } @@ -489,7 +486,7 @@ Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(S throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return NULL; } @@ -502,7 +499,7 @@ Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQL throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return NULL; } @@ -526,7 +523,7 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; @@ -541,7 +538,7 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); m_bWasNull = (*m_aRow)[columnIndex].isNull(); return (*m_aRow)[columnIndex]; @@ -557,7 +554,7 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return (*m_aRow)[columnIndex]; @@ -572,7 +569,7 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); return (*m_aRow)[columnIndex]; } @@ -830,7 +827,7 @@ void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) if (OResultSet_BASE::rBHelper.bDisposed) throw DisposedException(); if(m_pTable->isReadOnly()) - throw SQLException(::rtl::OUString::createFromAscii("Table is readonly!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Table is readonly!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); m_bRowUpdated = m_pTable->UpdateRow(m_aInsertRow.getBody(), m_aRow,Reference<XIndexAccess>(m_xColNames,UNO_QUERY)); (*m_aInsertRow)[0] = (sal_Int32)(*m_aRow)[0]; @@ -855,7 +852,7 @@ void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException) throw DisposedException(); if(m_pTable->isReadOnly()) - throw SQLException(::rtl::OUString::createFromAscii("Table is readonly!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Table is readonly!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); sal_Int32 nPos = (sal_Int32)(*m_aRow)[0]; m_bRowDeleted = m_pTable->DeleteRow(m_xColumns.getBody()); if(m_bRowDeleted && m_pFileSet) @@ -899,7 +896,7 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeExcepti if (OResultSet_BASE::rBHelper.bDisposed) throw DisposedException(); if(m_pTable->isReadOnly()) - throw SQLException(::rtl::OUString::createFromAscii("Table is readonly!"),*this,SQLSTATE_GENERAL,1000,Any()); + throw SQLException(::rtl::OUString::createFromAscii("Table is readonly!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY); @@ -925,7 +922,7 @@ void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException if (OResultSet_BASE::rBHelper.bDisposed) throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -941,7 +938,7 @@ void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) thr throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -955,7 +952,7 @@ void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw( throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -970,7 +967,7 @@ void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) thro throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -984,7 +981,7 @@ void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw( throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -994,7 +991,7 @@ void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw( void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); throw RuntimeException(); } @@ -1006,7 +1003,7 @@ void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQ throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1021,7 +1018,7 @@ void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw( throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1035,7 +1032,7 @@ void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUSt throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1049,7 +1046,7 @@ void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sa throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1063,7 +1060,7 @@ void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::s throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1078,7 +1075,7 @@ void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::s throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1093,7 +1090,7 @@ void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::s throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1110,7 +1107,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer ::dbtools::throwFunctionSequenceException(*this); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); Sequence<sal_Int8> aSeq; x->readSomeBytes(aSeq,length); @@ -1127,7 +1124,7 @@ void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Re ::dbtools::throwFunctionSequenceException(*this); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); Sequence<sal_Int8> aSeq; x->readSomeBytes(aSeq,length); @@ -1149,7 +1146,7 @@ void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) th throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); @@ -1163,7 +1160,7 @@ void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& if (OResultSet_BASE::rBHelper.bDisposed) throw DisposedException(); if(columnIndex <= 0 || columnIndex > (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); columnIndex = mapColumn(columnIndex); OSL_ENSURE(0,"OResultSet::updateNumericObject: NYI"); } @@ -2200,7 +2197,7 @@ BOOL OResultSet::OpenImpl() Reference<XColumnsSupplier> xIndex; ::cppu::extractInterface(xIndex,xIndexes->getByIndex(i)); Reference<XNameAccess> xIndexCols = xIndex->getColumns(); - if(xIndexCols->hasByName(connectivity::getString(xColProp->getPropertyValue(PROPERTY_NAME)))) + if(xIndexCols->hasByName(connectivity::getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))))) { m_pFileSet = new OKeySet(); @@ -2738,7 +2735,7 @@ void OResultSet::SetAssignValue(const String& aColumnName, (*m_aAssignValues)[nId].setNull(); else { - switch (getINT32(xCol->getPropertyValue(PROPERTY_TYPE))) + switch (getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { // Kriterium je nach Typ als String oder double in die Variable packen ... case DataType::CHAR: @@ -2828,10 +2825,10 @@ UINT32 OResultSet::AddParameter(OSQLParseNode * pParameter, const Reference<XPro // Typ, Precision, Scale ... der angegebenen Column verwenden, // denn dieser Column wird der Wert zugewiesen bzw. mit dieser // Column wird der Wert verglichen. - eType = getINT32(_xCol->getPropertyValue(PROPERTY_TYPE)); - nPrecision = getINT32(_xCol->getPropertyValue(PROPERTY_PRECISION)); - nScale = getINT32(_xCol->getPropertyValue(PROPERTY_SCALE)); - nNullable = getINT32(_xCol->getPropertyValue(PROPERTY_ISNULLABLE));; + eType = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); + nPrecision = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + nScale = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); + nNullable = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));; } Reference<XPropertySet> xParaColumn; @@ -2965,7 +2962,7 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, _xNames->getByIndex(i) >>= xTableColumn; OSL_ENSURE(xTableColumn.is(), "OResultSet::OpenImpl: invalid table column!"); if (xTableColumn.is()) - xTableColumn->getPropertyValue(PROPERTY_NAME) >>= sTableColumnName; + xTableColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sTableColumnName; else sTableColumnName = ::rtl::OUString(); @@ -2976,10 +2973,10 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, ++aIter ) { - if((*aIter)->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME)) - (*aIter)->getPropertyValue(PROPERTY_REALNAME) >>= sSelectColumnRealName; + if((*aIter)->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME))) + (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME)) >>= sSelectColumnRealName; else - (*aIter)->getPropertyValue(PROPERTY_NAME) >>= sSelectColumnRealName; + (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sSelectColumnRealName; if (aCase(sTableColumnName, sSelectColumnRealName)) { @@ -2995,7 +2992,7 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, aRowIter->setBound(sal_True); sal_Int32 nType = DataType::OTHER; if (xTableColumn.is()) - xTableColumn->getPropertyValue(PROPERTY_TYPE) >>= nType; + xTableColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType; aRowIter->setTypeKind(nType); } } diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 50d42a44fc84..adbb348a4b56 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fcode.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: pl $ $Date: 2001-05-11 18:45:42 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:51:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,9 +83,8 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE file -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" #endif using namespace connectivity; @@ -159,6 +158,7 @@ const ORowSetValue& OOperandRow::getValue() const OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->size(),"Invalid RowPos is >= vector.size()"); return (*m_pRow)[m_nRowPos]; } + // ----------------------------------------------------------------------------- void OOperandValue::setValue(const ORowSetValue& _rVal) { @@ -166,7 +166,7 @@ void OOperandValue::setValue(const ORowSetValue& _rVal) } //------------------------------------------------------------------ OOperandAttr::OOperandAttr(sal_uInt16 _nPos,const Reference< XPropertySet>& _xColumn) - : OOperandRow(_nPos,getINT32(_xColumn->getPropertyValue(PROPERTY_TYPE))) + : OOperandRow(_nPos,getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) , m_xColumn(_xColumn) { } @@ -216,19 +216,19 @@ void OOperandParam::describe(const Reference< XPropertySet>& rColumn, ::vos::ORe try { - xColumn->setPropertyValue(PROPERTY_TYPENAME,rColumn->getPropertyValue(PROPERTY_TYPENAME)); - xColumn->setPropertyValue(PROPERTY_DEFAULTVALUE,rColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)); - xColumn->setPropertyValue(PROPERTY_PRECISION,rColumn->getPropertyValue(PROPERTY_PRECISION)); - xColumn->setPropertyValue(PROPERTY_TYPE,rColumn->getPropertyValue(PROPERTY_TYPE)); - xColumn->setPropertyValue(PROPERTY_SCALE,rColumn->getPropertyValue(PROPERTY_SCALE)); - xColumn->setPropertyValue(PROPERTY_ISNULLABLE,rColumn->getPropertyValue(PROPERTY_ISNULLABLE)); - xColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT,rColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)); + xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); + xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); + xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); + xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); + xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); + xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))); } catch(const Exception&) { } - m_eDBType = getINT32(rColumn->getPropertyValue(PROPERTY_TYPE)); + m_eDBType = getINT32(rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); } //------------------------------------------------------------------ diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 24be06d4e4c1..ca712a7101f7 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ODatabaseMetaDataResultSet.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: pl $ $Date: 2001-05-11 17:59:22 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:50:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,15 +58,13 @@ * * ************************************************************************/ - +#ifndef CONNECTIVITY_CONNECTION_HXX +#include "TConnection.hxx" +#endif #ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ #include "odbc/ODatabaseMetaDataResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE odbc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> #endif @@ -107,6 +105,7 @@ #include "odbc/OTools.hxx" #endif + using namespace connectivity::odbc; using namespace cppu; //------------------------------------------------------------------------------ @@ -157,9 +156,7 @@ void ODatabaseMetaDataResultSet::disposing(void) Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException) { Any aRet = OPropertySetHelper::queryInterface(rType); - if(!aRet.hasValue()) - aRet = ODatabaseMetaDataResultSet_BASE::queryInterface(rType); - return aRet; + return aRet.hasValue() ? aRet : ODatabaseMetaDataResultSet_BASE::queryInterface(rType); } // ----------------------------------------------------------------------------- Reference< XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( ) throw(RuntimeException) @@ -202,9 +199,10 @@ sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column) sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed ) - throw DisposedException(); + Reference< XResultSetMetaData > xMeta = getMetaData(); sal_Int32 nLen = xMeta->getColumnCount(); @@ -217,9 +215,9 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return NULL; @@ -227,9 +225,10 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResult // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return NULL; @@ -238,9 +237,10 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResult // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); @@ -251,7 +251,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex case DataType::BIT: { sal_Int8 nValue = 0; - getValue(m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,nValue); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,&nValue,sizeof nValue); bRet = nValue != 0; } break; @@ -264,13 +264,14 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); sal_Int8 nVal = 0; - getValue(m_aStatementHandle,columnIndex,SQL_C_CHAR,m_bWasNull,**this,nVal); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_CHAR,m_bWasNull,**this,&nVal,sizeof nVal); if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) return sal_Int8((*m_aValueRangeIter).second[(sal_Int32)nVal]); @@ -280,9 +281,10 @@ sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) t Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); sal_Int32 nType = getMetaData()->getColumnType(columnIndex); @@ -302,55 +304,58 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co ::com::sun::star::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); DATE_STRUCT aDate; aDate.day = 0; aDate.month = 0; aDate.year = 0; - getValue(m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,aDate); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,&aDate,sizeof aDate); return Date(aDate.day,aDate.month,aDate.year); } // ------------------------------------------------------------------------- double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); double nValue(0.0); - getValue(m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,nValue); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,&nValue,sizeof nValue); return nValue; } // ------------------------------------------------------------------------- float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); float nVal(0); - getValue(m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,nVal); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,&nVal,sizeof nVal); return nVal; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); sal_Int32 nVal = 0; - getValue(m_aStatementHandle,columnIndex,SQL_C_LONG,m_bWasNull,**this,nVal); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_LONG,m_bWasNull,**this,&nVal,sizeof nVal); if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) return (*m_aValueRangeIter).second[(sal_Int32)nVal]; @@ -360,9 +365,10 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) t sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return 0; } @@ -370,9 +376,10 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, Ru sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return sal_Int64(0); } @@ -380,20 +387,18 @@ sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex ) Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); - if(!m_xMetaData.is()) - m_xMetaData = new OResultSetMetaData(m_aStatementHandle); - return m_xMetaData; + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); + return m_xMetaData.is() ? m_xMetaData : (m_xMetaData = new OResultSetMetaData(m_aStatementHandle)); } // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return NULL; @@ -403,9 +408,10 @@ Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 col Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return NULL; @@ -413,9 +419,10 @@ Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 colum // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return NULL; @@ -424,9 +431,10 @@ Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 colum Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return NULL; @@ -435,9 +443,10 @@ Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 columnI Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); return Any(); @@ -446,13 +455,14 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); sal_Int16 nVal = 0; - getValue(m_aStatementHandle,columnIndex,SQL_C_SHORT,m_bWasNull,**this,nVal); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_SHORT,m_bWasNull,**this,&nVal,sizeof nVal); if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) return sal_Int16((*m_aValueRangeIter).second[(sal_Int32)nVal]); @@ -462,9 +472,10 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); ::rtl::OUString aVal = OTools::getStringValue(m_aStatementHandle,(SQLUSMALLINT)columnIndex,getMetaData()->getColumnType(columnIndex),m_bWasNull,**this,m_nTextEncoding); @@ -477,13 +488,14 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) ::com::sun::star::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); TIME_STRUCT aTime={0,0,0}; - getValue(m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,aTime); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,&aTime,sizeof aTime); return Time(0,aTime.second,aTime.minute,aTime.hour); } // ------------------------------------------------------------------------- @@ -491,49 +503,54 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) ::com::sun::star::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0}; - getValue(m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,aTime); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime); return DateTime(aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return m_nCurrentFetchState == SQL_NO_DATA; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return m_nRowPos == 1; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return m_bEOF && m_nCurrentFetchState != SQL_NO_DATA; } // ------------------------------------------------------------------------- void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + if(first()) previous(); @@ -542,9 +559,10 @@ void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, Ru // ------------------------------------------------------------------------- void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + if(last()) next(); @@ -555,9 +573,10 @@ void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, Runt void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeException) { { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + } dispose(); } @@ -565,9 +584,10 @@ void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeE sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0); OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); @@ -580,9 +600,9 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, Runt sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, RuntimeException) { + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed ); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed ) - throw DisposedException(); + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0); OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); @@ -592,9 +612,10 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, Runti // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row); OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); @@ -606,9 +627,10 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row); OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); @@ -620,9 +642,10 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); @@ -640,26 +663,29 @@ Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( ) th sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return m_pRowStatusArray[0] == SQL_ROW_DELETED; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException, RuntimeException) -{ ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); +{ + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); + return m_pRowStatusArray[0] == SQL_ROW_ADDED; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return m_pRowStatusArray[0] == SQL_ROW_UPDATED; } @@ -667,9 +693,10 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return m_nRowPos == 0; } @@ -677,9 +704,10 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLExcepti sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0); m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); @@ -690,26 +718,29 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, Runti sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + return m_bWasNull; } // ------------------------------------------------------------------------- void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + } // ------------------------------------------------------------------------- void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException) { + + checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + OTools::ThrowException(N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this); } @@ -909,12 +940,13 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const ::rtl::OUS const char *pCOL = NULL; + const char* pComma = ","; const ::rtl::OUString* pBegin = types.getConstArray(); const ::rtl::OUString* pEnd = pBegin + types.getLength(); for(;pBegin != pEnd;++pBegin) { aCOL += ::rtl::OUStringToOString(*pBegin,m_nTextEncoding); - aCOL += ","; + aCOL += pComma; } if(aCOL.getLength()) pCOL = aCOL.getStr(); diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index bd41ee3f8d5a..06d16cf83c7e 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OResultSet.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: pl $ $Date: 2001-05-11 17:59:22 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:50:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,10 +61,6 @@ #ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ #include "odbc/OResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE odbc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _CONNECTIVITY_OTOOLS_HXX_ #include "odbc/OTools.hxx" #endif @@ -83,9 +79,7 @@ #ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> #endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ -#include <com/sun/star/lang/DisposedException.hpp> -#endif + #ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> #endif @@ -95,7 +89,12 @@ #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity; using namespace connectivity::odbc; using namespace cppu; using namespace com::sun::star::uno; @@ -106,6 +105,7 @@ using namespace com::sun::star::sdbcx; using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; + //------------------------------------------------------------------------------ // IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); ::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \ @@ -123,13 +123,13 @@ using namespace com::sun::star::util; // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + 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; + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; - return sal_False; + return pSupported != pEnd; } // ------------------------------------------------------------------------- @@ -368,9 +368,11 @@ Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeExcep sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) { + + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); Reference< XResultSetMetaData > xMeta = getMetaData(); sal_Int32 nLen = xMeta->getColumnCount(); @@ -384,8 +386,8 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); // TODO use getBytes instead of @@ -395,8 +397,8 @@ Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 column Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); // TODO use getBytes instead of @@ -407,8 +409,8 @@ Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 col sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); @@ -421,7 +423,7 @@ sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLExcep sal_Int8 nVal(0); - getValue(m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,nVal); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,&nVal,sizeof nVal); return nVal; } // ------------------------------------------------------------------------- @@ -429,31 +431,31 @@ sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLExcep sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + sal_Int8 nRet = 0; columnIndex = mapColumn(columnIndex); if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - sal_Int8 nRet = 0; + m_aRow[columnIndex] >>= nRet; - return nRet; } - - sal_Int8 nVal = 0; - getValue(m_aStatementHandle,columnIndex,SQL_C_CHAR,m_bWasNull,**this,nVal); - return nVal; + else + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_CHAR,m_bWasNull,**this,&nRet,sizeof nRet); + return nRet; } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + columnIndex = mapColumn(columnIndex); if(m_bFetchData) @@ -466,7 +468,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro OSL_ENSURE(TypeClass_STRING == m_aRow[columnIndex].getValueTypeClass(),"ONLY string types supported!"); ::rtl::OUString sRet; m_aRow[columnIndex] >>= sRet; - return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength()); + nRet = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength()); } return nRet; } @@ -489,58 +491,63 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + Date nRet; columnIndex = mapColumn(columnIndex); if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - Date nRet; + m_aRow[columnIndex] >>= nRet; - return nRet; } + else + { - DATE_STRUCT aDate; - aDate.day = 0; - aDate.month = 0; - aDate.year = 0; - getValue(m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,aDate); - return Date(aDate.day,aDate.month,aDate.year); + DATE_STRUCT aDate; + aDate.day = 0; + aDate.month = 0; + aDate.year = 0; + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,&aDate,sizeof aDate); + nRet = Date(aDate.day,aDate.month,aDate.year); + } + return nRet; } // ------------------------------------------------------------------------- double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + double nRet = 0; columnIndex = mapColumn(columnIndex); if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - double nRet = 0; + m_aRow[columnIndex] >>= nRet; - return nRet; + } - double nVal(0.0); - getValue(m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,nVal); - return nVal; + else + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,&nRet,sizeof nRet); + return nRet; } // ------------------------------------------------------------------------- float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); float nVal(0); - getValue(m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,nVal); + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,&nVal,sizeof nVal); return nVal; } // ------------------------------------------------------------------------- @@ -548,29 +555,29 @@ float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); + sal_Int32 nRet=0; if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - sal_Int32 nRet=0; m_aRow[columnIndex] >>= nRet; - return nRet; } - sal_Int32 nVal(0); - getValue(m_aStatementHandle,columnIndex,SQL_C_LONG,m_bWasNull,**this,nVal); - return nVal; + else + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_LONG,m_bWasNull,**this,&nRet,sizeof nRet); + + return nRet; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + sal_Int32 nValue = 0; OTools::ThrowException(N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_NUMBER,&nValue,SQL_IS_UINTEGER,0),m_aStatementHandle,SQL_HANDLE_STMT,*this); @@ -583,8 +590,8 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); return sal_Int64(); @@ -594,8 +601,8 @@ sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLExcepti Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + if(!m_xMetaData.is()) m_xMetaData = new OResultSetMetaData(m_aStatementHandle); @@ -605,8 +612,8 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLEx Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); return NULL; @@ -617,8 +624,8 @@ Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); return NULL; @@ -627,8 +634,8 @@ Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(S Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); return NULL; @@ -638,8 +645,8 @@ Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(S Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); return NULL; @@ -649,8 +656,8 @@ Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQL Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); return Any(); @@ -660,21 +667,22 @@ Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::co sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + sal_Int16 nRet=0; columnIndex = mapColumn(columnIndex); if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - sal_Int16 nRet=0; + m_aRow[columnIndex] >>= nRet; - return nRet; + } - sal_Int16 nVal(0); - getValue(m_aStatementHandle,columnIndex,SQL_C_SHORT,m_bWasNull,**this,nVal); - return nVal; + else + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_SHORT,m_bWasNull,**this,&nRet,sizeof nRet); + return nRet; } // ------------------------------------------------------------------------- @@ -682,71 +690,80 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); + ::rtl::OUString nRet; if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - ::rtl::OUString nRet; m_aRow[columnIndex] >>= nRet; - return nRet; } - return OTools::getStringValue(m_aStatementHandle,columnIndex,getMetaData()->getColumnType(columnIndex),m_bWasNull,**this,m_nTextEncoding); + else + nRet = OTools::getStringValue(m_aStatementHandle,columnIndex,getMetaData()->getColumnType(columnIndex),m_bWasNull,**this,m_nTextEncoding); + return nRet; } // ------------------------------------------------------------------------- - Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + Time nRet; columnIndex = mapColumn(columnIndex); if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - Time nRet; m_aRow[columnIndex] >>= nRet; - return nRet; } - TIME_STRUCT aTime={0,0,0}; - getValue(m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,aTime); - return Time(0,aTime.second,aTime.minute,aTime.hour); + else + { + TIME_STRUCT aTime={0,0,0}; + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,&aTime,sizeof aTime); + nRet = Time(0,aTime.second,aTime.minute,aTime.hour); + } + return nRet; } // ------------------------------------------------------------------------- DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + DateTime nRet; columnIndex = mapColumn(columnIndex); if(m_bFetchData) { if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); - DateTime nRet; + m_aRow[columnIndex] >>= nRet; - return nRet; + // return nRet; + } + else + { + TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0}; + OTools::getValue(m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime); + nRet = DateTime(aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year); } - TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0}; - getValue(m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,aTime); - return DateTime(aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year); + return nRet; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_nRowPos == 0; } @@ -754,8 +771,8 @@ sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeExcep sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_nRowPos != 0 && m_nCurrentFetchState == SQL_NO_DATA; } @@ -763,8 +780,8 @@ sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeExcepti sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_nRowPos == 1; } @@ -772,8 +789,8 @@ sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_bEOF && m_nCurrentFetchState != SQL_NO_DATA; } @@ -781,8 +798,8 @@ sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + if(first()) previous(); @@ -792,8 +809,8 @@ void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; if(last()) @@ -806,8 +823,8 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) { { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + } dispose(); } @@ -816,8 +833,8 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0); @@ -832,8 +849,8 @@ sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0); @@ -845,8 +862,8 @@ sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row); @@ -860,8 +877,8 @@ sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, Runt sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row); @@ -875,8 +892,8 @@ sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, Runt sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); @@ -890,8 +907,8 @@ sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_aStatement.get(); } @@ -900,16 +917,17 @@ Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_pRowStatusArray[0] == SQL_ROW_DELETED; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) -{ ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_pRowStatusArray[0] == SQL_ROW_ADDED; } @@ -917,8 +935,8 @@ sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeExcepti sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return m_pRowStatusArray[0] == SQL_ROW_UPDATED; } @@ -927,8 +945,8 @@ sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeExceptio sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0); @@ -943,21 +961,18 @@ sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - if(m_bFetchData) - return !m_aRow[m_nLastColumnPos].hasValue(); - return m_bWasNull; + return m_bFetchData ? !m_aRow[m_nLastColumnPos].hasValue() : m_bWasNull; } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + OTools::ThrowException(N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this); } @@ -974,8 +989,8 @@ Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + SQLRETURN nRet; if(pODBC3SQLBulkOperations) @@ -993,8 +1008,8 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + SQLRETURN nRet; nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE); @@ -1037,8 +1052,8 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeExcept void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; // first unbound all columns @@ -1057,64 +1072,66 @@ void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeExcept void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); - bindValue(m_aStatementHandle,columnIndex,SQL_CHAR,0,0,(sal_Int8*)NULL,NULL,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_CHAR,0,0,(sal_Int8*)NULL,NULL,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue<sal_Bool>(m_aStatementHandle,columnIndex,SQL_BIT,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_BIT,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue(m_aStatementHandle,columnIndex,SQL_CHAR,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_CHAR,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue(m_aStatementHandle,columnIndex,SQL_TINYINT,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_TINYINT,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { + + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue(m_aStatementHandle,columnIndex,SQL_INTEGER,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_INTEGER,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); throw RuntimeException(); @@ -1123,92 +1140,92 @@ void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue(m_aStatementHandle,columnIndex,SQL_REAL,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_REAL,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue(m_aStatementHandle,columnIndex,SQL_DOUBLE,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_DOUBLE,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue(m_aStatementHandle,columnIndex,SQL_VARCHAR,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_VARCHAR,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; - bindValue(m_aStatementHandle,columnIndex,SQL_BINARY,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_BINARY,0,0,&x,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; DATE_STRUCT aVal = OTools::DateToOdbcDate(x); - bindValue(m_aStatementHandle,columnIndex,SQL_DATE,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_DATE,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; TIME_STRUCT aVal = OTools::TimeToOdbcTime(x); - bindValue(m_aStatementHandle,columnIndex,SQL_TIME,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_TIME,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); void* pData = m_aBindVector[columnIndex]; TIMESTAMP_STRUCT aVal = OTools::DateTimeToTimestamp(x); - bindValue(m_aStatementHandle,columnIndex,SQL_TIMESTAMP,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); + OTools::bindValue(m_aStatementHandle,columnIndex,SQL_TIMESTAMP,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); } @@ -1216,8 +1233,8 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); } @@ -1225,8 +1242,8 @@ void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Re void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + // SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE); m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); @@ -1236,8 +1253,8 @@ void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); // switch(x.getValueTypeClass()) @@ -1315,8 +1332,8 @@ void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) th void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + columnIndex = mapColumn(columnIndex); OSL_ENSURE(0,"OResultSet::updateNumericObject: NYI"); @@ -1343,8 +1360,8 @@ void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + sal_uInt32 nValue = SQL_UB_OFF; N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&nValue,SQL_IS_UINTEGER,NULL); @@ -1358,8 +1375,8 @@ Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; Sequence<sal_Int8> aBookmark; @@ -1374,8 +1391,8 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLE sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_nLastColumnPos = 0; Sequence<sal_Int8> aBookmark; @@ -1390,8 +1407,8 @@ sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_ sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw( SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + return (first == second) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL; } @@ -1410,8 +1427,8 @@ sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw( SQLEx Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OResultSet_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + SQLRETURN nReturn; diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 70f3c13c3fc4..a5ef4336457d 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OStatement.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: pl $ $Date: 2001-05-11 17:59:22 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:50:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,10 +73,6 @@ #ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ #include "odbc/OResultSet.hxx" #endif -#define CONNECTIVITY_PROPERTY_NAME_SPACE odbc -#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ -#include "propertyids.hxx" -#endif #ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> #endif @@ -127,17 +123,6 @@ } #endif -// define the properties of this lib -// this file includes the properties for this dll -namespace connectivity -{ - namespace odbc - { -#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX -#include "UStringDescription_Impl.hxx" -#endif - } -} using namespace connectivity::odbc; @@ -215,8 +200,8 @@ Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); OTools::ThrowException(N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this); } @@ -226,8 +211,8 @@ void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) { { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + } dispose(); } @@ -242,8 +227,8 @@ void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException) void OStatement_Base::reset() throw (SQLException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + clearWarnings (); @@ -264,8 +249,8 @@ void OStatement_Base::reset() throw (SQLException) void OStatement_Base::clearMyResultSet () throw (SQLException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + Reference<XCloseable> xCloseable; if(::comphelper::query_interface(m_xResultSet.get(),xCloseable)) @@ -276,8 +261,8 @@ void OStatement_Base::clearMyResultSet () throw (SQLException) sal_Int32 OStatement_Base::getRowCount () throw( SQLException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + sal_Int32 numRows = 0; @@ -338,8 +323,8 @@ sal_Bool OStatement_Base::lockIfNecessary (const ::rtl::OUString& sql) throw( SQ void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + m_aLastWarning = ex; } @@ -352,8 +337,8 @@ void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) sal_Int32 OStatement_Base::getColumnCount () throw( SQLException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + sal_Int16 numCols = 0; OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); @@ -371,8 +356,8 @@ sal_Int32 OStatement_Base::getColumnCount () throw( SQLException) sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + ::rtl::OString aSql(::rtl::OUStringToOString(sql,getOwnConnection()->getTextEncoding())); @@ -421,8 +406,8 @@ sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(S Reference< XResultSet > OStatement_Base::getResultSet (sal_Bool checkCount) throw( SQLException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if (m_xResultSet.get().is()) // if resultset already retrieved, { @@ -483,8 +468,8 @@ sal_Int32 OStatement_Base::getStmtOption (short fOption) const throw( SQLExcepti Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + Reference< XResultSet > xRS = NULL; @@ -508,8 +493,8 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUS Reference< XConnection > SAL_CALL OStatement_Base::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; } // ------------------------------------------------------------------------- @@ -526,8 +511,8 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeExcep void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + m_aBatchList.push_back(sql); } @@ -535,8 +520,8 @@ void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLExcept Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + ::rtl::OString aBatchSql; sal_Int32 nLen = 0; @@ -567,8 +552,8 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + sal_Int32 numRows = -1; @@ -594,8 +579,8 @@ sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + m_xResultSet = getResultSet(sal_True); return m_xResultSet; @@ -605,8 +590,8 @@ Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLExce sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + sal_Int32 rowCount = -1; @@ -623,8 +608,8 @@ sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, Runti sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OResultSet* pRS = NULL; SQLWarning warning; @@ -676,8 +661,8 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, Runtim Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + return makeAny(m_aLastWarning); } @@ -687,8 +672,8 @@ Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeExcepti void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + m_aLastWarning = SQLWarning(); } @@ -785,8 +770,8 @@ sal_Int32 OStatement_Base::getMaxFieldSize() const throw(SQLException, RuntimeEx void OStatement_Base::setQueryTimeOut(sal_Int32 seconds) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_QUERY_TIMEOUT,(SQLPOINTER)seconds,SQL_IS_UINTEGER); @@ -798,8 +783,8 @@ void OStatement_Base::setQueryTimeOut(sal_Int32 seconds) throw(SQLException, Run void OStatement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_MAX_ROWS, (SQLPOINTER)_par0,SQL_IS_UINTEGER); @@ -812,8 +797,8 @@ void OStatement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeExc void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + SQLINTEGER nSet; if(_par0 == ResultSetConcurrency::READ_ONLY) @@ -829,8 +814,8 @@ void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLExceptio void OStatement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_ROW_BIND_TYPE,(SQLPOINTER)SQL_BIND_BY_COLUMN,SQL_IS_UINTEGER); @@ -868,8 +853,8 @@ void OStatement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, Runt void OStatement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_Int32 nCursType = 0; @@ -893,8 +878,8 @@ void OStatement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLException, Run void OStatement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); @@ -916,8 +901,8 @@ void OStatement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeE void OStatement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_MAX_LENGTH,(SQLPOINTER)_par0,SQL_IS_UINTEGER)); @@ -926,8 +911,8 @@ void OStatement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLException, Runti void OStatement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); ::rtl::OString aName(::rtl::OUStringToOString(_par0,getOwnConnection()->getTextEncoding())); @@ -936,8 +921,8 @@ void OStatement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLExcep // ------------------------------------------------------------------------- sal_Bool OStatement_Base::isUsingBookmarks() const throw(SQLException, RuntimeException) { - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_uInt32 nValue = SQL_UB_OFF; @@ -949,8 +934,8 @@ sal_Bool OStatement_Base::isUsingBookmarks() const throw(SQLException, RuntimeEx void OStatement_Base::setUsingBookmarks(sal_Bool _bUseBookmark) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (OStatement_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); sal_uInt32 nValue = _bUseBookmark ? SQL_UB_VARIABLE : SQL_UB_OFF; @@ -990,34 +975,35 @@ sal_Bool OStatement_Base::convertFastPropertyValue( const Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException) { + sal_Bool bConverted = sal_False; switch(nHandle) { case PROPERTY_ID_QUERYTIMEOUT: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut()); case PROPERTY_ID_MAXFIELDSIZE: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize()); case PROPERTY_ID_MAXROWS: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxRows()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxRows()); case PROPERTY_ID_CURSORNAME: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName()); case PROPERTY_ID_RESULTSETCONCURRENCY: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency()); case PROPERTY_ID_RESULTSETTYPE: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType()); case PROPERTY_ID_FETCHDIRECTION: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); case PROPERTY_ID_FETCHSIZE: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); case PROPERTY_ID_ESCAPEPROCESSING: - // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); + // bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); break; case PROPERTY_ID_USEBOOKMARKS: - return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, isUsingBookmarks()); + bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, isUsingBookmarks()); default: ; } - return sal_False; + return bConverted; } // ------------------------------------------------------------------------- void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) diff --git a/connectivity/source/inc/OSubComponent.hxx b/connectivity/source/inc/OSubComponent.hxx index adeb49b3683b..9a6fa0b6bdf1 100644 --- a/connectivity/source/inc/OSubComponent.hxx +++ b/connectivity/source/inc/OSubComponent.hxx @@ -2,9 +2,9 @@ * * $RCSfile: OSubComponent.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: rt $ $Date: 2001-05-08 10:03:03 $ + * last change: $Author: oj $ $Date: 2001-05-14 11:54:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,10 +64,29 @@ #ifndef _CPPUHELPER_WEAK_HXX_ #include <cppuhelper/weak.hxx> #endif - +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif +namespace com +{ + namespace sun + { + namespace star + { + namespace lang + { + class XComponent; + } + } + } +} namespace connectivity { + void release(oslInterlockedCount& _refCount, + ::cppu::OBroadcastHelper& rBHelper, + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + ::com::sun::star::lang::XComponent* _pObject); //************************************************************ // OSubComponent //************************************************************ @@ -96,39 +115,10 @@ namespace connectivity } void relase_ChildImpl() { - if (osl_decrementInterlockedCount( &m_pDerivedImplementation->m_refCount ) == 0) - { - osl_incrementInterlockedCount( &m_pDerivedImplementation->m_refCount ); - - if (!m_pDerivedImplementation->rBHelper.bDisposed && !m_pDerivedImplementation->rBHelper.bInDispose) - { - // remember the parent - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xParent; - { - ::osl::MutexGuard aGuard( m_pDerivedImplementation->rBHelper.rMutex ); - xParent = m_xParent; - m_xParent = NULL; - } - - // First dispose - m_pDerivedImplementation->dispose(); - - // only the alive ref holds the object - OSL_ASSERT( m_pDerivedImplementation->m_refCount == 1 ); - - // release the parent in the ~ - if (xParent.is()) - { - ::osl::MutexGuard aGuard( m_pDerivedImplementation->rBHelper.rMutex ); - m_xParent = xParent; - } - -// // destroy the object if xHoldAlive decrement the refcount to 0 -// m_pDerivedImplementation->WEAK::release(); - } - } - else - osl_incrementInterlockedCount( &m_pDerivedImplementation->m_refCount ); + ::connectivity::release(m_pDerivedImplementation->m_refCount, + m_pDerivedImplementation->rBHelper, + m_xParent, + m_pDerivedImplementation); m_pDerivedImplementation->WEAK::release(); } diff --git a/connectivity/version.mk b/connectivity/version.mk index 898ace0aa893..25fad5d77a0a 100644 --- a/connectivity/version.mk +++ b/connectivity/version.mk @@ -2,9 +2,9 @@ # # $RCSfile: version.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: oj $ $Date: 2001-05-08 12:12:04 $ +# last change: $Author: oj $ $Date: 2001-05-14 11:55:19 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -76,6 +76,22 @@ ADO_CPP=1 ADO=$(ADO_TARGET_TARGET)_$(CMPEXT) +# ----------------------------ODBC BASE settings-----------------------------------# +# target +ODBC2_TARGET=odbcbase + +# the major +ODBC2_MAJOR=2 +# the minor +ODBC2_MINOR=0 +# the micro +ODBC2_MICRO=0 + +# this is a c++ compatible library +ODBC2_CPP=1 + +ODBC2=$(ODBC2_TARGET_TARGET)_$(CMPEXT) + # ----------------------------ODBC settings-----------------------------------# # target ODBC_TARGET=odbc |