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

oledb32: Implement DataConvert DBTYPE_VARIANT->DBTYPE_UI4.

parent 736a4239
......@@ -165,6 +165,7 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
convert *This = impl_from_IDataConvert(iface);
DBLENGTH dst_len_loc;
DBSTATUS dst_status_loc;
VARIANT tmp;
HRESULT hr;
TRACE("(%p)->(%d, %d, %ld, %p, %p, %p, %ld, %d, %p, %d, %d, %x)\n", This,
......@@ -226,7 +227,6 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
case DBTYPE_I2:
{
signed short *d = dst;
VARIANT tmp;
switch(src_type)
{
case DBTYPE_EMPTY: *d = 0; hr = S_OK; break;
......@@ -258,7 +258,6 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
case DBTYPE_I4:
{
signed int *d = dst;
VARIANT tmp;
switch(src_type)
{
case DBTYPE_EMPTY: *d = 0; hr = S_OK; break;
......@@ -523,14 +522,10 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
}
break;
case DBTYPE_VARIANT:
{
VARIANT tmp;
VariantInit(&tmp);
if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_BSTR)) == S_OK)
*d = V_BSTR(&tmp);
}
break;
break;
default: FIXME("Unimplemented conversion %04x -> BSTR\n", src_type); return E_NOTIMPL;
}
break;
......@@ -608,6 +603,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
case DBTYPE_UI4: *d = *(DWORD*)src; hr = S_OK; break;
case DBTYPE_I8: hr = VarUI4FromI8(*(LONGLONG*)src, d); break;
case DBTYPE_UI8: hr = VarUI4FromUI8(*(ULONGLONG*)src, d); break;
case DBTYPE_VARIANT:
VariantInit(&tmp);
if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_UI4)) == S_OK)
*d = V_UI4(&tmp);
break;
default: FIXME("Unimplemented conversion %04x -> UI4\n", src_type); return E_NOTIMPL;
}
break;
......
......@@ -2303,6 +2303,15 @@ todo_wine
ok(broken(dst_len == sizeof(dst)) || dst_len == 0x1234 /* W2K+ */, "got %ld\n", dst_len);
ok(dst == 0x12345678, "got %08x\n", dst);
dst_len = dst = 0x1234;
V_VT((VARIANT*)src) = VT_I2;
V_I2((VARIANT*)src) = 0x4321;
hr = IDataConvert_DataConvert(convert, DBTYPE_VARIANT, DBTYPE_UI4, 0, &dst_len, src, &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(dst == 0x4321, "got %08x\n", dst);
IDataConvert_Release(convert);
}
......
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