oledb32: Implement GetConversionSize DBTYPE_VARIANT -> DBTYPE_BYTES.

This commit is contained in:
Alistair Leslie-Hughes 2013-05-21 20:39:09 +10:00 committed by Alexandre Julliard
parent 5b8a375ab9
commit 0fe64ce339
2 changed files with 37 additions and 1 deletions

View File

@ -121,7 +121,7 @@ static int get_length(DBTYPE type)
case DBTYPE_UI2: case DBTYPE_UI2:
return 2; return 2;
case DBTYPE_BOOL: case DBTYPE_BOOL:
return sizeof(VARIANT_BOOL); return sizeof(VARIANT_BOOL);
case DBTYPE_I4: case DBTYPE_I4:
case DBTYPE_UI4: case DBTYPE_UI4:
case DBTYPE_R4: case DBTYPE_R4:
@ -143,6 +143,7 @@ static int get_length(DBTYPE type)
return sizeof(FILETIME); return sizeof(FILETIME);
case DBTYPE_GUID: case DBTYPE_GUID:
return sizeof(GUID); return sizeof(GUID);
case DBTYPE_BYTES:
case DBTYPE_WSTR: case DBTYPE_WSTR:
case DBTYPE_STR: case DBTYPE_STR:
case DBTYPE_BYREF | DBTYPE_WSTR: case DBTYPE_BYREF | DBTYPE_WSTR:
@ -1363,6 +1364,26 @@ static HRESULT WINAPI convert_GetConversionSize(IDataConvert* iface,
} }
} }
break; break;
case DBTYPE_BYTES:
{
switch (src_type)
{
case DBTYPE_VARIANT:
{
if(V_VT((VARIANT*)src) == VT_BSTR)
*dst_len = (SysStringLen(V_BSTR((VARIANT*)src))) / sizeof(WCHAR);
else
WARN("DBTYPE_BYTES->DBTYPE_VARIANT(%d) unimplemented\n", V_VT((VARIANT*)src));
return S_OK;
}
break;
default:
FIXME("unimplemented for %04x -> DBTYPE_BYTES\n", src_type);
return E_NOTIMPL;
}
}
break;
default: default:
FIXME("unimplemented for conversion %d->%d\n", src_type, dst_type); FIXME("unimplemented for conversion %d->%d\n", src_type, dst_type);
return E_NOTIMPL; return E_NOTIMPL;

View File

@ -2464,6 +2464,21 @@ static void test_getconversionsize(void)
todo_wine ok(dst_len == 110, "%ld\n", dst_len); todo_wine ok(dst_len == 110, "%ld\n", dst_len);
VariantClear(&var); VariantClear(&var);
dst_len = 0;
src_len = 20;
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(strW);
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 == 2, "%ld\n", dst_len);
VariantClear(&var);
dst_len = 0;
src_len = 20;
V_VT(&var) = VT_NULL;
hr = IDataConvert_GetConversionSize(convert, DBTYPE_VARIANT, DBTYPE_BYTES, &src_len, &dst_len, &var);
ok(hr == S_OK, "got 0x%08x\n", hr);
VariantClear(&var);
} }
static void test_converttobytes(void) static void test_converttobytes(void)