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

oledb32: Implement DataConvert DBTYPE_R4->DBTYPE_VARIANT.

parent 97ac6943
......@@ -884,6 +884,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
V_VT(v) = VT_DECIMAL;
hr = VarDecFromI8( *(LONGLONG*)src, &V_DECIMAL(v));
break;
case DBTYPE_R4:
V_VT(v) = VT_R4;
V_R4(v) = *(FLOAT*)src;
hr = S_OK;
break;
case DBTYPE_R8:
V_VT(v) = VT_R8;
V_R8(v) = *(double*)src;
......
......@@ -2575,6 +2575,7 @@ static void test_converttovar(void)
INT i4;
LARGE_INTEGER i8;
VARIANT_BOOL boolean = VARIANT_TRUE;
FLOAT fvalue = 543.21f;
V_VT(&dst) = VT_EMPTY;
dst_len = 0;
......@@ -2611,6 +2612,16 @@ static void test_converttovar(void)
V_VT(&dst) = VT_EMPTY;
dst_len = 0;
dst_status = DBSTATUS_S_DEFAULT;
hr = IDataConvert_DataConvert(convert, DBTYPE_R4, DBTYPE_VARIANT, sizeof(fvalue), &dst_len, &fvalue, &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_R4, "got %d\n", V_VT(&dst));
ok(V_R4(&dst) == 543.21f, "got %f\n", V_R4(&dst));
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);
......
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