Alistair Leslie-Hughes : oledb32: Implement DataConvert DBTYPE_DBTIMESTAMP- >DBTYPE_VARIANT.
Alexandre Julliard
julliard at winehq.org
Thu May 16 13:55:06 CDT 2013
Module: wine
Branch: master
Commit: e08a1d5bc1438dfb21988e1a850667e5fe259ee8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e08a1d5bc1438dfb21988e1a850667e5fe259ee8
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Tue May 14 14:48:04 2013 +1000
oledb32: Implement DataConvert DBTYPE_DBTIMESTAMP->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 904f3cc..54e17b7 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -785,6 +785,23 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
V_DATE(v) = *(DATE*)src;
hr = S_OK;
break;
+ case DBTYPE_DBTIMESTAMP:
+ {
+ SYSTEMTIME st;
+ DBTIMESTAMP *ts = (DBTIMESTAMP *)src;
+
+ V_VT(v) = VT_DATE;
+
+ st.wYear = ts->year;
+ st.wMonth = ts->month;
+ st.wDay = ts->day;
+ st.wHour = ts->hour;
+ st.wMinute = ts->minute;
+ st.wSecond = ts->second;
+ st.wMilliseconds = ts->fraction/1000000;
+ hr = SystemTimeToVariantTime(&st, &V_DATE(v)) ? S_OK : E_FAIL;
+ break;
+ }
case DBTYPE_CY:
V_VT(v) = VT_CY;
V_CY(v) = *(CY*)src;
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index dfd0df1..56c9f9b 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -2451,6 +2451,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};
double dvalue = 123.56;
DBSTATUS dst_status;
DBLENGTH dst_len;
@@ -2557,6 +2558,14 @@ static void test_converttovar(void)
ok(dst_len == sizeof(dst), "got %ld\n", dst_len);
ok(V_VT(&dst) == (VT_ARRAY|VT_UI1), "got %d\n", V_VT(&dst));
VariantClear(&dst);
+
+ dst_len = 0x1234;
+ hr = IDataConvert_DataConvert(convert, DBTYPE_DBTIMESTAMP, DBTYPE_VARIANT, 0, &dst_len, &ts, &dst, sizeof(ts), 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) == 41408.086250f, "got %f\n", V_DATE(&dst));
}
START_TEST(convert)
More information about the wine-cvs
mailing list