oledb32: Implement DataConvert DBTYPE_I8->DBTYPE_VARIANT.

This commit is contained in:
Alistair Leslie-Hughes 2013-04-18 09:54:09 +10:00 committed by Alexandre Julliard
parent dd104f6735
commit 01c282550b
2 changed files with 18 additions and 0 deletions

View File

@ -757,6 +757,10 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
V_I4(v) = *(signed int*)src;
hr = S_OK;
break;
case DBTYPE_I8:
V_VT(v) = VT_DECIMAL;
hr = VarDecFromI8( *(LONGLONG*)src, &V_DECIMAL(v));
break;
case DBTYPE_BSTR:
{
BSTR s = *(WCHAR**)src;

View File

@ -2544,6 +2544,7 @@ static void test_converttovar(void)
CY cy, cy2;
DATE date;
INT i4;
LARGE_INTEGER i8;
hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
if(FAILED(hr))
@ -2571,6 +2572,19 @@ static void test_converttovar(void)
ok(!lstrcmpW(V_BSTR(&dst), strW), "got %s\n", wine_dbgstr_w(V_BSTR(&dst)));
VariantClear(&dst);
V_VT(&dst) = VT_EMPTY;
dst_len = 0;
dst_status = DBSTATUS_S_DEFAULT;
i8.QuadPart = 12345;
dst_len = 0x1234;
hr = IDataConvert_DataConvert(convert, DBTYPE_I8, DBTYPE_VARIANT, sizeof(i8), &dst_len, &i8, &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(V_VT(&dst) == VT_DECIMAL, "got %d\n", V_VT(&dst));
ok(S(U(V_DECIMAL(&dst))).scale == 0 && S(U(V_DECIMAL(&dst))).sign == 0 &&
V_DECIMAL(&dst).Hi32 == 0 && U1(V_DECIMAL(&dst)).Lo64 == 12345, "Not Equal\n");
V_VT(&dst) = VT_EMPTY;
dst_len = 0;
dst_status = DBSTATUS_S_DEFAULT;