diff options
author | Ocke Janssen <oj@openoffice.org> | 2002-08-26 11:38:27 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2002-08-26 11:38:27 +0000 |
commit | 0f2ad440ae28f1b08b3e62297d76e3e782bda222 (patch) | |
tree | 2c224ed5fe6336164bd3b100fb9e7b71ee3a67ed /connectivity/source/drivers/ado/Aolevariant.cxx | |
parent | 06f10623d01262f4c6015ebd0c7e9373bcc9de16 (diff) |
#98671# change type for sequence to VARBINARY
Diffstat (limited to 'connectivity/source/drivers/ado/Aolevariant.cxx')
-rw-r--r-- | connectivity/source/drivers/ado/Aolevariant.cxx | 138 |
1 files changed, 114 insertions, 24 deletions
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx index b7923f7f7dfa..fd1070fdebd7 100644 --- a/connectivity/source/drivers/ado/Aolevariant.cxx +++ b/connectivity/source/drivers/ado/Aolevariant.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Aolevariant.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: fs $ $Date: 2002-01-18 16:33:01 $ + * last change: $Author: oj $ $Date: 2002-08-26 12:35:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -145,12 +145,14 @@ OLEVariant::OLEVariant() OLEVariant::OLEVariant(const VARIANT& varSrc) { ::VariantInit(this); - ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); + HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); + OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!"); } OLEVariant::OLEVariant(const OLEVariant& varSrc) { ::VariantInit(this); - ::VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))); + HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))); + OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!"); } OLEVariant::OLEVariant(sal_Bool x) { VariantInit(this); vt = VT_BOOL; boolVal = (x ? VARIANT_TRUE : VARIANT_FALSE);} @@ -167,7 +169,8 @@ OLEVariant::OLEVariant(const rtl::OUString& us) } OLEVariant::~OLEVariant() { - ::VariantClear(this); + HRESULT eRet = ::VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); } // clears all the memory that was allocated before OLEVariant::OLEVariant(const ::com::sun::star::util::Date& x ) @@ -221,14 +224,16 @@ OLEVariant::OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x) OLEVariant& OLEVariant::operator=(const OLEVariant& varSrc) { - VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))); + HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))); + OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!"); return *this; } // Assign a const VARIANT& (::VariantCopy handles everything) // OLEVariant& OLEVariant::operator=(const tagVARIANT& varSrc) { - ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); + HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); + OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!"); return *this; } @@ -237,35 +242,120 @@ OLEVariant& OLEVariant::operator=(const tagVARIANT& varSrc) // OLEVariant& OLEVariant::operator=(const VARIANT* pSrc) { - ::VariantCopy(this, const_cast<VARIANT*>(pSrc)); + HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(pSrc)); + OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!"); return *this; } -void OLEVariant::setByte(sal_uInt8 n) { VariantClear(this); vt = VT_UI1; bVal = n;} -void OLEVariant::setInt16(sal_Int16 n) { VariantClear(this); vt = VT_I2; iVal = n;} -void OLEVariant::setInt32(sal_Int32 n) { VariantClear(this); vt = VT_I4; lVal = n;} -void OLEVariant::setFloat(float f) { VariantClear(this); vt = VT_R4; fltVal = f;} -void OLEVariant::setDouble(double d) { VariantClear(this); vt = VT_R8; dblVal = d;} -void OLEVariant::setDate(DATE d) { VariantClear(this); vt = VT_DATE; date = d;} -void OLEVariant::setChar(unsigned char a) { VariantClear(this); vt = VT_UI1; bVal = a;} -void OLEVariant::setCurrency(double aCur) { VariantClear(this); vt = VT_CY; set(aCur*10000);} -void OLEVariant::setBool(sal_Bool b) { VariantClear(this); vt = VT_BOOL; boolVal = b ? VARIANT_TRUE : VARIANT_FALSE;} -void OLEVariant::setString(const rtl::OUString& us){ VariantClear(this); vt = VT_BSTR; bstrVal = ::SysAllocString(us);} -void OLEVariant::setNoArg() { VariantClear(this); vt = VT_ERROR; scode = DISP_E_PARAMNOTFOUND;} +void OLEVariant::setByte(sal_uInt8 n) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_UI1; + bVal = n; +} +void OLEVariant::setInt16(sal_Int16 n) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_I2; + iVal = n; +} +void OLEVariant::setInt32(sal_Int32 n) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_I4; + lVal = n; +} +void OLEVariant::setFloat(float f) +{ HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_R4; + fltVal = f; +} +void OLEVariant::setDouble(double d) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_R8; + dblVal = d; +} +void OLEVariant::setDate(DATE d) +{ HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_DATE; + date = d; +} +void OLEVariant::setChar(unsigned char a) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_UI1; + bVal = a; +} +void OLEVariant::setCurrency(double aCur) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_CY; + set(aCur*10000); +} +void OLEVariant::setBool(sal_Bool b) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_BOOL; + boolVal = b ? VARIANT_TRUE : VARIANT_FALSE; +} +void OLEVariant::setString(const rtl::OUString& us) +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_BSTR; + bstrVal = ::SysAllocString(us); +} +void OLEVariant::setNoArg() +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_ERROR; + scode = DISP_E_PARAMNOTFOUND; +} -void OLEVariant::setNull() { VariantClear(this); vt = VT_NULL;} -void OLEVariant::setEmpty() { VariantClear(this); vt = VT_EMPTY;} +void OLEVariant::setNull() +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_NULL; +} +void OLEVariant::setEmpty() +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_EMPTY; +} void OLEVariant::setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr) - { VariantClear(this); vt = VT_ARRAY|VT_UI1; parray = pSafeAr; } +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_ARRAY|VT_UI1; parray = pSafeAr; +} void OLEVariant::setArray(SAFEARRAY* pSafeArray, VARTYPE vtType) - { VariantClear(this); vt = VT_ARRAY|vtType; parray = pSafeArray; } +{ + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); + vt = VT_ARRAY|vtType; + parray = pSafeArray; +} void OLEVariant::setIDispatch(IDispatch* pDispInterface) { - VariantClear(this); + HRESULT eRet = VariantClear(this); + OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!"); vt = VT_DISPATCH; pdispVal = pDispInterface; |