oledb32: Implement DataConvert DBTYPE_BYTES->DBTYPE_BYTES | DBTYPE_BYREF.

This commit is contained in:
Alistair Leslie-Hughes 2013-05-23 14:24:08 +10:00 committed by Alexandre Julliard
parent 0d6eadc4a9
commit 72845af0a6
2 changed files with 37 additions and 0 deletions

View File

@ -957,6 +957,25 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
} }
break; break;
} }
case DBTYPE_BYTES | DBTYPE_BYREF:
{
BYTE **d = dst;
switch(src_type)
{
case DBTYPE_BYTES:
*d = CoTaskMemAlloc(src_len);
if(*d) memcpy(*d, src, src_len);
else hr = E_OUTOFMEMORY;
*dst_len = src_len;
*dst_status = DBSTATUS_S_OK;
return S_OK;
default: FIXME("Unimplemented conversion %04x -> DBTYPE_BYTES | DBTYPE_BYREF\n", src_type); return E_NOTIMPL;
}
break;
}
break;
default: default:
FIXME("Unimplemented conversion %04x -> %04x\n", src_type, dst_type); FIXME("Unimplemented conversion %04x -> %04x\n", src_type, dst_type);

View File

@ -2463,6 +2463,23 @@ static void test_converttobytes(void)
ok(!memcmp(byte_src, dst, 2 ), "bytes differ\n"); ok(!memcmp(byte_src, dst, 2 ), "bytes differ\n");
} }
static void test_converttobytesbyref(void)
{
DBLENGTH dst_len;
HRESULT hr;
BYTE byte_src[] = {0, 1, 2, 4, 5};
BYTE *dst;
DBSTATUS dst_status;
dst_len = 0;
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_BYTES | DBTYPE_BYREF, sizeof(byte_src), &dst_len, byte_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(byte_src), "got %ld\n", dst_len);
ok(!memcmp(byte_src, dst, dst_len ), "bytes differ\n");
CoTaskMemFree(dst);
}
static void test_converttodbdate(void) static void test_converttodbdate(void)
{ {
DBLENGTH dst_len; DBLENGTH dst_len;
@ -2693,6 +2710,7 @@ START_TEST(convert)
test_converttoui8(); test_converttoui8();
test_converttovar(); test_converttovar();
test_converttobytes(); test_converttobytes();
test_converttobytesbyref();
test_converttodbdate(); test_converttodbdate();
test_getconversionsize(); test_getconversionsize();
test_converttotimestamp(); test_converttotimestamp();