From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/msado15/recordset.c | 26 ++++++++++++++++++++---- dlls/msado15/tests/msado15.c | 39 +++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index aa2db6e2968..ea5c233f95a 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -48,6 +48,7 @@ struct recordset CursorTypeEnum cursor_type; IRowset *row_set; EditModeEnum editmode; + VARIANT filter; };
struct fields @@ -1588,14 +1589,30 @@ static HRESULT WINAPI recordset_get_EditMode( _Recordset *iface, EditModeEnum *m
static HRESULT WINAPI recordset_get_Filter( _Recordset *iface, VARIANT *criteria ) { - FIXME( "%p, %p\n", iface, criteria ); - return E_NOTIMPL; + struct recordset *recordset = impl_from_Recordset( iface ); + TRACE( "%p, %p\n", iface, criteria ); + + if (!criteria) return MAKE_ADO_HRESULT( adErrInvalidArgument ); + + VariantCopy(criteria, &recordset->filter); + return S_OK; }
static HRESULT WINAPI recordset_put_Filter( _Recordset *iface, VARIANT criteria ) { - FIXME( "%p, %s\n", iface, debugstr_variant(&criteria) ); - return E_NOTIMPL; + struct recordset *recordset = impl_from_Recordset( iface ); + TRACE( "%p, %s\n", recordset, debugstr_variant(&criteria) ); + + if (V_VT(&criteria) != VT_I2 && V_VT(&criteria) != VT_I4 && V_VT(&criteria) != VT_BSTR) + return MAKE_ADO_HRESULT( adErrInvalidArgument ); + + if (V_VT(&criteria) == VT_BSTR && recordset->state == adStateOpen) + { + FIXME("Validating fields not preformed\n"); + } + + VariantCopy(&recordset->filter, &criteria); + return S_OK; }
static HRESULT WINAPI recordset_get_PageCount( _Recordset *iface, ADO_LONGPTR *count ) @@ -2131,6 +2148,7 @@ HRESULT Recordset_create( void **obj ) recordset->cursor_type = adOpenForwardOnly; recordset->row_set = NULL; recordset->editmode = adEditNone; + VariantInit( &recordset->filter );
*obj = &recordset->Recordset_iface; TRACE( "returning iface %p\n", *obj ); diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index b39adf58b22..89c68165320 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -59,7 +59,7 @@ static void test_Recordset(void) CursorTypeEnum cursor; BSTR name; HRESULT hr; - VARIANT bookmark; + VARIANT bookmark, filter; EditModeEnum editmode;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset ); @@ -123,6 +123,26 @@ static void test_Recordset(void) hr = _Recordset_put_Bookmark( recordset, bookmark ); ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08lx\n", hr );
+ VariantInit( &filter ); + hr = _Recordset_put_Filter( recordset, filter ); + ok( hr == MAKE_ADO_HRESULT( adErrInvalidArgument ), "got %08lx\n", hr ); + + V_VT(&filter) = VT_BSTR; + V_BSTR(&filter) = SysAllocString( L"field1 = 1" ); + hr = _Recordset_put_Filter( recordset, filter ); + ok( hr == S_OK, "got %08lx\n", hr ); + VariantClear(&filter); + + V_VT(&filter) = VT_I4; + V_I4(&filter) = 0; + hr = _Recordset_put_Filter( recordset, filter ); + ok( hr == S_OK, "got %08lx\n", hr ); + + V_VT(&filter) = VT_I2; + V_I2(&filter) = 0; + hr = _Recordset_put_Filter( recordset, filter ); + ok( hr == S_OK, "got %08lx\n", hr ); + VariantInit( &missing ); hr = _Recordset_AddNew( recordset, missing, missing ); ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08lx\n", hr ); @@ -248,6 +268,23 @@ static void test_Recordset(void) ok( fields2 == fields, "expected same object\n" ); Fields_Release( fields2 );
+ V_VT(&filter) = VT_BSTR; + V_BSTR(&filter) = SysAllocString( L"field1 = 1" ); + hr = _Recordset_put_Filter( recordset, filter ); + ok( hr == MAKE_ADO_HRESULT( adErrItemNotFound ), "got %08lx\n", hr ); + VariantClear(&filter); + + V_VT(&filter) = VT_BSTR; + V_BSTR(&filter) = SysAllocString( L"field = 1" ); + hr = _Recordset_put_Filter( recordset, filter ); + ok( hr == S_OK, "got %08lx\n", hr ); + VariantClear(&filter); + + V_VT(&filter) = VT_I4; + V_I4(&filter) = 0; + hr = _Recordset_put_Filter( recordset, filter ); + ok( hr == S_OK, "got %08lx\n", hr ); + count = -1; hr = Fields_get_Count( fields2, &count ); ok( count == 1, "got %ld\n", count );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=129653
Your paranoid android.
=== debian11 (32 bit report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11 (32 bit ar:MA report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11 (32 bit de report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11 (32 bit fr report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11 (32 bit he:IL report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11 (32 bit hi:IN report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11 (32 bit ja:JP report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11 (32 bit zh:CN report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11b (32 bit WoW report) ===
msado15: msado15.c:274: Test failed: got 00000000
=== debian11b (64 bit WoW report) ===
msado15: msado15.c:274: Test failed: got 00000000