oledb32: Implement DataConvert DBTYPE_BSTR->DBTYPE_I8.

This commit is contained in:
Alistair Leslie-Hughes 2013-04-16 11:23:59 +10:00 committed by Alexandre Julliard
parent 975f1dcd7a
commit e06cdb6207
2 changed files with 14 additions and 0 deletions

View File

@ -292,6 +292,7 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
LONGLONG *d = dst;
switch(src_type)
{
case DBTYPE_BSTR: hr = VarI8FromStr(*(WCHAR**)src, LOCALE_USER_DEFAULT, 0, d); break;
case DBTYPE_I8: *d = *(LONGLONG*)src; hr = S_OK; break;
default: FIXME("Unimplemented conversion %04x -> I8\n", src_type); return E_NOTIMPL;
}

View File

@ -925,6 +925,8 @@ static void test_converttoi8(void)
BYTE src[20];
DBSTATUS dst_status;
DBLENGTH dst_len;
static const WCHAR ten[] = {'1','0',0};
BSTR b;
hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
if(FAILED(hr))
@ -942,6 +944,17 @@ static void test_converttoi8(void)
ok(dst_len == sizeof(dst), "got %ld\n", dst_len);
ok(dst.QuadPart == 1234, "got %d\n", (int)dst.QuadPart);
dst.QuadPart = 0xcc;
((ULARGE_INTEGER*)src)->QuadPart = 1234;
b = SysAllocString(ten);
*(BSTR *)src = b;
hr = IDataConvert_DataConvert(convert, DBTYPE_BSTR, DBTYPE_I8, 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.QuadPart == 10, "got %d\n", (int)dst.QuadPart);
SysFreeString(b);
IDataConvert_Release(convert);
}