diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-07-30 07:53:02 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-07-30 07:53:02 +0000 |
commit | 503986990c7410000c336f934c911bdc4924d6fb (patch) | |
tree | 417ad1133fe68d9d5002b9686240fcc0eaa9f0ce /connectivity | |
parent | c7f6878d5904ea16554b58b87b4636a9d4484577 (diff) |
#90015# use ORowSetValue as const ref
Diffstat (limited to 'connectivity')
20 files changed, 453 insertions, 1247 deletions
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index 41a58c259d2f..81c98a324bb9 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AResultSet.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-05-18 08:48:07 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -105,6 +105,9 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include "connectivity/dbexception.hxx" #endif +#ifndef _CONNECTIVITY_DBTOOLS_HXX_ +#include "connectivity/dbtools.hxx" +#endif #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif @@ -159,15 +162,7 @@ OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) : ORes ,m_pRecordSet(_pRecordSet) ,m_bEOF(sal_False) { - osl_incrementInterlockedCount( &m_refCount ); - OSL_ENSURE(_pRecordSet,"No RecordSet !"); - if(!_pRecordSet) - ::dbtools::throwFunctionSequenceException(*this); - m_pRecordSet->AddRef(); - VARIANT_BOOL bIsAtBOF; - CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF)) - m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE; - osl_decrementInterlockedCount( &m_refCount ); + construct(); } // ------------------------------------------------------------------------- OResultSet::OResultSet(ADORecordset* _pRecordSet) : OResultSet_BASE(m_aMutex) @@ -177,18 +172,21 @@ OResultSet::OResultSet(ADORecordset* _pRecordSet) : OResultSet_BASE(m_aMutex) ,m_pRecordSet(_pRecordSet) ,m_bEOF(sal_False) { + construct(); +} +// ----------------------------------------------------------------------------- +void OResultSet::construct() +{ osl_incrementInterlockedCount( &m_refCount ); - OSL_ENSURE(_pRecordSet,"No RecordSet !"); - if(!_pRecordSet) + OSL_ENSURE(m_pRecordSet,"No RecordSet !"); + if(!m_pRecordSet) ::dbtools::throwFunctionSequenceException(*this); m_pRecordSet->AddRef(); VARIANT_BOOL bIsAtBOF; CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF)) m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE; osl_decrementInterlockedCount( &m_refCount ); - // allocBuffer(); } - // ------------------------------------------------------------------------- OResultSet::~OResultSet() { @@ -237,11 +235,7 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t sal_Int32 i = 1; for(;i<=nLen;++i) if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : -#if SUPD > 630 columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) -#else - columnName.equalsIgnoreCase(xMeta->getColumnName(i))) -#endif break; return i; } @@ -252,7 +246,8 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinarySt ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ADO_GETFIELD(columnIndex); + WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); + if((aField.GetAttributes() & adFldLong) == adFldLong) { //Copy the data only upto the Actual Size of Field. @@ -282,112 +277,64 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinarySt } // else we ask for a bytesequence aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return NULL; - return new ::comphelper::SequenceInputStream(m_aValue); + + return m_aValue.isNull() ? NULL : new ::comphelper::SequenceInputStream(m_aValue); } // ------------------------------------------------------------------------- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - return NULL; } - -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +// ----------------------------------------------------------------------------- +OLEVariant OResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ADO_GETFIELD(columnIndex); + WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return sal_False; return m_aValue; } // ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + return getValue(columnIndex); +} +// ------------------------------------------------------------------------- sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return 0; - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return Sequence< sal_Int8 >(); - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return ::com::sun::star::util::Date(); - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return 0; - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return 0; - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return 0; - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- @@ -406,13 +353,6 @@ 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 ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - if(m_aValue.isNull()) - return 0; return sal_Int64(0); } // ------------------------------------------------------------------------- @@ -430,7 +370,6 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLEx // ------------------------------------------------------------------------- Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - return NULL; } @@ -438,20 +377,17 @@ Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - return NULL; } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - return NULL; } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - return NULL; } // ------------------------------------------------------------------------- @@ -465,29 +401,13 @@ 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 ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return 0; - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - m_aValue = aField.get_Value(); - if(m_aValue.isNull()) - return ::rtl::OUString(); - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- @@ -495,30 +415,14 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept ::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return ::com::sun::star::util::Time(); - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); - aField.get_Value(m_aValue); - if(m_aValue.isNull()) - return ::com::sun::star::util::DateTime(); - return m_aValue; + return getValue(columnIndex); } // ------------------------------------------------------------------------- @@ -835,155 +739,86 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeExcepti void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { } -// ------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +// ----------------------------------------------------------------------------- +void OResultSet::updateValue(sal_Int32 columnIndex,const OLEVariant& x) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - ADO_GETFIELD(columnIndex); + WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ OLEVariant x; x.setNull(); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ----------------------------------------------------------------------- void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - - ADO_GETFIELD(columnIndex); - aField.PutValue(x); + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- @@ -1008,14 +843,15 @@ void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { - + if (!::dbtools::implUpdateObject(this, columnIndex, x)) + throw SQLException(); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) { - - OSL_ENSURE(0,"OResultSet::updateNumericObject: NYI"); + if (!::dbtools::implUpdateObject(this, columnIndex, x)) + throw SQLException(); } //------------------------------------------------------------------------------ // XRowLocate @@ -1024,7 +860,6 @@ Any SAL_CALL OResultSet::getBookmark( ) throw(SQLException, RuntimeException) ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - if(m_nRowPos < (sal_Int32)m_aBookmarks.size()) // this bookmark was already fetched return makeAny(sal_Int32(m_nRowPos-1)); @@ -1354,3 +1189,4 @@ void SAL_CALL OResultSet::release() throw(::com::sun::star::uno::RuntimeExceptio // ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx index 2e2ed7ad5f53..08f3f4c86b45 100644 --- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx +++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: AResultSetMetaData.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-14 11:40:04 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ OResultSetMetaData::~OResultSetMetaData() // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid() && aField.GetActualSize() != -1) return aField.GetActualSize(); return 0; @@ -100,7 +100,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); return ADOS::MapADOType2Jdbc(aField.GetADOType()); } // ------------------------------------------------------------------------- @@ -132,7 +132,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw( ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) return aField.GetName(); @@ -167,7 +167,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw( sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) { return ((aField.GetAttributes() & adFldFixed) == adFldFixed) && (aField.GetADOType() == adCurrency); @@ -185,7 +185,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw( sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) { return (aField.GetAttributes() & adFldNegativeScale) == adFldNegativeScale; @@ -195,7 +195,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLExce // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) return aField.GetPrecision(); return 0; @@ -203,7 +203,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) return aField.GetNumericScale(); return 0; @@ -212,7 +212,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com: sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) { return (aField.GetAttributes() & adFldIsNullable) == adFldIsNullable; @@ -229,7 +229,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQL sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) { // return (aField.GetStatus() & adFieldReadOnly) == adFieldReadOnly; @@ -240,7 +240,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLEx sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { - ADO_GETFIELD(column); + WpADOField aField = ADOS::getField(m_pRecordSet,column); if(aField.IsValid()) { return (aField.GetAttributes() & adFldUpdatable) == adFldUpdatable; diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx index d6171cd87526..6fbafea60155 100644 --- a/connectivity/source/drivers/ado/adoimp.cxx +++ b/connectivity/source/drivers/ado/adoimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: adoimp.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-06-20 07:16:56 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,7 +65,9 @@ #ifndef _COM_SUN_STAR_SDBCX_PRIVILEGEOBJECT_HPP_ #include <com/sun/star/sdbcx/PrivilegeObject.hpp> #endif - +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif #ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ #include "ado/Awrapado.hxx" #endif @@ -348,6 +350,19 @@ sal_Int32 ADOS::mapRights2Ado(sal_Int32 nRights) return eRights; } // ----------------------------------------------------------------------------- +WpADOField ADOS::getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ADOFields* pFields = NULL; + _pRecordSet->get_Fields(&pFields); + WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields); \ + if(_nColumnIndex <= 0 || _nColumnIndex > aFields.GetItemCount()) + ::dbtools::throwInvalidIndexException(NULL); + WpADOField aField(aFields.GetItem(_nColumnIndex-1)); + if(!aField.IsValid()) + ::dbtools::throwInvalidIndexException(NULL); + return aField; +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 598c1ac99240..25039da8ad85 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.56 $ + * $Revision: 1.57 $ * - * last change: $Author: oj $ $Date: 2001-07-20 12:21:43 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -642,7 +642,6 @@ sal_Bool ODbaseTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols, sal_B ::rtl::OUString aName; xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aName; // Laengen je nach Datentyp: - // nyi: eine zentrale Funktion, die die Laenge liefert! sal_Int32 nLen; sal_Int32 nType; if(_bUseTableDefs) @@ -1323,19 +1322,8 @@ Reference<XPropertySet> ODbaseTable::isUniqueByColumnName(const ::rtl::OUString& //------------------------------------------------------------------ double toDouble(const ByteString& rString) { - static International aInter(LANGUAGE_ENGLISH); - static int nErrno=0; - BOOL bInitialized = sal_False; - if (!bInitialized) - { // ensure that the two members we're interested in are really set - // (if the system doesn't know the locale en_US aIntl would be initialized with the - // system language which may be anything - which we don't want ...) - // 74342 - 21.03.00 - FS - aInter.SetNumThousandSep(','); - aInter.SetNumDecimalSep('.'); - bInitialized = TRUE; - } - return SolarMath::StringToDouble(UniString(rString,gsl_getSystemTextEncoding()).GetBuffer(),aInter,nErrno); + int nErrno; + return SolarMath::StringToDouble(UniString(rString,gsl_getSystemTextEncoding()).GetBuffer(),',','.',nErrno); } //------------------------------------------------------------------ @@ -1406,14 +1394,16 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; // Laengen je nach Datentyp: - // nyi: eine zentrale Funktion, die die Laenge liefert! - sal_Int32 nLen = getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); - sal_Int32 nType = getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); + sal_Int32 nLen; + sal_Int32 nType; + nLen = m_aPrecisions[i]; + nType = m_aTypes[i]; + switch (nType) { case DataType::DATE: nLen = 8; break; case DataType::DECIMAL: - nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); + nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,m_aScales[i]); break; // das Vorzeichen und das Komma case DataType::BIT: nLen = 1; break; case DataType::LONGVARCHAR: nLen = 10; break; @@ -1492,7 +1482,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refer double n = rRow[nPos]; - int nPrecision = (int)getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + int nPrecision = (int)m_aPrecisions[i]; int nScale = (int)getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); // ein const_cast, da GetFormatPrecision am SvNumberFormat nicht const ist, obwohl es das eigentlich // sein koennte und muesste diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx index af8a7c5b5305..a63bcaead571 100644 --- a/connectivity/source/drivers/file/FColumns.cxx +++ b/connectivity/source/drivers/file/FColumns.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FColumns.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-11-03 14:14:00 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -134,9 +134,7 @@ void OColumns::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > OColumns::createEmptyObject() { - sdbcx::OColumn* pRet = new sdbcx::OColumn(m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); - Reference< XPropertySet > xRet = pRet; - return xRet; + return new sdbcx::OColumn(m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); } diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 07b3c3d8afc7..0c9cf985018e 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.30 $ + * $Revision: 1.31 $ * - * last change: $Author: oj $ $Date: 2001-07-16 09:58:40 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -164,25 +164,22 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV { osl_incrementInterlockedCount( &m_refCount ); - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; - - String aFileName = aDSN; - INetURLObject aURL; - aURL.SetSmartProtocol(INET_PROT_FILE); { - SvtPathOptions aPathOptions; - aFileName = aPathOptions.SubstituteVariable(aFileName); - } - aURL.SetSmartURL(aFileName); + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; - aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); - m_aURL = aFileName; + String aFileName = aDSN; + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + { + SvtPathOptions aPathOptions; + aFileName = aPathOptions.SubstituteVariable(aFileName); + } + aURL.SetSmartURL(aFileName); - if(!aFileName.Len()) - aFileName = aDSN; - String aWildcard; + m_aURL = aURL.GetMainURL(INetURLObject::NO_DECODE); + } ::rtl::OUString aExt; const PropertyValue *pBegin = info.getConstArray(); @@ -215,6 +212,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV if(aExt.getLength()) m_aFilenameExtension = aExt; + ::ucb::Content aFile; try { @@ -295,16 +293,11 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const :: // -------------------------------------------------------------------------------- Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - return NULL; } // -------------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sql; } // -------------------------------------------------------------------------------- @@ -313,7 +306,6 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLExcepti ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - m_bAutoCommit = autoCommit; } // -------------------------------------------------------------------------------- @@ -322,26 +314,15 @@ sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeExce ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - return m_bAutoCommit; } // -------------------------------------------------------------------------------- void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - - } // -------------------------------------------------------------------------------- void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - - } // -------------------------------------------------------------------------------- sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) @@ -387,43 +368,24 @@ sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeExcepti // -------------------------------------------------------------------------------- void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - } // -------------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - return ::rtl::OUString(); } // -------------------------------------------------------------------------------- void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - } // -------------------------------------------------------------------------------- sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - return 0; } // -------------------------------------------------------------------------------- Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - return NULL; } // -------------------------------------------------------------------------------- @@ -482,8 +444,7 @@ void OConnection::disposing() Reference< XTablesSupplier > xTab = m_xCatalog; if(!m_xCatalog.get().is()) { - OFileCatalog *pCat = new OFileCatalog(this); - xTab = pCat; + xTab = new OFileCatalog(this); m_xCatalog = xTab; } return xTab; @@ -492,13 +453,13 @@ void OConnection::disposing() ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > OConnection::getDir() const { Reference<XDynamicResultSet> xContent; + Sequence< ::rtl::OUString > aProps(1); + ::rtl::OUString* pProps = aProps.getArray(); + pProps[ 0 ] = ::rtl::OUString::createFromAscii( "Title" ); try { Reference<XContentIdentifier> xIdent = getContent()->getIdentifier(); ::ucb::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >()); - Sequence< ::rtl::OUString > aProps(1); - ::rtl::OUString* pProps = aProps.getArray(); - pProps[ 0 ] = ::rtl::OUString::createFromAscii( "Title" ); xContent = aParent.createDynamicCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY ); } catch(Exception&) diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index b149bd1470db..f349590d54f7 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDatabaseMetaData.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-06-28 12:22:16 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,10 +139,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLExc // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUString aVal; - return aVal; + return ::rtl::OUString(); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) @@ -185,30 +182,10 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( Reference< XResultSet > xRef = pResult; pResult->setTablesMap(); - ORows aRows; - - Reference<XDynamicResultSet> xContent = m_pConnection->getDir(); - Reference < XSortedDynamicResultSetFactory > xSRSFac( - m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), UNO_QUERY ); - - Sequence< com::sun::star::ucb::NumberedSortingInfo > aSortInfo( 1 ); - com::sun::star::ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray(); - pInfo[ 0 ].ColumnIndex = 1; - pInfo[ 0 ].Ascending = sal_True; - - Reference < com::sun::star::ucb::XAnyCompareFactory > xFactory; - Reference< com::sun::star::ucb::XDynamicResultSet > xDynamicResultSet; - xDynamicResultSet = xSRSFac->createSortedDynamicResultSet( xContent, aSortInfo, xFactory ); - Reference<XResultSet> xResultSet = xDynamicResultSet->getStaticResultSet(); - - Reference<XRow> xRow(xResultSet,UNO_QUERY); - - String aFilenameExtension = m_pConnection->getExtension(); - // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); sal_Bool bTableFound = sal_True; sal_Int32 nLength = types.getLength(); @@ -230,13 +207,31 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( if(!bTableFound) return xRef; + Reference<XDynamicResultSet> xContent = m_pConnection->getDir(); + Reference < XSortedDynamicResultSetFactory > xSRSFac( + m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), UNO_QUERY ); + + Sequence< com::sun::star::ucb::NumberedSortingInfo > aSortInfo( 1 ); + com::sun::star::ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray(); + pInfo[ 0 ].ColumnIndex = 1; + pInfo[ 0 ].Ascending = sal_True; + + Reference < com::sun::star::ucb::XAnyCompareFactory > xFactory; + Reference< com::sun::star::ucb::XDynamicResultSet > xDynamicResultSet; + xDynamicResultSet = xSRSFac->createSortedDynamicResultSet( xContent, aSortInfo, xFactory ); + Reference<XResultSet> xResultSet = xDynamicResultSet->getStaticResultSet(); + + Reference<XRow> xRow(xResultSet,UNO_QUERY); + + String aFilenameExtension = m_pConnection->getExtension(); + ORows aRows; // scan the directory for tables ::rtl::OUString aName; + INetURLObject aURL; xResultSet->beforeFirst(); while(xResultSet->next()) { aName = xRow->getString(1); - INetURLObject aURL; aURL.SetSmartProtocol(INET_PROT_FILE); aURL.SetSmartURL(aName); ORow aRow(3); @@ -324,85 +319,61 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return STRING_MAXLEN; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 1; } // ------------------------------------------------------------------------- @@ -475,19 +446,22 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( { if(match(tableNamePattern,pBegin->getStr(),'\0')) { - ORow aRow(8); - aRow[0] = ORowSetValue(); - aRow[1] = ORowSetValue(); + static ORow aRow(8); + // aRow[0] = ORowSetValue(); + // aRow[1] = ORowSetValue(); aRow[2] = ORowSetValue(*pBegin); - aRow[3] = ORowSetValue(); - aRow[4] = ORowSetValue(); - aRow[5] = ORowSetValue(); + // aRow[3] = ORowSetValue(); + // aRow[4] = ORowSetValue(); + // aRow[5] = ORowSetValue(); aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("SELECT")); aRow[7] = ORowSetValue(::rtl::OUString::createFromAscii("NO")); // bound row - ORow::iterator aIter = aRow.begin(); - for(;aIter != aRow.end();++aIter) - aIter->setBound(sal_True); + if(!aRow.begin()->isBound()) + { + ORow::iterator aIter = aRow.begin(); + for(;aIter != aRow.end();++aIter) + aIter->setBound(sal_True); + } aRows.push_back(aRow); Reference< XPropertySet> xTable; @@ -544,260 +518,187 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - - return ::rtl::OUString::createFromAscii("\""); + static const ::rtl::OUString sQuote = ::rtl::OUString::createFromAscii("\""); + return sQuote; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- @@ -806,7 +707,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE ::osl::MutexGuard aGuard( m_aMutex ); ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); - Reference< XResultSet > xRef = pResult; + Reference< XResultSet > xRef = pResult; pResult->setTableTypes(); ORows aRows; ORow aRow; @@ -823,484 +724,347 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:file:"); + static const ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:file:"); return aValue; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString::valueOf((sal_Int32)1); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString::valueOf((sal_Int32)0); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_False; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); switch(setType) { case ResultSetType::FORWARD_ONLY: @@ -1316,8 +1080,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - switch(setType) { case ResultSetType::FORWARD_ONLY: @@ -1333,84 +1095,78 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 set // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return sal_False; } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return NULL; } // ------------------------------------------------------------------------- Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle); } diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index a9b037a072c1..24daf46dd121 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDriver.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-05-23 09:13:11 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,13 +148,12 @@ Sequence< ::rtl::OUString > SAL_CALL OFileDriver::getSupportedServiceNames( ) t Reference< XConnection > SAL_CALL OFileDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (ODriver_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(ODriver_BASE::rBHelper.bDisposed); OConnection* pCon = new OConnection(this); + Reference< XConnection > xCon = pCon; pCon->construct(url,info); - Reference< XConnection > xCon = pCon; - m_xConnections.push_back(WeakReferenceHelper(*pCon)); + m_xConnections.push_back(WeakReferenceHelper(*pCon)); return xCon; } @@ -162,16 +161,12 @@ Reference< XConnection > SAL_CALL OFileDriver::connect( const ::rtl::OUString& u sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:file:"),10)) - { - return sal_True; - } - return sal_False; + return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:file:"),10)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) { - return Sequence< DriverPropertyInfo >(); + return Sequence< DriverPropertyInfo >(); } // -------------------------------------------------------------------------------- sal_Int32 SAL_CALL OFileDriver::getMajorVersion( ) throw(RuntimeException) @@ -189,8 +184,7 @@ sal_Int32 SAL_CALL OFileDriver::getMinorVersion( ) throw(RuntimeException) Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - if (ODriver_BASE::rBHelper.bDisposed) - throw DisposedException(); + checkDisposed(ODriver_BASE::rBHelper.bDisposed); Reference< XTablesSupplier > xTab = NULL; Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY); diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 6b6a26086ec0..a6f9fb329f65 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FPreparedStatement.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: oj $ $Date: 2001-07-25 13:05:23 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -211,8 +211,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - Reference< XResultSet > rs = initResultSet(); + initResultSet(); return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT; } @@ -223,8 +222,8 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); + initResultSet(); - Reference< XResultSet > rs = initResultSet(); return m_pResultSet ? m_pResultSet->getRowCountResult() : sal_Int32(0); } // ------------------------------------------------------------------------- @@ -240,7 +239,6 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - return (Reference< XConnection >)m_pConnection; } // ------------------------------------------------------------------------- @@ -250,9 +248,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - Reference< XResultSet > rs = initResultSet(); - return rs; + return initResultSet(); } // ------------------------------------------------------------------------- @@ -305,9 +301,6 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -323,45 +316,30 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::dbtools::setObjectWithInfo(this,parameterIndex,x,sqlType,scale); } // ------------------------------------------------------------------------- @@ -390,29 +368,25 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - throwInvalidIndexException(*this); + setParameter(parameterIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - throwInvalidIndexException(*this); + setBinaryStream(parameterIndex,x,length ); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); + if(!x.is()) + ::dbtools::throwFunctionSequenceException(*this); - throwInvalidIndexException(*this); + Sequence<sal_Int8> aSeq; + x->readSomeBytes(aSeq,length); + setParameter(parameterIndex,aSeq); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 0e05a8452403..32f15f7426a8 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.65 $ + * $Revision: 1.66 $ * - * last change: $Author: oj $ $Date: 2001-07-24 13:17:52 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,6 +99,9 @@ #ifndef _DBHELPER_DBCONVERSION_HXX_ #include "connectivity/dbconversion.hxx" #endif +#ifndef _CONNECTIVITY_DBTOOLS_HXX_ +#include "connectivity/dbtools.hxx" +#endif #ifndef _CPPUHELPER_PROPSHLP_HXX #include <cppuhelper/propshlp.hxx> #endif @@ -286,6 +289,19 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t return i; } // ----------------------------------------------------------------------------- +const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + checkIndex(columnIndex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} +// ----------------------------------------------------------------------------- void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException) { if(columnIndex <= 0 || columnIndex > (sal_Int32)m_xColumns->size()) @@ -297,10 +313,6 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinarySt ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); return NULL; } // ------------------------------------------------------------------------- @@ -309,118 +321,49 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacte ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); return NULL; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - // it could happen that values are updated as string and then called for as getBytes - sal_Int32 nType = (*m_aRow)[columnIndex].getTypeKind(); - if(nType == DataType::VARCHAR) - { - ::rtl::OUString aStr = (*m_aRow)[columnIndex]; - return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aStr.getStr()),sizeof(sal_Unicode)*aStr.getLength()); - } - - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- ::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- @@ -442,13 +385,6 @@ 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 ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - checkIndex(columnIndex ); - - - columnIndex = mapColumn(columnIndex); return sal_Int64(); } // ------------------------------------------------------------------------- @@ -466,13 +402,6 @@ 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 ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); return NULL; } @@ -480,109 +409,45 @@ 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 ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); return NULL; } // ------------------------------------------------------------------------- Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); return NULL; } // ------------------------------------------------------------------------- Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); return NULL; } // ------------------------------------------------------------------------- Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - columnIndex = mapColumn(columnIndex); - return Any(); + return getValue(columnIndex).makeAny(); } // ------------------------------------------------------------------------- sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- - - ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - m_bWasNull = (*m_aRow)[columnIndex].isNull(); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } - // ------------------------------------------------------------------------- - - ::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - - columnIndex = mapColumn(columnIndex); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- - - ::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - return (*m_aRow)[columnIndex]; + return getValue(columnIndex); } // ------------------------------------------------------------------------- @@ -648,48 +513,28 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - return SkipDeleted(OFileTable::FILE_FIRST,1,sal_True); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - // here I know definitely that I stand on the last record return SkipDeleted(OFileTable::FILE_LAST,1,sal_True); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - return SkipDeleted(OFileTable::FILE_ABSOLUTE,row,sal_True); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - return SkipDeleted(OFileTable::FILE_RELATIVE,row,sal_True); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - return SkipDeleted(OFileTable::FILE_PRIOR,0,sal_True); } // ------------------------------------------------------------------------- @@ -776,11 +621,7 @@ sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - if(!m_pTable) - return sal_False; - - return SkipDeleted(OFileTable::FILE_NEXT,1,sal_True); + return m_pTable ? SkipDeleted(OFileTable::FILE_NEXT,1,sal_True) : sal_False; } // ------------------------------------------------------------------------- @@ -796,9 +637,6 @@ sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) @@ -935,186 +773,95 @@ void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeExcept { } // ------------------------------------------------------------------------- - -void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); checkIndex(columnIndex ); - columnIndex = mapColumn(columnIndex); - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex].setNull(); - + (*m_aInsertRow)[columnIndex] = x; } -// ------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- -void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) +void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - checkIndex(columnIndex ); columnIndex = mapColumn(columnIndex); (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + (*m_aInsertRow)[columnIndex].setNull(); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - throw RuntimeException(); + ::dbtools::throwFunctionSequenceException(*this); } // ----------------------------------------------------------------------- void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + updateValue(columnIndex,x); } // ------------------------------------------------------------------------- @@ -1126,63 +873,33 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer if(!x.is()) ::dbtools::throwFunctionSequenceException(*this); - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); Sequence<sal_Int8> aSeq; x->readSomeBytes(aSeq,length); - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = aSeq; + updateValue(columnIndex,aSeq); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - if(!x.is()) - ::dbtools::throwFunctionSequenceException(*this); - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - Sequence<sal_Int8> aSeq; - x->readSomeBytes(aSeq,length); - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = aSeq; + updateBinaryStream(columnIndex,x,length); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - - (*m_aInsertRow)[columnIndex].setBound(sal_True); - (*m_aInsertRow)[columnIndex] = x; + if (!::dbtools::implUpdateObject(this, columnIndex, x)) + throw SQLException(); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - checkIndex(columnIndex ); - - columnIndex = mapColumn(columnIndex); - OSL_ENSURE(0,"OResultSet::updateNumericObject: NYI"); + if (!::dbtools::implUpdateObject(this, columnIndex, x)) + throw SQLException(); } // ------------------------------------------------------------------------- IPropertyArrayHelper* OResultSet::createArrayHelper( ) const @@ -1544,6 +1261,9 @@ Error: //------------------------------------------------------------------ BOOL OResultSet::SkipDeleted(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False; OSL_ENSURE(eCursorPosition != OFileTable::FILE_BOOKMARK,"OResultSet::SkipDeleted can't be called for BOOKMARK"); @@ -2591,8 +2311,7 @@ UINT32 OResultSet::AddParameter(OSQLParseNode * pParameter, const Reference<XPro nNullable = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));; } - Reference<XPropertySet> xParaColumn; - connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(aParameterName + Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(aParameterName ,::rtl::OUString() ,::rtl::OUString() ,nNullable @@ -2603,7 +2322,6 @@ UINT32 OResultSet::AddParameter(OSQLParseNode * pParameter, const Reference<XPro ,sal_False ,sal_False ,m_aSQLIterator.isCaseSensitive()); - xParaColumn = pRet; m_xParamColumns->push_back(xParaColumn); return nParameter; } diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx index 0958cd63bf4d..63bfbe7844d0 100644 --- a/connectivity/source/drivers/file/FResultSetMetaData.cxx +++ b/connectivity/source/drivers/file/FResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSetMetaData.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: oj $ $Date: 2001-05-18 08:31:20 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,22 +99,22 @@ OResultSetMetaData::~OResultSetMetaData() { m_xColumns = NULL; } - -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +// ----------------------------------------------------------------------------- +void OResultSetMetaData::checkColumnIndex(sal_Int32 column) throw(SQLException, RuntimeException) { if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) throwInvalidIndexException(*this); - - return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getPrecision(column); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - + checkColumnIndex(column); return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); } // ------------------------------------------------------------------------- @@ -127,26 +127,19 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, Ru sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - return sal_False; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); + checkColumnIndex(column); Any aName((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); return aName.hasValue() ? getString(aName) : getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); @@ -154,124 +147,92 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw( // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - return m_aTableName; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); + checkColumnIndex(column); return getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - return getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); + return getColumnName(column); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); + checkColumnIndex(column); return getBOOL((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - return getBOOL((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))); + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); return sal_False; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); + checkColumnIndex(column); return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); + checkColumnIndex(column); return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); + checkColumnIndex(column); return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && - ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)))) - return sal_True; - return m_pTable->isReadOnly(); + checkColumnIndex(column); + sal_Bool bReadOnly = (*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && + ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION))); + + return bReadOnly || m_pTable->isReadOnly(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && - ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)))) - return sal_False; - return !m_pTable->isReadOnly(); -; + return !isReadOnly(column); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) { - if(column <= 0 || column > (sal_Int32)m_xColumns->size()) - throwInvalidIndexException(*this); - if((*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) && - ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)))) - return sal_False; - return !m_pTable->isReadOnly(); + return !isReadOnly(column); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 1f7d987fe472..2e68f8f1a596 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FStatement.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-05-23 14:05:53 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -266,10 +266,8 @@ void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - Reference< XResultSet > xRS = executeQuery(sql); + executeQuery(sql); return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT; } diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index cc16846b66b3..9d97a0d9036a 100644 --- a/connectivity/source/drivers/file/fanalyzer.cxx +++ b/connectivity/source/drivers/file/fanalyzer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fanalyzer.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: oj $ $Date: 2001-06-27 10:02:11 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,65 +109,66 @@ void OSQLAnalyzer::setIndexes(const Reference< XNameAccess>& _xIndexes) //------------------------------------------------------------------ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) { - if (!pSQLParseNode) - return; + if (pSQLParseNode) + { - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf WHERE-Klausel setzen: - OSQLParseNode* pWhereClause = NULL; - OSQLParseNode* pOrderbyClause = NULL; + // Parse Tree analysieren (je nach Statement-Typ) + // und Zeiger auf WHERE-Klausel setzen: + OSQLParseNode* pWhereClause = NULL; + OSQLParseNode* pOrderbyClause = NULL; - if (SQL_ISRULE(pSQLParseNode,select_statement)) - { - OSL_ENSURE(pSQLParseNode->count() >= 4,"OFILECursor: Fehler im Parse Tree"); + if (SQL_ISRULE(pSQLParseNode,select_statement)) + { + OSL_ENSURE(pSQLParseNode->count() >= 4,"OFILECursor: Fehler im Parse Tree"); - OSQLParseNode * pTableExp = pSQLParseNode->getChild(3); - OSL_ENSURE(pTableExp != NULL,"Fehler im Parse Tree"); - OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree"); - OSL_ENSURE(pTableExp->count() == 5,"Fehler im Parse Tree"); + OSQLParseNode * pTableExp = pSQLParseNode->getChild(3); + OSL_ENSURE(pTableExp != NULL,"Fehler im Parse Tree"); + OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree"); + OSL_ENSURE(pTableExp->count() == 5,"Fehler im Parse Tree"); - pWhereClause = pTableExp->getChild(1); - pOrderbyClause = pTableExp->getChild(4); - } - else if (SQL_ISRULE(pSQLParseNode,update_statement_searched)) - { - OSL_ENSURE(pSQLParseNode->count() == 5,"OFILECursor: Fehler im Parse Tree"); - pWhereClause = pSQLParseNode->getChild(4); - } - else if (SQL_ISRULE(pSQLParseNode,update_statement_positioned)) - { - // nyi - DBG_ERROR("OPredicateCompiler: update positioned nyi"); - } - else if (SQL_ISRULE(pSQLParseNode,delete_statement_searched)) - { - OSL_ENSURE(pSQLParseNode->count() == 4,"Fehler im Parse Tree"); - pWhereClause = pSQLParseNode->getChild(3); - } - else if (SQL_ISRULE(pSQLParseNode,delete_statement_positioned)) - { - // nyi - DBG_ERROR("OPredicateCompiler: positioned nyi"); - } - else - // Anderes Statement. Keine Selektionskriterien. - return; + pWhereClause = pTableExp->getChild(1); + pOrderbyClause = pTableExp->getChild(4); + } + else if (SQL_ISRULE(pSQLParseNode,update_statement_searched)) + { + OSL_ENSURE(pSQLParseNode->count() == 5,"OFILECursor: Fehler im Parse Tree"); + pWhereClause = pSQLParseNode->getChild(4); + } + else if (SQL_ISRULE(pSQLParseNode,update_statement_positioned)) + { + // nyi + DBG_ERROR("OPredicateCompiler: update positioned nyi"); + } + else if (SQL_ISRULE(pSQLParseNode,delete_statement_searched)) + { + OSL_ENSURE(pSQLParseNode->count() == 4,"Fehler im Parse Tree"); + pWhereClause = pSQLParseNode->getChild(3); + } + else if (SQL_ISRULE(pSQLParseNode,delete_statement_positioned)) + { + // nyi + DBG_ERROR("OPredicateCompiler: positioned nyi"); + } + else + // Anderes Statement. Keine Selektionskriterien. + return; - if (SQL_ISRULE(pWhereClause,where_clause)) - { - // Wenn es aber eine where_clause ist, dann darf sie nicht leer sein: - OSL_ENSURE(pWhereClause->count() == 2,"OFILECursor: Fehler im Parse Tree"); + if (SQL_ISRULE(pWhereClause,where_clause)) + { + // Wenn es aber eine where_clause ist, dann darf sie nicht leer sein: + OSL_ENSURE(pWhereClause->count() == 2,"OFILECursor: Fehler im Parse Tree"); - OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1); - OSL_ENSURE(pComparisonPredicate != NULL,"OFILECursor: Fehler im Parse Tree"); + OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1); + OSL_ENSURE(pComparisonPredicate != NULL,"OFILECursor: Fehler im Parse Tree"); - m_aCompiler.execute(pComparisonPredicate); - } - else - { - // Die Where Clause ist meistens optional, d. h. es koennte sich auch - // um "optional_where_clause" handeln. - OSL_ENSURE(SQL_ISRULE(pWhereClause,opt_where_clause),"OFILECursor: Fehler im Parse Tree"); + m_aCompiler.execute(pComparisonPredicate); + } + else + { + // Die Where Clause ist meistens optional, d. h. es koennte sich auch + // um "optional_where_clause" handeln. + OSL_ENSURE(SQL_ISRULE(pWhereClause,opt_where_clause),"OFILECursor: Fehler im Parse Tree"); + } } } diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index f4a562e27c76..15ef1f2b3ae1 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ETable.cxx,v $ * - * $Revision: 1.32 $ + * $Revision: 1.33 $ * - * last change: $Author: fs $ $Date: 2001-07-17 12:37:19 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -164,6 +164,10 @@ void OFlatTable::fillColumns() } } + m_aTypes.clear(); + m_aPrecisions.clear(); + m_aScales.clear(); + // read first row OFlatString aFirstLine; @@ -340,6 +344,9 @@ void OFlatTable::fillColumns() getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); Reference< XPropertySet> xCol = pColumn; m_aColumns->push_back(xCol); + m_aTypes.push_back(eType); + m_aPrecisions.push_back(nPrecision); + m_aScales.push_back(nScale); } m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); } @@ -365,11 +372,8 @@ OFlatTable::OFlatTable(OFlatConnection* _pConnection, { Any aValue = ConfigManager::GetDirectConfigProperty(ConfigManager::LOCALE); -#if SUPD > 612 LanguageType eLanguage = ConvertIsoStringToLanguage(comphelper::getString(aValue),'-'); -#else - LanguageType eLanguage = ConvertIsoStringToLanguage(comphelper::getString(aValue),'_'); -#endif + String sLanguage, sCountry; ConvertLanguageToIsoNames(eLanguage, sLanguage, sCountry); ::com::sun::star::lang::Locale aAppLocale(sLanguage,sCountry,rtl::OUString()); @@ -436,11 +440,7 @@ String OFlatTable::getEntry() if ((sName == m_Name) && (sExt == sNeededExt)) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); -#if SUPD>611 aURL = xContentAccess->queryContentIdentifierString(); -#else - aURL = xContentAccess->queryContentIdentfierString(); -#endif break; } } @@ -537,93 +537,103 @@ sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (Ru //------------------------------------------------------------------ sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData) { - OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; (*_rRow)[0] = m_nFilePos; if (!bRetrieveData) return TRUE; + OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; sal_Int32 nByteOffset = 1; // Felder: OSQLColumns::const_iterator aIter = _rCols.begin(); for (sal_Int32 i = 1; aIter != _rCols.end();++aIter, i++) { - Reference< XPropertySet> xColumn = *aIter; - - // Laengen je nach Datentyp: - // nyi: eine zentrale Funktion, die die Laenge liefert! - sal_Int32 nLen; - xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen; - sal_Int32 nType = getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); ByteString aStr(m_aCurrentLine.GetToken(i-1,pConnection->getFieldDelimiter(),pConnection->getStringDelimiter())); if (aStr.Len() == 0) (*_rRow)[i].setNull(); - else switch(nType) + else { - case DataType::TIMESTAMP: - case DataType::DATE: - case DataType::TIME: + // Laengen je nach Datentyp: + sal_Int32 nLen, + nType; + if(bIsTable) { - double nRes = 0.0; - try + nLen = m_aPrecisions[i-1]; + nType = m_aTypes[i-1]; + } + else + { + Reference< XPropertySet> xColumn = *aIter; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType; + } + switch(nType) + { + case DataType::TIMESTAMP: + case DataType::DATE: + case DataType::TIME: { - nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,String(aStr, pConnection->getTextEncoding())); - Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY); - com::sun::star::util::Date aDate; - xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; + double nRes = 0.0; + try + { + nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,String(aStr, pConnection->getTextEncoding())); + Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY); + com::sun::star::util::Date aDate; + xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; - switch(nType) + switch(nType) + { + case DataType::DATE: + (*_rRow)[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,aDate)); + break; + case DataType::TIMESTAMP: + (*_rRow)[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,aDate)); + break; + default: + (*_rRow)[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes)); + } + } + catch(Exception&) { - case DataType::DATE: - (*_rRow)[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,aDate)); - break; - case DataType::TIMESTAMP: - (*_rRow)[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,aDate)); - break; - default: - (*_rRow)[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes)); + (*_rRow)[i].setNull(); } - } - catch(Exception&) + } break; + case DataType::DOUBLE: + case DataType::INTEGER: { - (*_rRow)[i].setNull(); - } - } break; - case DataType::DOUBLE: - case DataType::INTEGER: - { - char cDecimalDelimiter = pConnection->getDecimalDelimiter(); - char cThousandDelimiter = pConnection->getThousandDelimiter(); - ByteString aStrConverted; + char cDecimalDelimiter = pConnection->getDecimalDelimiter(); + char cThousandDelimiter = pConnection->getThousandDelimiter(); + ByteString aStrConverted; - OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER || - !cDecimalDelimiter && nType == DataType::INTEGER, - "FalscherTyp"); + OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER || + !cDecimalDelimiter && nType == DataType::INTEGER, + "FalscherTyp"); - // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: - for (xub_StrLen j = 0; j < aStr.Len(); j++) - { - if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter) - aStrConverted += '.'; - else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter) + // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: + for (xub_StrLen j = 0; j < aStr.Len(); j++) { - // weglassen + if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter) + aStrConverted += '.'; + else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter) + { + // weglassen + } + else + aStrConverted += aStr.GetChar(j) ; } - else - aStrConverted += aStr.GetChar(j) ; + double nVal = toDouble(aStrConverted,pConnection->getTextEncoding()); + (*_rRow)[i] = nVal; + } break; + case DataType::DECIMAL: + case DataType::NUMERIC: + default: + { + // Wert als String in Variable der Row uebernehmen + (*_rRow)[i] = String(aStr, pConnection->getTextEncoding()); } - double nVal = toDouble(aStrConverted,pConnection->getTextEncoding()); - (*_rRow)[i] = nVal; - } break; - case DataType::DECIMAL: - case DataType::NUMERIC: - default: - { - // Wert als String in Variable der Row uebernehmen - (*_rRow)[i] = String(aStr, pConnection->getTextEncoding()); + break; } - break; } } return sal_True; @@ -664,19 +674,8 @@ void OFlatTable::AllocBuffer() //------------------------------------------------------------------ double toDouble(const ByteString& rString,rtl_TextEncoding _nTextEncoding) { - static International aInter(LANGUAGE_ENGLISH); - static int nErrno=0; - BOOL bInitialized = sal_False; - if (!bInitialized) - { // ensure that the two members we're interested in are really set - // (if the system doesn't know the locale en_US aIntl would be initialized with the - // system language which may be anything - which we don't want ...) - // 74342 - 21.03.00 - FS - aInter.SetNumThousandSep(','); - aInter.SetNumDecimalSep('.'); - bInitialized = TRUE; - } - return SolarMath::StringToDouble(UniString(rString,_nTextEncoding).GetBuffer(),aInter,nErrno); + int nErrno; + return SolarMath::StringToDouble(UniString(rString,_nTextEncoding).GetBuffer(),',','.',nErrno); } //------------------------------------------------------------------ @@ -684,5 +683,7 @@ BOOL OFlatTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Refere { return sal_True; } +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx index ef7fd022fb83..635f82ab153d 100644 --- a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ADatabaseMetaDataResultSet.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-05-23 09:10:29 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -161,6 +161,7 @@ namespace connectivity inline sal_Int32 mapColumn (sal_Int32 column); void checkRecordSet() throw(::com::sun::star::sdbc::SQLException); + OLEVariant getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); protected: diff --git a/connectivity/source/inc/ado/AResultSet.hxx b/connectivity/source/inc/ado/AResultSet.hxx index f5bfb7c00e4c..62d4c4561416 100644 --- a/connectivity/source/inc/ado/AResultSet.hxx +++ b/connectivity/source/inc/ado/AResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: AResultSet.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-04-30 10:09:04 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -160,6 +160,9 @@ namespace connectivity void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void construct(); + void updateValue(sal_Int32 columnIndex,const OLEVariant& x); + OLEVariant getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); protected: diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx index 6c940bcab856..10312531ce4f 100644 --- a/connectivity/source/inc/ado/adoimp.hxx +++ b/connectivity/source/inc/ado/adoimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: adoimp.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-06-20 07:14:12 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,6 +76,7 @@ namespace connectivity namespace ado { + class WpADOField; class ADOS { public: @@ -127,6 +128,8 @@ namespace connectivity static sal_Int32 mapAdoType2Object(ObjectTypeEnum objType); static sal_Int32 mapAdoRights2Sdbc(RightsEnum eRights); static sal_Int32 mapRights2Ado(sal_Int32 nRights); + + static WpADOField getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); }; @@ -142,17 +145,6 @@ namespace connectivity ADOS::ThrowException(*m_pADOConnection,*this); -#define ADO_GETFIELD(Name) \ - ADOFields* pFields = NULL; \ - m_pRecordSet->get_Fields(&pFields); \ - WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields); \ - if(Name <= 0 || Name > aFields.GetItemCount()) \ - ::dbtools::throwInvalidIndexException(*this); \ - WpADOField aField(aFields.GetItem(Name-1)); \ - if(!aField.IsValid()) \ - ::dbtools::throwInvalidIndexException(*this); - - #endif //_CONNECTIVITY_ADO_ADOIMP_HXX_ diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx index 175e784be6a0..26c7634363b3 100644 --- a/connectivity/source/inc/file/FResultSet.hxx +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSet.hxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: oj $ $Date: 2001-06-28 12:22:36 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -345,6 +345,9 @@ OFILEKeyCompare(const void * elem1, const void * elem2); // return true when the select statement is "select count(*) from table" sal_Bool isCount() const; void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); + + const ORowSetValue& getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); + void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); protected: using OResultSet_BASE::rBHelper; diff --git a/connectivity/source/inc/file/FResultSetMetaData.hxx b/connectivity/source/inc/file/FResultSetMetaData.hxx index 058ee1bbe307..33a3ea9f2c2d 100644 --- a/connectivity/source/inc/file/FResultSetMetaData.hxx +++ b/connectivity/source/inc/file/FResultSetMetaData.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSetMetaData.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: fs $ $Date: 2001-04-12 15:08:51 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,6 +91,7 @@ namespace connectivity ::vos::ORef<connectivity::OSQLColumns> m_xColumns; OFileTable* m_pTable; + void checkColumnIndex(sal_Int32 column) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); public: // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: OResultSetMetaData(const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns,const ::rtl::OUString& _aTableName,OFileTable* _pTable); diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx index 6d76caa25b69..ed0a2958d945 100644 --- a/connectivity/source/inc/flat/ETable.hxx +++ b/connectivity/source/inc/flat/ETable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ETable.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-03-28 11:29:22 $ + * last change: $Author: oj $ $Date: 2001-07-30 08:52:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,12 +102,15 @@ namespace connectivity class OFlatTable : public OFlatTable_BASE { - sal_Int32 m_nRowPos; - sal_Int32 m_nMaxRowCount; // will be set if stream is once eof // maps a row postion to a file position ::std::map<sal_Int32,sal_Int32> m_aRowToFilePos; - OFlatString m_aCurrentLine; + ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset + ::std::vector<sal_Int32> m_aPrecisions; // same as aboth + ::std::vector<sal_Int32> m_aScales; + OFlatString m_aCurrentLine; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter; + sal_Int32 m_nRowPos; + sal_Int32 m_nMaxRowCount; // will be set if stream is once eof public: private: |