diff options
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/commontools/FValue.cxx | 107 | ||||
-rw-r--r-- | connectivity/source/drivers/ado/AResultSet.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/ETable.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HStorageAccess.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HStorageMap.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/Boolean.cxx | 17 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/Object.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/String.cxx | 20 | ||||
-rw-r--r-- | connectivity/source/inc/java/lang/Boolean.hxx | 1 | ||||
-rw-r--r-- | connectivity/source/inc/java/lang/Object.hxx | 2 | ||||
-rw-r--r-- | connectivity/source/inc/java/lang/String.hxx | 1 |
13 files changed, 109 insertions, 88 deletions
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 2884e6179aaa..aca181916b47 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -258,6 +258,7 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType) (*this) = getAny(); break; default: + (*this) = getAny(); OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); } } @@ -344,6 +345,19 @@ void ORowSetValue::free() TRACE_FREE( Any ) m_aValue.m_pValue = NULL; break; + case DataType::BIT: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::BOOLEAN: + break; + default: + if ( m_aValue.m_pValue ) + { + delete (Any*)m_aValue.m_pValue; + TRACE_FREE( Any ) + m_aValue.m_pValue = NULL; + } + break; } m_bNull = sal_True; @@ -849,7 +863,9 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const bRet = false; break; default: + bRet = false; OSL_ENSURE(0,"ORowSetValue::operator==(): UNSPUPPORTED TYPE!"); + break; } return bRet; } @@ -942,6 +958,8 @@ Any ORowSetValue::makeAny() const break; default: OSL_ENSURE(0,"ORowSetValue::makeAny(): UNSPUPPORTED TYPE!"); + rValue = getAny(); + break; } } return rValue; @@ -1032,6 +1050,12 @@ Any ORowSetValue::makeAny() const } } break; + default: + { + Any aValue = getAny(); + aValue >>= aRet; + break; + } } } return aRet; @@ -1104,8 +1128,11 @@ sal_Bool ORowSetValue::getBool() const bRet = m_bSigned ? (m_aValue.m_nInt32 != 0) : (*static_cast<sal_Int64*>(m_aValue.m_pValue) != sal_Int64(0)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= bRet; + break; + } } } return bRet; @@ -1174,8 +1201,11 @@ sal_Int8 ORowSetValue::getInt8() const nRet = static_cast<sal_Int8>(*static_cast<sal_Int64*>(m_aValue.m_pValue)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1244,8 +1274,11 @@ sal_Int16 ORowSetValue::getInt16() const nRet = static_cast<sal_Int16>(*static_cast<sal_Int64*>(m_aValue.m_pValue)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1314,8 +1347,11 @@ sal_Int32 ORowSetValue::getInt32() const nRet = static_cast<sal_Int32>(*static_cast<sal_Int64*>(m_aValue.m_pValue)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1384,8 +1420,11 @@ sal_Int64 ORowSetValue::getLong() const nRet = *(sal_Int64*)m_aValue.m_pValue; break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1458,8 +1497,11 @@ float ORowSetValue::getFloat() const nRet = float(*(sal_Int64*)m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1534,8 +1576,11 @@ double ORowSetValue::getDouble() const nRet = double(*(sal_Int64*)m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1626,6 +1671,11 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) TRACE_ALLOC( sal_Int64 ) } break; + default: + { + m_aValue.m_pValue = new Any(_rVal); + break; + } } m_eTypeKind = _nDatatype; } @@ -1692,7 +1742,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const aSeq = *static_cast< Sequence<sal_Int8>*>(m_aValue.m_pValue); break; default: - ; + { + Any aValue = getAny(); + aValue >>= aSeq; + break; + } } } return aSeq; @@ -1734,8 +1788,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const } break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aAnyValue = getAny(); + aAnyValue >>= aValue; + break; + } } } return aValue; @@ -1776,8 +1833,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const aValue = *static_cast< ::com::sun::star::util::Time*>(m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aAnyValue = getAny(); + aAnyValue >>= aValue; + break; + } } } return aValue; @@ -1826,8 +1886,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const aValue = *static_cast< ::com::sun::star::util::DateTime*>(m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aAnyValue = getAny(); + aAnyValue >>= aValue; + break; + } } } return aValue; @@ -2094,7 +2157,7 @@ void ORowSetValue::impl_fill( const sal_Int32 _nType, sal_Bool _bNullable, const break; default: OSL_ENSURE( false, "ORowSetValue::fill: unsupported type!" ); - bReadData = false; + (*this) = _rValueSource.getObject(); break; } if ( bReadData && _bNullable && _rValueSource.wasNull() ) diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index c71d620d527c..0c5db12c3355 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -692,6 +692,10 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeExcept void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { + // ::osl::MutexGuard aGuard( m_aMutex ); + //checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + // if ( getResultSetConcurrency() == ResultSetConcurrency::READ_ONLY ) + // throw SQLException(); } // ------------------------------------------------------------------------- @@ -977,7 +981,7 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& ro sal_Int32 OResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - sal_Int32 nValue=0; + sal_Int32 nValue=ResultSetConcurrency::READ_ONLY; LockTypeEnum eRet; if(!SUCCEEDED(m_pRecordSet->get_LockType(&eRet))) { diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 8544e4affda7..157d1f7b68fa 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2607,7 +2607,7 @@ void ODbaseTable::throwInvalidDbaseFormat() // no dbase file const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( - STR_SQL_NAME_ERROR, + STR_INVALID_DBASE_FILE, "$filename$", getEntry(m_pConnection,m_Name) ) ); ::dbtools::throwGenericSQLException( sError, *this ); diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 265084be697f..421225b34935 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -1200,7 +1200,9 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, break; } - if (m_nRowPos == 0) + if ( m_nRowPos < 0 ) + goto Error; + else if (m_nRowPos == 0) { // COUNT(*) in Ergebnisrow packen // (muss die erste und einzige Variable in der Row sein) diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index eff2464ce533..70be592405eb 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -159,7 +159,10 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) { bNumeric = FALSE; - nStartPosFirstLine2 = nStartPosFirstLine; + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + else + nStartPosFirstLine2 = nStartPosFirstLine; } else { diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx index 1452df992a74..e7fab6acb6c0 100644 --- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx @@ -234,7 +234,7 @@ jint read_from_storage_stream_into_buffer( JNIEnv * env, jobject /*obj_this*/,js if ( xIn.is() ) { jsize nLen = env->GetArrayLength(buffer); - if ( nLen < len ) + if ( nLen < len || len <= 0 ) { ThrowException( env, "java/io/IOException", @@ -439,21 +439,17 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst if ( xOut.is() ) { jbyte *buf = env->GetByteArrayElements(buffer,NULL); -#ifdef HSQLDB_DBG - OSL_ENSURE(len <= env->GetArrayLength(buffer),"Length is greater than the buffer!"); -#endif - if (JNI_FALSE != env->ExceptionCheck()) { env->ExceptionClear(); OSL_ENSURE(0,"ExceptionClear"); } OSL_ENSURE(buf,"buf is NULL"); - if ( buf ) + if ( buf && len > 0 && len <= env->GetArrayLength(buffer)) { Sequence< ::sal_Int8 > aData(buf + off,len); - xOut->writeBytes(aData); env->ReleaseByteArrayElements(buffer, buf, JNI_ABORT); + xOut->writeBytes(aData); #ifdef HSQLDB_DBG if ( logger ) logger->write( aData.getConstArray(), len ); diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx index afb4d0da2640..57ed88b1dda8 100644 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx @@ -61,14 +61,15 @@ namespace connectivity { try { - m_xStream.clear(); - m_xSeek.clear(); + m_xStream.clear(); + m_xSeek.clear(); if ( m_xInputStream.is() ) { m_xInputStream->closeInput(); - m_xInputStream.clear(); + m_xInputStream.clear(); } - if ( m_xOutputStream.is() ) + // this is done implicity by the closing of the input stream + else if ( m_xOutputStream.is() ) { m_xOutputStream->closeOutput(); try @@ -83,11 +84,12 @@ namespace connectivity OSL_UNUSED( e ); OSL_ENSURE(0,"Could not dispose OutputStream"); } - m_xOutputStream.clear(); + m_xOutputStream.clear(); } } - catch(Exception& ) + catch(Exception& ex) { + OSL_UNUSED( ex ); OSL_ENSURE(0,"Exception catched!"); } } diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx index 2df75283a14b..fd52f3092c0e 100644 --- a/connectivity/source/drivers/jdbc/Boolean.cxx +++ b/connectivity/source/drivers/jdbc/Boolean.cxx @@ -49,20 +49,3 @@ jclass java_lang_Boolean::getMyClass() const { return st_getMyClass(); } - -java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL ) -{ - SDBThreadAttach t; - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren - static const char * cSignature = "(Z)V"; - jobject tempObj; - static jmethodID mID(NULL); - obtainMethodId(t.pEnv, "<init>",cSignature, mID); - tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 ); - saveRef( t.pEnv, tempObj ); - t.pEnv->DeleteLocalRef( tempObj ); - // und aufraeumen -} - - diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 4866781d23dd..4f5670ace8aa 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -166,14 +166,6 @@ void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj ) } -java_lang_Class * java_lang_Object::getClass() -{ - SDBThreadAttach t; - static jmethodID mID(NULL); - jobject out = callObjectMethod(t.pEnv,"getClass","()Ljava/lang/Class;", mID); - return out ? new java_lang_Class( t.pEnv, out ) : NULL; -} - ::rtl::OUString java_lang_Object::toString() const { static jmethodID mID(NULL); diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx index e6102fc3a471..f32b0cce4325 100644 --- a/connectivity/source/drivers/jdbc/String.cxx +++ b/connectivity/source/drivers/jdbc/String.cxx @@ -52,26 +52,6 @@ jclass java_lang_String::st_getMyClass() } //-------------------------------------------------------------------------- -java_lang_String::java_lang_String( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL ) -{ - SDBThreadAttach t; - if( !t.pEnv ) - return; - jvalue args[1]; - // Parameter konvertieren - args[0].l = convertwchar_tToJavaString(t.pEnv,_par0); - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)V"; - jobject tempObj; - static jmethodID mID(NULL); - obtainMethodId(t.pEnv, "<init>",cSignature, mID); - tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); - saveRef( t.pEnv, tempObj ); - t.pEnv->DeleteLocalRef( tempObj ); - t.pEnv->DeleteLocalRef((jstring)args[0].l); -} -//-------------------------------------------------------------------------- java_lang_String::operator ::rtl::OUString() { SDBThreadAttach t; diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx index f1f8081d9780..35655f8c1934 100644 --- a/connectivity/source/inc/java/lang/Boolean.hxx +++ b/connectivity/source/inc/java/lang/Boolean.hxx @@ -44,7 +44,6 @@ namespace connectivity // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_Boolean( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} - java_lang_Boolean( sal_Bool _par0 ); static jclass st_getMyClass(); }; } diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx index f0bacc2ee840..c00c5e67e06d 100644 --- a/connectivity/source/inc/java/lang/Object.hxx +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -118,8 +118,6 @@ namespace connectivity void clearObject(JNIEnv& rEnv); void clearObject(); - java_lang_Class * getClass(); - virtual ::rtl::OUString toString() const; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xFactory; } diff --git a/connectivity/source/inc/java/lang/String.hxx b/connectivity/source/inc/java/lang/String.hxx index 64584dab5e76..3e4bfd6c1399 100644 --- a/connectivity/source/inc/java/lang/String.hxx +++ b/connectivity/source/inc/java/lang/String.hxx @@ -42,7 +42,6 @@ namespace connectivity // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_String( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} - java_lang_String( const ::rtl::OUString& _par0 ); operator ::rtl::OUString(); static jclass st_getMyClass(); |