oledb32: Implement conversion from DBTYPE_GUID to DBTYPE_STR/DBTYPE_WSTR/DBTYPE_BSTR.

This commit is contained in:
Alex Villacís Lasso 2010-04-05 11:44:45 -05:00 committed by Alexandre Julliard
parent 75c053aab5
commit d1f4e6a149
2 changed files with 18 additions and 4 deletions

View File

@ -336,6 +336,22 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
case DBTYPE_UI4: hr = VarBstrFromUI4(*(DWORD*)src, LOCALE_USER_DEFAULT, 0, d); break; case DBTYPE_UI4: hr = VarBstrFromUI4(*(DWORD*)src, LOCALE_USER_DEFAULT, 0, d); break;
case DBTYPE_I8: hr = VarBstrFromI8(*(LONGLONG*)src, LOCALE_USER_DEFAULT, 0, d); break; case DBTYPE_I8: hr = VarBstrFromI8(*(LONGLONG*)src, LOCALE_USER_DEFAULT, 0, d); break;
case DBTYPE_UI8: hr = VarBstrFromUI8(*(ULONGLONG*)src, LOCALE_USER_DEFAULT, 0, d); break; case DBTYPE_UI8: hr = VarBstrFromUI8(*(ULONGLONG*)src, LOCALE_USER_DEFAULT, 0, d); break;
case DBTYPE_GUID:
{
WCHAR szBuff[39];
const GUID *id = (const GUID *)src;
WCHAR format[] = {
'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X','-',
'%','0','2','X','%','0','2','X','-',
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','}',0};
wsprintfW(szBuff, format,
id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
*d = SysAllocString(szBuff);
hr = *d ? S_OK : E_OUTOFMEMORY;
}
break;
default: FIXME("Unimplemented conversion %04x -> BSTR\n", src_type); return E_NOTIMPL; default: FIXME("Unimplemented conversion %04x -> BSTR\n", src_type); return E_NOTIMPL;
} }
break; break;

View File

@ -1240,12 +1240,11 @@ static void test_converttowstr(void)
memcpy(src, &IID_IDataConvert, sizeof(GUID)); memcpy(src, &IID_IDataConvert, sizeof(GUID));
memset(dst, 0xcc, sizeof(dst)); memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_GUID, DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); hr = IDataConvert_DataConvert(convert, DBTYPE_GUID, DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 76, "got %d\n", dst_len); ok(dst_len == 76, "got %d\n", dst_len);
ok(!lstrcmpW(dst, guid_str), "got %s\n", wine_dbgstr_w(dst)); ok(!lstrcmpW(dst, guid_str), "got %s\n", wine_dbgstr_w(dst));
}
b = SysAllocString(ten); b = SysAllocString(ten);
@ -1605,12 +1604,11 @@ static void test_converttostr(void)
memcpy(src, &IID_IDataConvert, sizeof(GUID)); memcpy(src, &IID_IDataConvert, sizeof(GUID));
memset(dst, 0xcc, sizeof(dst)); memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_GUID, DBTYPE_STR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); hr = IDataConvert_DataConvert(convert, DBTYPE_GUID, DBTYPE_STR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 38, "got %d\n", dst_len); ok(dst_len == 38, "got %d\n", dst_len);
ok(!lstrcmpA(dst, guid_str), "got %s\n", dst); ok(!lstrcmpA(dst, guid_str), "got %s\n", dst);
}
b = SysAllocString(ten); b = SysAllocString(ten);