[PATCH 3/3] oledb32: Add DataConvert support of DBTYPE_VARIANT(NULL) to DBTYPE_I4

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Sep 15 04:54:38 CDT 2015


---
 dlls/oledb32/convert.c       | 13 +++++++++++++
 dlls/oledb32/tests/convert.c |  8 ++++++++
 2 files changed, 21 insertions(+)

diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 56de3fb..5123ac2 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -293,6 +293,19 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
             VariantInit(&tmp);
             if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_I4)) == S_OK)
                 *d = V_I4(&tmp);
+            else
+            {
+                if( V_VT((VARIANT*)src) == VT_NULL)
+                {
+                    *dst_status = DBSTATUS_S_ISNULL;
+                    return S_OK;
+                }
+                else
+                {
+                    FIXME("Unimplemented variant type %d -> I4\n", V_VT((VARIANT*)src));
+                    return E_NOTIMPL;
+                }
+            }
             break;
         default: FIXME("Unimplemented conversion %04x -> I4\n", src_type); return E_NOTIMPL;
         }
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index c695238..ec344b4 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -765,6 +765,14 @@ static void test_converttoi4(void)
     ok(i4 == 0x1234, "got %08x\n", i4);
 
     i4 = 0x12345678;
+    V_VT((VARIANT*)src) = VT_NULL;
+    dst_len = 0x1234;
+    hr = IDataConvert_DataConvert(convert, DBTYPE_VARIANT, DBTYPE_I4, 0, &dst_len, src, &i4, sizeof(i4), 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 == 4660, "got %ld\n", dst_len);
+
+    i4 = 0x12345678;
     memset(src, 0, sizeof(DECIMAL));
     ((DECIMAL*)src)->u1.Lo64 = 0x1234;
     dst_len = 0x1234;
-- 
2.5.1




More information about the wine-patches mailing list