Alistair Leslie-Hughes : oledb32: Support VT_NULL when converting to DBTYPE_BSTR.
Alexandre Julliard
julliard at winehq.org
Fri May 17 14:24:34 CDT 2013
Module: wine
Branch: master
Commit: d3c3a38f692756b73b9bb1cedbcf22dcbea8be7c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d3c3a38f692756b73b9bb1cedbcf22dcbea8be7c
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri May 17 12:21:12 2013 +1000
oledb32: Support VT_NULL when converting to DBTYPE_BSTR.
---
dlls/oledb32/convert.c | 15 ++++++++++++---
dlls/oledb32/tests/convert.c | 8 ++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 19f46f6..af603e4 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -534,9 +534,18 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
}
break;
case DBTYPE_VARIANT:
- VariantInit(&tmp);
- if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_BSTR)) == S_OK)
- *d = V_BSTR(&tmp);
+ if(V_VT((VARIANT*)src) == VT_NULL)
+ {
+ *dst_status = DBSTATUS_S_ISNULL;
+ *dst_len = get_length(DBTYPE_BSTR);
+ return S_OK;
+ }
+ else
+ {
+ VariantInit(&tmp);
+ if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_BSTR)) == S_OK)
+ *d = V_BSTR(&tmp);
+ }
break;
default: FIXME("Unimplemented conversion %04x -> BSTR\n", src_type); return E_NOTIMPL;
}
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 90e1658..6f02899 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -977,6 +977,14 @@ static void test_converttobstr(void)
ok(!lstrcmpW(b, dst), "got %s\n", wine_dbgstr_w(dst));
SysFreeString(dst);
SysFreeString(b);
+
+ V_VT(&v) = VT_NULL;
+ dst = (void*)0x1234;
+ hr = IDataConvert_DataConvert(convert, DBTYPE_VARIANT, DBTYPE_BSTR, 0, &dst_len, &v, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(dst_status == DBSTATUS_S_ISNULL, "got %08x\n", dst_status);
+ ok(dst_len == sizeof(BSTR), "got %ld\n", dst_len);
+ ok(dst == (void*)0x1234, "got %p\n", dst);
}
static void test_converttowstr(void)
More information about the wine-cvs
mailing list