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

oledb32: Implement GetConversionSize, DBTYPE_VARIANT(VT_ARRAY|VT_UI1)->DBTYPE_BYTES.

parent a0b8d304
......@@ -1364,7 +1364,24 @@ static HRESULT WINAPI convert_GetConversionSize(IDataConvert* iface,
if(V_VT((VARIANT*)src) == VT_BSTR)
*dst_len = (SysStringLen(V_BSTR((VARIANT*)src))) / sizeof(WCHAR);
else
{
switch(V_VT((VARIANT*)src))
{
case VT_UI1 | VT_ARRAY:
{
LONG l;
hr = SafeArrayGetUBound(V_ARRAY((VARIANT*)src), 1, &l);
if(FAILED(hr))
return hr;
*dst_len = l+1;
break;
}
default:
WARN("DBTYPE_VARIANT(%d)->DBTYPE_BYTES unimplemented\n", V_VT((VARIANT*)src));
}
}
break;
default:
FIXME("unimplemented for %04x -> DBTYPE_BYTES\n", src_type);
......
......@@ -2382,6 +2382,8 @@ static void test_getconversionsize(void)
static WCHAR strW[] = {'t','e','s','t',0};
static char strTest[] = "test";
VARIANT var;
SAFEARRAY *psa = NULL;
SAFEARRAYBOUND rgsabound[1];
/* same way as CanConvert fails here */
dst_len = 0;
......@@ -2478,6 +2480,19 @@ static void test_getconversionsize(void)
hr = IDataConvert_GetConversionSize(convert, DBTYPE_VARIANT, DBTYPE_BYTES, &src_len, &dst_len, &var);
ok(hr == S_OK, "got 0x%08x\n", hr);
VariantClear(&var);
dst_len = 0;
src_len = 20;
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 1802;
psa = SafeArrayCreate(VT_UI1,1,rgsabound);
V_VT(&var) = VT_ARRAY|VT_UI1;
V_ARRAY(&var) = psa;
hr = IDataConvert_GetConversionSize(convert, DBTYPE_VARIANT, DBTYPE_BYTES, &src_len, &dst_len, &var);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(dst_len == 1802, "%ld\n", dst_len);
VariantClear(&var);
}
static void test_converttobytes(void)
......
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