summaryrefslogtreecommitdiff
path: root/connectivity/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-11 18:16:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-11 18:42:02 +0000
commit1e0fa85cd32fbfcdfdbda22d232f49cfa68b7a36 (patch)
tree34dab49fcb0398e78fbaf3a19a4accd38dd0a663 /connectivity/source
parent207c9a8f25dd705502608fbf82b4915cd6b62998 (diff)
Replace OLEVariant operators with proper functions, for clarity
* Rename the original getDate (returning double) to getDateAsDouble, to make room for the new getDate (returning css::uno::Date). * Assume the difference between the original 'operator String' (first checking for VT_BSTR, then for isNull()) and getString (first checking for isNull(), only then calling 'operator String') was accidental rather than by design. Change-Id: I6261bdad5c328d6b10e83f2d1664a6c78ec1fed4 Reviewed-on: https://gerrit.libreoffice.org/29705 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/drivers/ado/ACallableStatement.cxx22
-rw-r--r--connectivity/source/drivers/ado/AColumn.cxx6
-rw-r--r--connectivity/source/drivers/ado/AConnection.cxx34
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaData.cxx6
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx6
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx40
-rw-r--r--connectivity/source/drivers/ado/AKeys.cxx2
-rw-r--r--connectivity/source/drivers/ado/APreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx26
-rw-r--r--connectivity/source/drivers/ado/AResultSetMetaData.cxx6
-rw-r--r--connectivity/source/drivers/ado/AStatement.cxx4
-rw-r--r--connectivity/source/drivers/ado/Aolevariant.cxx28
-rw-r--r--connectivity/source/inc/ado/Aolevariant.hxx21
13 files changed, 92 insertions, 111 deletions
diff --git a/connectivity/source/drivers/ado/ACallableStatement.cxx b/connectivity/source/drivers/ado/ACallableStatement.cxx
index 2a627a017673..4c62f8ca97d3 100644
--- a/connectivity/source/drivers/ado/ACallableStatement.cxx
+++ b/connectivity/source/drivers/ado/ACallableStatement.cxx
@@ -61,45 +61,45 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeExc
sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getBool();
}
sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getInt8();
}
Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getByteSequence();
}
css::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getDate();
}
double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getDouble();
}
float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getFloat();
}
sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getInt32();
}
@@ -120,28 +120,28 @@ Any SAL_CALL OCallableStatement::getObject( sal_Int32 /*columnIndex*/, const Ref
sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getInt16();
}
OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getString();
}
css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getTime();
}
css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return m_aValue;
+ return m_aValue.getDateTime();
}
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index 98d865c78547..8f3ddcb364e8 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -244,11 +244,11 @@ void OAdoColumn::fillPropertyValues()
if ( aProps.IsValid() )
{
- m_IsAutoIncrement = static_cast<sal_Bool>( OTools::getValue( aProps, OUString("Autoincrement") ) ) == 1;
+ m_IsAutoIncrement = OTools::getValue( aProps, OUString("Autoincrement") ).getBool() == 1;
- m_Description = OTools::getValue( aProps, OUString("Description") );
+ m_Description = OTools::getValue( aProps, OUString("Description") ).getString();
- m_DefaultValue = OTools::getValue( aProps, OUString("Default") );
+ m_DefaultValue = OTools::getValue( aProps, OUString("Default") ).getString();
}
}
}
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 6894db134678..6b431c55de97 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -139,7 +139,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
OTools::putValue(aProps,OUString("Jet OLEDB:ODBC Parsing"),true);
OLEVariant aVar(OTools::getValue(aProps,OUString("Jet OLEDB:Engine Type")));
if(!aVar.isNull() && !aVar.isEmpty())
- m_nEngineType = aVar;
+ m_nEngineType = aVar.getInt32();
}
buildTypeInfo();
//bErg = TRUE;
@@ -437,30 +437,30 @@ void OConnection::buildTypeInfo() throw( SQLException)
{
sal_Int32 nPos = 1;
OExtendedTypeInfo* aInfo = new OExtendedTypeInfo();
- aInfo->aSimpleType.aTypeName = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->eType = (DataTypeEnum)(sal_Int32)ADOS::getField(pRecordset,nPos++).get_Value();
+ aInfo->aSimpleType.aTypeName = ADOS::getField(pRecordset,nPos++).get_Value().getString();
+ aInfo->eType = (DataTypeEnum)(sal_Int32)ADOS::getField(pRecordset,nPos++).get_Value().getInt32();
if ( aInfo->eType == adWChar && aInfo->aSimpleType.aTypeName == s_sVarChar )
aInfo->eType = adVarWChar;
aInfo->aSimpleType.nType = (sal_Int16)ADOS::MapADOType2Jdbc(static_cast<DataTypeEnum>(aInfo->eType));
- aInfo->aSimpleType.nPrecision = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aLiteralPrefix = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aLiteralSuffix = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aCreateParams = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bNullable = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bCaseSensitive = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.nSearchType = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bUnsigned = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bCurrency = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bAutoIncrement = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aLocalTypeName = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.nMinimumScale = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.nMaximumScale = ADOS::getField(pRecordset,nPos++).get_Value();
+ aInfo->aSimpleType.nPrecision = ADOS::getField(pRecordset,nPos++).get_Value().getInt32();
+ aInfo->aSimpleType.aLiteralPrefix = ADOS::getField(pRecordset,nPos++).get_Value().getString();
+ aInfo->aSimpleType.aLiteralSuffix = ADOS::getField(pRecordset,nPos++).get_Value().getString();
+ aInfo->aSimpleType.aCreateParams = ADOS::getField(pRecordset,nPos++).get_Value().getString();
+ aInfo->aSimpleType.bNullable = ADOS::getField(pRecordset,nPos++).get_Value().getBool();
+ aInfo->aSimpleType.bCaseSensitive = ADOS::getField(pRecordset,nPos++).get_Value().getBool();
+ aInfo->aSimpleType.nSearchType = ADOS::getField(pRecordset,nPos++).get_Value().getInt16();
+ aInfo->aSimpleType.bUnsigned = ADOS::getField(pRecordset,nPos++).get_Value().getBool();
+ aInfo->aSimpleType.bCurrency = ADOS::getField(pRecordset,nPos++).get_Value().getBool();
+ aInfo->aSimpleType.bAutoIncrement = ADOS::getField(pRecordset,nPos++).get_Value().getBool();
+ aInfo->aSimpleType.aLocalTypeName = ADOS::getField(pRecordset,nPos++).get_Value().getString();
+ aInfo->aSimpleType.nMinimumScale = ADOS::getField(pRecordset,nPos++).get_Value().getInt16();
+ aInfo->aSimpleType.nMaximumScale = ADOS::getField(pRecordset,nPos++).get_Value().getInt16();
if ( adCurrency == aInfo->eType && !aInfo->aSimpleType.nMaximumScale)
{
aInfo->aSimpleType.nMinimumScale = 4;
aInfo->aSimpleType.nMaximumScale = 4;
}
- aInfo->aSimpleType.nNumPrecRadix = ADOS::getField(pRecordset,nPos++).get_Value();
+ aInfo->aSimpleType.nNumPrecRadix = ADOS::getField(pRecordset,nPos++).get_Value().getInt16();
// Now that we have the type info, save it
// in the Hashtable if we don't already have an
// entry for this SQL type.
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
index 7ae2f3f3222e..7fbd1b226092 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
@@ -54,7 +54,7 @@ sal_Int32 ODatabaseMetaData::getInt32Property(const OUString& _aProperty) throw
ADO_PROP(_aProperty);
sal_Int32 nValue(0);
if(!aVar.isNull() && !aVar.isEmpty())
- nValue = aVar;
+ nValue = aVar.getInt32();
return nValue;
}
@@ -77,7 +77,7 @@ OUString ODatabaseMetaData::getStringProperty(const OUString& _aProperty) throw
ADO_PROP(_aProperty);
OUString aValue;
if(!aVar.isNull() && !aVar.isEmpty() && aVar.getType() == VT_BSTR)
- aValue = aVar;
+ aValue = aVar.getString();
return aValue;
}
@@ -916,7 +916,7 @@ OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, Runt
WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
WpADOField aField(aFields.GetItem(0));
aField.get_Value(aValue);
- aRet = aRet + (aValue.operator OUString()) + aComma;
+ aRet = aRet + aValue.getString() + aComma;
aRecordset.MoveNext();
}
aRecordset.Close();
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
index e2214a96ff38..8fdcff8fd7ac 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
@@ -63,9 +63,9 @@ void ODatabaseMetaData::fillLiterals()
{
WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
WpADOField aField(aFields.GetItem(1));
- aInfo.pwszLiteralValue = aField.get_Value();
+ aInfo.pwszLiteralValue = aField.get_Value().getString();
aField = aFields.GetItem(5);
- aInfo.fSupported = aField.get_Value();
+ aInfo.fSupported = aField.get_Value().getBool();
aField = aFields.GetItem(6);
aInfo.cchMaxLen = aField.get_Value().getUInt32();
@@ -567,7 +567,7 @@ void OAdoTable::fillPropertyValues()
{
WpADOProperties aProps = m_aTable.get_Properties();
if(aProps.IsValid())
- m_Description = OTools::getValue(aProps,OUString("Description"));
+ m_Description = OTools::getValue(aProps,OUString("Description")).getString();
}
}
}
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
index 575535cf3a54..8c48a60ad31e 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
@@ -177,7 +177,7 @@ Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinar
aField.get_Value(m_aValue);
if(m_aValue.isNull())
return NULL;
- return new SequenceInputStream(m_aValue);
+ return new SequenceInputStream(m_aValue.getByteSequence());
}
Reference< css::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
@@ -194,10 +194,10 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex
if ( !m_aValueRange.empty() && columnIndex == 11 && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end() )
{
getValue(2);
- if ( static_cast<sal_Int16>(m_aValue) != adCurrency )
+ if ( m_aValue.getInt16() != adCurrency )
return sal_False;
}
- return getValue(columnIndex);
+ return getValue(columnIndex).getBool();
}
@@ -212,35 +212,35 @@ sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) t
if(m_aValue.isNull())
return 0;
if ( !m_aValueRange.empty() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (sal_Int8)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
+ return (sal_Int8)(*m_aValueRangeIter).second[m_aValue.getInt32()];
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (sal_Int8)(*m_aStrValueRangeIter).second[m_aValue];
+ return (sal_Int8)(*m_aStrValueRangeIter).second[m_aValue.getString()];
- return m_aValue;
+ return m_aValue.getInt8();
}
Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getByteSequence();
}
css::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDate();
}
double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDouble();
}
float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getFloat();
}
@@ -256,11 +256,11 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) t
return 0;
if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (*m_aValueRangeIter).second[(sal_Int32)m_aValue];
+ return (*m_aValueRangeIter).second[m_aValue.getInt32()];
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (*m_aStrValueRangeIter).second[m_aValue];
+ return (*m_aStrValueRangeIter).second[m_aValue.getString()];
- return m_aValue;
+ return m_aValue.getInt32();
}
@@ -343,11 +343,11 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
return 0;
if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (sal_Int16)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
+ return (sal_Int16)(*m_aValueRangeIter).second[m_aValue.getInt32()];
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (sal_Int16)(*m_aStrValueRangeIter).second[m_aValue];
+ return (sal_Int16)(*m_aStrValueRangeIter).second[m_aValue.getString()];
- return m_aValue;
+ return m_aValue.getInt16();
}
@@ -362,21 +362,21 @@ OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex )
if(m_aValue.isNull())
return OUString();
if(m_aIntValueRange.size() && (m_aIntValueRangeIter = m_aIntValueRange.find(columnIndex)) != m_aIntValueRange.end())
- return (*m_aIntValueRangeIter).second[m_aValue];
+ return (*m_aIntValueRangeIter).second[m_aValue.getInt32()];
- return m_aValue;
+ return m_aValue.getString();
}
css::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDateTime();
}
diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx
index 95d2ca0a72a6..b03836fb9976 100644
--- a/connectivity/source/drivers/ado/AKeys.cxx
+++ b/connectivity/source/drivers/ado/AKeys.cxx
@@ -99,7 +99,7 @@ sdbcx::ObjectType OKeys::appendObject( const OUString&, const Reference< XProper
// XDrop
void OKeys::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
{
- if(!m_aCollection.Delete(OLEVariant(_sElementName)))
+ if(!m_aCollection.Delete(OLEVariant(_sElementName).getString()))
ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
}
diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx
index b915a38e01ac..bd7d4206b9fd 100644
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ b/connectivity/source/drivers/ado/APreparedStatement.cxx
@@ -180,7 +180,7 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run
throw SQLException();
}
m_RecordSet = WpADORecordset(pSet);
- return static_cast<sal_Int32>(m_RecordsAffected);
+ return m_RecordsAffected.getInt32();
}
void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType,
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index 77849f023272..128458bcaa4f 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -204,7 +204,7 @@ Reference< css::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int
// else we ask for a bytesequence
aField.get_Value(m_aValue);
- return m_aValue.isNull() ? NULL : new ::comphelper::SequenceInputStream(m_aValue);
+ return m_aValue.isNull() ? NULL : new ::comphelper::SequenceInputStream(m_aValue.getByteSequence());
}
Reference< css::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
@@ -225,43 +225,43 @@ OLEVariant OResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, Runt
sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getBool();
}
sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt8();
}
Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getByteSequence();
}
css::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDate();
}
double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDouble();
}
float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getFloat();
}
sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt32();
}
@@ -331,25 +331,25 @@ Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< css:
sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt16();
}
OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getString();
}
css::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return getValue(columnIndex);
+ return getValue(columnIndex).getDateTime();
}
@@ -903,7 +903,7 @@ sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw(SQLException, Runtim
sal_Bool bValue(sal_False);
if(!aVar.isNull() && !aVar.isEmpty())
- bValue = aVar;
+ bValue = aVar.getBool();
return bValue;
}
diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
index c529e16321d4..a1140a658c05 100644
--- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
@@ -84,7 +84,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(
{
WpADOProperties aProps( aField.get_Properties() );
if ( aProps.IsValid() )
- bRet = OTools::getValue( aProps, OUString("ISCASESENSITIVE") );
+ bRet = OTools::getValue( aProps, OUString("ISCASESENSITIVE") ).getBool();
}
return bRet;
}
@@ -114,7 +114,7 @@ OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQL
{
WpADOProperties aProps( aField.get_Properties() );
if ( aProps.IsValid() )
- sTableName = OTools::getValue( aProps, OUString("BASETABLENAME") );
+ sTableName = OTools::getValue( aProps, OUString("BASETABLENAME") ).getString();
}
return sTableName;
}
@@ -160,7 +160,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(
WpADOProperties aProps( aField.get_Properties() );
if ( aProps.IsValid() )
{
- bRet = OTools::getValue( aProps, OUString("ISAUTOINCREMENT") );
+ bRet = OTools::getValue( aProps, OUString("ISAUTOINCREMENT") ).getBool();
}
}
return bRet;
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx
index aaeda5bdcf09..e1c178d7b604 100644
--- a/connectivity/source/drivers/ado/AStatement.cxx
+++ b/connectivity/source/drivers/ado/AStatement.cxx
@@ -195,7 +195,7 @@ sal_Int32 OStatement_Base::getRowCount () throw( SQLException)
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return m_RecordsAffected;
+ return m_RecordsAffected.getInt32();
}
// getPrecision
@@ -408,7 +408,7 @@ sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const OUString& sql ) throw(S
m_aLastWarning = ex;
}
if(!m_RecordsAffected.isEmpty() && !m_RecordsAffected.isNull() && m_RecordsAffected.getType() != VT_ERROR)
- return m_RecordsAffected;
+ return m_RecordsAffected.getInt32();
return 0;
}
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx
index 6556fc607e92..93fabdbe1115 100644
--- a/connectivity/source/drivers/ado/Aolevariant.cxx
+++ b/connectivity/source/drivers/ado/Aolevariant.cxx
@@ -333,17 +333,17 @@ sal_Bool OLEVariant::isEmpty() const { return (vt == VT_EMPTY); }
VARTYPE OLEVariant::getType() const { return vt; }
-OLEVariant::operator css::util::Date() const
+css::util::Date OLEVariant::getDate() const
{
- return isNull() ? css::util::Date(30,12,1899) : ::dbtools::DBTypeConversion::toDate(getDate(),css::util::Date(30,12,1899));
+ return isNull() ? css::util::Date(30,12,1899) : ::dbtools::DBTypeConversion::toDate(getDateAsDouble(),css::util::Date(30,12,1899));
}
-OLEVariant::operator css::util::Time() const
+css::util::Time OLEVariant::getTime() const
{
- return isNull() ? css::util::Time() : ::dbtools::DBTypeConversion::toTime(getDate());
+ return isNull() ? css::util::Time() : ::dbtools::DBTypeConversion::toTime(getDateAsDouble());
}
-OLEVariant::operator css::util::DateTime()const
+css::util::DateTime OLEVariant::getDateTime() const
{
- return isNull() ? css::util::DateTime() : ::dbtools::DBTypeConversion::toDateTime(getDate(),css::util::Date(30,12,1899));
+ return isNull() ? css::util::DateTime() : ::dbtools::DBTypeConversion::toDateTime(getDateAsDouble(),css::util::Date(30,12,1899));
}
VARIANT_BOOL OLEVariant::VariantBool(sal_Bool bEinBoolean)
@@ -374,7 +374,7 @@ void OLEVariant::set(double n)
}
}
-OLEVariant::operator OUString() const
+OUString OLEVariant::getString() const
{
if (V_VT(this) == VT_BSTR)
return reinterpret_cast<const sal_Unicode*>(LPCOLESTR(V_BSTR(this)));
@@ -421,7 +421,7 @@ void OLEVariant::ChangeType(VARTYPE vartype, const OLEVariant* pSrc)
}
-OLEVariant::operator css::uno::Sequence< sal_Int8 >() const
+css::uno::Sequence< sal_Int8 > OLEVariant::getByteSequence() const
{
css::uno::Sequence< sal_Int8 > aRet;
if(V_VT(this) == VT_BSTR)
@@ -462,14 +462,6 @@ OLEVariant::operator css::uno::Sequence< sal_Int8 >() const
return aRet;
}
-OUString OLEVariant::getString() const
-{
- if(isNull())
- return OUString();
- else
- return *this;
-}
-
sal_Bool OLEVariant::getBool() const
{
if (V_VT(this) == VT_BOOL)
@@ -620,7 +612,7 @@ double OLEVariant::getDouble() const
return V_R8(&varDest);
}
-double OLEVariant::getDate() const
+double OLEVariant::getDateAsDouble() const
{
if (V_VT(this) == VT_DATE)
return V_DATE(this);
@@ -695,7 +687,7 @@ css::uno::Any OLEVariant::makeAny() const
}
case VT_DATE:
{
- aValue <<= (css::util::Date)*this;
+ aValue <<= getDate();
break;
}
case VT_BSTR:
diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx
index e300128a8567..82d6fabb2efa 100644
--- a/connectivity/source/inc/ado/Aolevariant.hxx
+++ b/connectivity/source/inc/ado/Aolevariant.hxx
@@ -123,21 +123,6 @@ namespace connectivity
VARTYPE getType() const ;
void ChangeType(VARTYPE vartype, const OLEVariant* pSrc);
-
- operator OUString() const;
-
- operator bool() const { return getBool() == 1; }
- operator sal_Bool() const { return getBool(); }
- operator sal_Int8() const { return getInt8(); }
- operator sal_Int16() const { return getInt16(); }
- operator sal_Int32() const { return getInt32(); }
- operator float() const { return getFloat(); }
- operator double() const { return getDouble(); }
-
- operator css::uno::Sequence< sal_Int8 >() const;
- operator css::util::Date() const ;
- operator css::util::Time() const ;
- operator css::util::DateTime()const ;
OUString getString() const;
sal_Bool getBool() const;
IUnknown* getIUnknown() const;
@@ -149,8 +134,12 @@ namespace connectivity
sal_uInt32 getUInt32() const;
float getFloat() const;
double getDouble() const;
- double getDate() const;
+ double getDateAsDouble() const;
CY getCurrency() const;
+ css::util::Date getDate() const;
+ css::util::Time getTime() const;
+ css::util::DateTime getDateTime() const;
+ css::uno::Sequence<sal_Int8> getByteSequence() const;
SAFEARRAY* getUI1SAFEARRAYPtr() const;
css::uno::Any makeAny() const;