Commit 15bb6bfa authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oledb32: Implemented conversion from DBTYPE_VARIANT to DBTYPE_BSTR.

parent 0bbd6cb0
......@@ -503,6 +503,15 @@ 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;
default: FIXME("Unimplemented conversion %04x -> BSTR\n", src_type); return E_NOTIMPL;
}
break;
......
......@@ -926,6 +926,7 @@ static void test_converttobstr(void)
DBSTATUS dst_status;
DBLENGTH dst_len;
static const WCHAR ten[] = {'1','0',0};
VARIANT v;
BSTR b;
hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
......@@ -972,6 +973,19 @@ static void test_converttobstr(void)
SysFreeString(dst);
SysFreeString(b);
b = SysAllocString(ten);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = b;
hr = IDataConvert_DataConvert(convert, DBTYPE_VARIANT, DBTYPE_BSTR, 0, &dst_len, &v, &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 != NULL, "got %p\n", dst);
ok(dst != b, "got %p src %p\n", dst, b);
ok(!lstrcmpW(b, dst), "got %s\n", wine_dbgstr_w(dst));
SysFreeString(dst);
SysFreeString(b);
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