oledb32: Implement DataConvert DBTYPE_VARIANT(VT_DATE) to, DBTYPE_DBTIMESTAMP
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Mon May 20 05:53:52 CDT 2013
Hi,
Changelog:
oledb32: Implement DataConvert DBTYPE_VARIANT(VT_DATE) to
DBTYPE_DBTIMESTAMP
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From 1b3f681eeab7518fb9fc0fc64e3cf10009ecac95 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon, 20 May 2013 15:09:09 +1000
Subject: [PATCH] Implement DataConvert DBTYPE_VARIANT(VT_DATE) to
DBTYPE_DBTIMESTAMP
To: wine-patches <wine-patches at winehq.org>
---
dlls/oledb32/convert.c | 18 ++++++++++++++++++
dlls/oledb32/tests/convert.c | 21 +++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 5d5bf97..7a15afb 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -445,6 +445,24 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
d->fraction = st.wMilliseconds * 1000000;
break;
}
+ case DBTYPE_VARIANT:
+ {
+ if( V_VT((VARIANT*)src) == VT_DATE)
+ {
+ SYSTEMTIME st;
+ hr = (VariantTimeToSystemTime( V_DATE((VARIANT*)src), &st) ? S_OK : E_FAIL);
+ d->year = st.wYear;
+ d->month = st.wMonth;
+ d->day = st.wDay;
+ d->hour = st.wHour;
+ d->minute = st.wMinute;
+ d->second = st.wSecond;
+ d->fraction = st.wMilliseconds * 1000000;
+ break;
+ }
+ else
+ FIXME("Unimplemented variant type %d -> DBTIMESTAMP\n", V_VT((VARIANT*)src));
+ }
default: FIXME("Unimplemented conversion %04x -> DBTIMESTAMP\n", src_type); return E_NOTIMPL;
}
break;
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 6f02899..39f96d2 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -2603,6 +2603,26 @@ static void test_converttovar(void)
ok( (float)V_DATE(&dst) == 41409.0, "got %f\n", V_DATE(&dst));
}
+static void test_converttotimestamp(void)
+{
+ DBTIMESTAMP ts = {2013, 5, 14, 2, 4, 12, 0};
+ DBTIMESTAMP dst;
+ DBSTATUS dst_status;
+ DBLENGTH dst_len;
+ VARIANT var;
+ HRESULT hr;
+
+ VariantInit(&var);
+ V_VT(&var) = VT_DATE;
+ V_DATE(&var) = 41408.086250;
+ dst_len = 0x1234;
+ hr = IDataConvert_DataConvert(convert, DBTYPE_VARIANT, DBTYPE_DBTIMESTAMP, 0, &dst_len, &var, &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(!memcmp(&ts, &dst, sizeof(ts)), "Wrong timestamp\n");
+}
+
START_TEST(convert)
{
HRESULT hr;
@@ -2638,6 +2658,7 @@ START_TEST(convert)
test_converttobytes();
test_converttodbdate();
test_getconversionsize();
+ test_converttotimestamp();
IDataConvert_Release(convert);
--
1.8.1.2
More information about the wine-patches
mailing list