Alistair Leslie-Hughes : oledb32: Implement DataConvert DBTYPE_DBDATE-> DBTYPE_VARIANT.

Alexandre Julliard julliard at winehq.org
Thu May 16 13:55:06 CDT 2013


Module: wine
Branch: master
Commit: 1527eeb720ef0d42a62a7ccb93b088f2d05c70a0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1527eeb720ef0d42a62a7ccb93b088f2d05c70a0

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Thu May 16 15:12:51 2013 +1000

oledb32: Implement DataConvert DBTYPE_DBDATE->DBTYPE_VARIANT.

---

 dlls/oledb32/convert.c       |   17 +++++++++++++++++
 dlls/oledb32/tests/convert.c |    9 +++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 78f6c46..19f46f6 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -797,6 +797,23 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
             V_DATE(v) = *(DATE*)src;
             hr = S_OK;
             break;
+        case DBTYPE_DBDATE:
+        {
+            SYSTEMTIME st;
+            DBDATE *ts=(DBDATE*)src;
+
+            V_VT(v) = VT_DATE;
+
+            st.wYear = ts->year;
+            st.wMonth = ts->month;
+            st.wDay = ts->day;
+            st.wHour = 0;
+            st.wMinute = 0;
+            st.wSecond = 0;
+            st.wMilliseconds = 0;
+            hr = (SystemTimeToVariantTime(&st, &V_DATE(v)) ? S_OK : E_FAIL);
+            break;
+        }
         case DBTYPE_DBTIMESTAMP:
         {
             SYSTEMTIME st;
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 37882b6..90e1658 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -2470,6 +2470,7 @@ static void test_converttovar(void)
     static WCHAR strW[] = {'t','e','s','t',0};
     BYTE byte_src[5] = {1, 2, 3, 4, 5};
     DBTIMESTAMP ts = {2013, 5, 14, 2, 4, 12, 0};
+    DBDATE dbdate = {2013, 5, 15};
     double dvalue = 123.56;
     DBSTATUS dst_status;
     DBLENGTH dst_len;
@@ -2584,6 +2585,14 @@ static void test_converttovar(void)
     ok(dst_len == sizeof(dst), "got %ld\n", dst_len);
     ok(V_VT(&dst) == VT_DATE, "got %d\n", V_VT(&dst));
     ok( (float)V_DATE(&dst) == 41408.086250f, "got %f\n", V_DATE(&dst));
+
+    dst_len = 0x1234;
+    hr = IDataConvert_DataConvert(convert, DBTYPE_DBDATE, DBTYPE_VARIANT, 0, &dst_len, &dbdate, &dst, sizeof(dbdate), 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_DATE, "got %d\n", V_VT(&dst));
+    ok( (float)V_DATE(&dst) == 41409.0, "got %f\n", V_DATE(&dst));
 }
 
 START_TEST(convert)




More information about the wine-cvs mailing list