Commit aeb7362e authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

oledb32: Implement DataConvert DBTYPE_R8->VARIANT.

parent 31f0079f
...@@ -761,6 +761,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, ...@@ -761,6 +761,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
V_VT(v) = VT_DECIMAL; V_VT(v) = VT_DECIMAL;
hr = VarDecFromI8( *(LONGLONG*)src, &V_DECIMAL(v)); hr = VarDecFromI8( *(LONGLONG*)src, &V_DECIMAL(v));
break; break;
case DBTYPE_R8:
V_VT(v) = VT_R8;
V_R8(v) = *(double*)src;
hr = S_OK;
break;
case DBTYPE_BSTR: case DBTYPE_BSTR:
{ {
BSTR s = *(WCHAR**)src; BSTR s = *(WCHAR**)src;
......
...@@ -2536,6 +2536,7 @@ static void test_getconversionsize(void) ...@@ -2536,6 +2536,7 @@ static void test_getconversionsize(void)
static void test_converttovar(void) static void test_converttovar(void)
{ {
static WCHAR strW[] = {'t','e','s','t',0}; static WCHAR strW[] = {'t','e','s','t',0};
double dvalue = 123.56;
IDataConvert *convert; IDataConvert *convert;
DBSTATUS dst_status; DBSTATUS dst_status;
DBLENGTH dst_len; DBLENGTH dst_len;
...@@ -2588,6 +2589,16 @@ static void test_converttovar(void) ...@@ -2588,6 +2589,16 @@ static void test_converttovar(void)
V_VT(&dst) = VT_EMPTY; V_VT(&dst) = VT_EMPTY;
dst_len = 0; dst_len = 0;
dst_status = DBSTATUS_S_DEFAULT; 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; i4 = 123;
hr = IDataConvert_DataConvert(convert, DBTYPE_I4, DBTYPE_VARIANT, sizeof(i4), &dst_len, &i4, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); 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); ok(hr == S_OK, "got %08x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment