From 872788356ce9fd0059035dc25200e02f29f8321a Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 11 Apr 2013 18:52:54 +0400 Subject: [PATCH] oledb32: Implement DBTYPE_I4 -> DBTYPE_VARIANT conversion. --- dlls/oledb32/convert.c | 7 ++++++- dlls/oledb32/tests/convert.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c index 381210af337..f4002fbd714 100644 --- a/dlls/oledb32/convert.c +++ b/dlls/oledb32/convert.c @@ -740,6 +740,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, switch(src_type) { + case DBTYPE_I4: + V_VT(v) = VT_I4; + V_I4(v) = *(signed int*)src; + hr = S_OK; + break; case DBTYPE_BSTR: { BSTR s = *(WCHAR**)src; @@ -747,8 +752,8 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, V_VT(v) = VT_BSTR; V_BSTR(v) = SysAllocString(s); hr = V_BSTR(v) ? S_OK : E_OUTOFMEMORY; + break; } - break; default: FIXME("Unimplemented conversion %04x -> VARIANT\n", src_type); return E_NOTIMPL; } break; diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c index 8c681545cdc..4623825d165 100644 --- a/dlls/oledb32/tests/convert.c +++ b/dlls/oledb32/tests/convert.c @@ -2481,6 +2481,7 @@ static void test_converttovar(void) DBLENGTH dst_len; VARIANT dst; HRESULT hr; + INT i4; hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert); if(FAILED(hr)) @@ -2508,6 +2509,17 @@ 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; + i4 = 123; + hr = IDataConvert_DataConvert(convert, DBTYPE_I4, DBTYPE_VARIANT, sizeof(i4), &dst_len, &i4, &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_I4, "got %d\n", V_VT(&dst)); + ok(V_I4(&dst) == 123, "got %d\n", V_I4(&dst)); + IDataConvert_Release(convert); }