oledb32: Support VT_NULL when converting to DBTYPE_BSTR
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Fri May 17 02:38:16 CDT 2013
Hi,
Changelog:
oledb32: Support VT_NULL when converting to DBTYPE_BSTR
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From 73d76d75d89d9ed9630bd983b5f175180bf6405a Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri, 17 May 2013 12:21:12 +1000
Subject: [PATCH] Support VT_NULL when converting to DBTYPE_BSTR
To: wine-patches <wine-patches at winehq.org>
---
dlls/oledb32/convert.c | 19 +++++++++++++++----
dlls/oledb32/tests/convert.c | 8 ++++++++
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 19f46f6..0cd9e53 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -534,10 +534,21 @@ 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);
- break;
+ {
+ 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;
}
break;
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)
--
1.8.1.2
More information about the wine-patches
mailing list