msado15: Implement _Recordset_AddNew.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b676616700
commit
7fce75805c
|
@ -887,10 +887,35 @@ static HRESULT WINAPI recordset_get_Source( _Recordset *iface, VARIANT *source )
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static BOOL resize_recordset( struct recordset *recordset, ULONG row_count )
|
||||
{
|
||||
ULONG row_size = get_column_count( recordset ) * sizeof(*recordset->data);
|
||||
|
||||
if (row_count > recordset->allocated)
|
||||
{
|
||||
VARIANT *tmp;
|
||||
ULONG count = max( row_count, recordset->allocated * 2 );
|
||||
if (!(tmp = heap_realloc_zero( recordset->data, count * row_size ))) return FALSE;
|
||||
recordset->data = tmp;
|
||||
recordset->allocated = count;
|
||||
}
|
||||
|
||||
recordset->count = row_count;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI recordset_AddNew( _Recordset *iface, VARIANT field_list, VARIANT values )
|
||||
{
|
||||
FIXME( "%p, %s, %s\n", iface, debugstr_variant(&field_list), debugstr_variant(&values) );
|
||||
return E_NOTIMPL;
|
||||
struct recordset *recordset = impl_from_Recordset( iface );
|
||||
|
||||
TRACE( "%p, %s, %s\n", recordset, debugstr_variant(&field_list), debugstr_variant(&values) );
|
||||
FIXME( "ignoring field list and values\n" );
|
||||
|
||||
if (recordset->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
|
||||
|
||||
if (!resize_recordset( recordset, recordset->count + 1 )) return E_OUTOFMEMORY;
|
||||
recordset->index++;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI recordset_CancelUpdate( _Recordset *iface )
|
||||
|
|
|
@ -47,7 +47,9 @@ static void test_Recordset(void)
|
|||
{
|
||||
_Recordset *recordset;
|
||||
Fields *fields, *fields2;
|
||||
LONG refs, count;
|
||||
LONG refs, count, state;
|
||||
VARIANT missing;
|
||||
BSTR name;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
|
||||
|
@ -92,6 +94,48 @@ static void test_Recordset(void)
|
|||
/* fields object still has a reference */
|
||||
refs = Fields_Release( fields2 );
|
||||
ok( refs == 1, "got %d\n", refs );
|
||||
|
||||
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
state = -1;
|
||||
hr = _Recordset_get_State( recordset, &state );
|
||||
todo_wine ok( hr == S_OK, "got %08x\n", hr );
|
||||
todo_wine ok( state == adStateClosed, "got %d\n", state );
|
||||
|
||||
VariantInit( &missing );
|
||||
hr = _Recordset_AddNew( recordset, missing, missing );
|
||||
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
|
||||
|
||||
V_VT( &missing ) = VT_ERROR;
|
||||
V_ERROR( &missing ) = DISP_E_PARAMNOTFOUND;
|
||||
hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified );
|
||||
todo_wine ok( hr == MAKE_ADO_HRESULT( adErrInvalidConnection ), "got %08x\n", hr );
|
||||
|
||||
hr = _Recordset_get_Fields( recordset, &fields );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
name = SysAllocString( L"field" );
|
||||
hr = Fields__Append( fields, name, adInteger, 4, adFldUnspecified );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
SysFreeString( name );
|
||||
|
||||
hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
state = -1;
|
||||
hr = _Recordset_get_State( recordset, &state );
|
||||
todo_wine ok( hr == S_OK, "got %08x\n", hr );
|
||||
todo_wine ok( state == adStateOpen, "got %d\n", state );
|
||||
|
||||
hr = _Recordset_AddNew( recordset, missing, missing );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = _Recordset_Close( recordset );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
Fields_Release( fields );
|
||||
_Recordset_Release( recordset );
|
||||
}
|
||||
|
||||
static void test_Fields(void)
|
||||
|
|
Loading…
Reference in New Issue