msado15: Handle DBTYPE_STR type when loading recordset data.
This commit is contained in:
parent
58e6c4d11c
commit
3a1f5224fb
1 changed files with 25 additions and 0 deletions
|
@ -970,6 +970,22 @@ static HRESULT map_index( struct fields *fields, VARIANT *index, ULONG *ret )
|
|||
return MAKE_ADO_HRESULT(adErrItemNotFound);
|
||||
}
|
||||
|
||||
static inline WCHAR *heap_strdupAtoW(const char *str)
|
||||
{
|
||||
LPWSTR ret = NULL;
|
||||
|
||||
if(str) {
|
||||
DWORD len;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
||||
ret = malloc(len*sizeof(WCHAR));
|
||||
if(ret)
|
||||
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI fields_get_Item( Fields *iface, VARIANT index, Field **obj )
|
||||
{
|
||||
struct fields *fields = impl_from_Fields( iface );
|
||||
|
@ -1948,6 +1964,15 @@ static HRESULT load_all_recordset_data(struct recordset *recordset, IUnknown *ro
|
|||
case DBTYPE_I4:
|
||||
V_I4(©) = *(LONG*)(data + bindings[datacol].obValue);
|
||||
break;
|
||||
case DBTYPE_STR:
|
||||
{
|
||||
WCHAR *str = heap_strdupAtoW( (char*)(data + bindings[datacol].obValue) );
|
||||
|
||||
V_VT(©) = VT_BSTR;
|
||||
V_BSTR(©) = SysAllocString(str);
|
||||
free(str);
|
||||
break;
|
||||
}
|
||||
case DBTYPE_WSTR:
|
||||
{
|
||||
V_VT(©) = VT_BSTR;
|
||||
|
|
Loading…
Add table
Reference in a new issue