oledb32: Implement DataConvert DBTYPE_R8->VARIANT

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Apr 23 04:51:32 CDT 2013


Hi,


Changelog:
     oledb32: Implement DataConvert DBTYPE_R8->VARIANT


Best Regards
  Alistair Leslie-Hughes
-------------- next part --------------
>From 3097fff0447e2cf4240eb4c7170d7c4d2756e9f0 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Thu, 18 Apr 2013 11:59:15 +1000
Subject: [PATCH] Implement DataConvert DBTYPE_R8->VARIANT
To: wine-patches <wine-patches at winehq.org>

---
 dlls/oledb32/convert.c       |    5 +++++
 dlls/oledb32/tests/convert.c |   11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 37ae25e..8525c6c 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -761,6 +761,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
             V_VT(v) = VT_DECIMAL;
             hr = VarDecFromI8( *(LONGLONG*)src,  &V_DECIMAL(v));
             break;
+        case DBTYPE_R8:
+            V_VT(v) = VT_R8;
+            V_R8(v) = *(double*)src;
+            hr = S_OK;
+            break;
         case DBTYPE_BSTR:
         {
             BSTR s = *(WCHAR**)src;
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 2a4caf2..d1f6c4e 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -2536,6 +2536,7 @@ static void test_getconversionsize(void)
 static void test_converttovar(void)
 {
     static WCHAR strW[] = {'t','e','s','t',0};
+    double dvalue = 123.56;
     IDataConvert *convert;
     DBSTATUS dst_status;
     DBLENGTH dst_len;
@@ -2588,6 +2589,16 @@ static void test_converttovar(void)
     V_VT(&dst) = VT_EMPTY;
     dst_len = 0;
     dst_status = DBSTATUS_S_DEFAULT;
+    hr = IDataConvert_DataConvert(convert, DBTYPE_R8, DBTYPE_VARIANT, sizeof(dvalue), &dst_len, &dvalue, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(dst), "got %ld\n", dst_len);
+    ok(V_VT(&dst) == VT_R8, "got %d\n", V_VT(&dst));
+    ok(V_R8(&dst) == 123.56, "got %f\n", V_R8(&dst));
+
+    V_VT(&dst) = VT_EMPTY;
+    dst_len = 0;
+    dst_status = DBSTATUS_S_DEFAULT;
     i4 = 123;
     hr = IDataConvert_DataConvert(convert, DBTYPE_I4, DBTYPE_VARIANT, sizeof(i4), &dst_len, &i4, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
     ok(hr == S_OK, "got %08x\n", hr);
-- 
1.7.10.4



More information about the wine-patches mailing list