mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 01:33:37 +00:00
msado15: Semi-stub _Recordset get/put Filter.
This commit is contained in:
parent
6254f6635c
commit
669107f6c5
|
@ -48,6 +48,7 @@ struct recordset
|
||||||
CursorTypeEnum cursor_type;
|
CursorTypeEnum cursor_type;
|
||||||
IRowset *row_set;
|
IRowset *row_set;
|
||||||
EditModeEnum editmode;
|
EditModeEnum editmode;
|
||||||
|
VARIANT filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fields
|
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 )
|
static HRESULT WINAPI recordset_get_Filter( _Recordset *iface, VARIANT *criteria )
|
||||||
{
|
{
|
||||||
FIXME( "%p, %p\n", iface, criteria );
|
struct recordset *recordset = impl_from_Recordset( iface );
|
||||||
return E_NOTIMPL;
|
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 )
|
static HRESULT WINAPI recordset_put_Filter( _Recordset *iface, VARIANT criteria )
|
||||||
{
|
{
|
||||||
FIXME( "%p, %s\n", iface, debugstr_variant(&criteria) );
|
struct recordset *recordset = impl_from_Recordset( iface );
|
||||||
return E_NOTIMPL;
|
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 )
|
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->cursor_type = adOpenForwardOnly;
|
||||||
recordset->row_set = NULL;
|
recordset->row_set = NULL;
|
||||||
recordset->editmode = adEditNone;
|
recordset->editmode = adEditNone;
|
||||||
|
VariantInit( &recordset->filter );
|
||||||
|
|
||||||
*obj = &recordset->Recordset_iface;
|
*obj = &recordset->Recordset_iface;
|
||||||
TRACE( "returning iface %p\n", *obj );
|
TRACE( "returning iface %p\n", *obj );
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void test_Recordset(void)
|
||||||
CursorTypeEnum cursor;
|
CursorTypeEnum cursor;
|
||||||
BSTR name;
|
BSTR name;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
VARIANT bookmark;
|
VARIANT bookmark, filter;
|
||||||
EditModeEnum editmode;
|
EditModeEnum editmode;
|
||||||
|
|
||||||
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
|
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 );
|
hr = _Recordset_put_Bookmark( recordset, bookmark );
|
||||||
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08lx\n", hr );
|
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 );
|
VariantInit( &missing );
|
||||||
hr = _Recordset_AddNew( recordset, missing, missing );
|
hr = _Recordset_AddNew( recordset, missing, missing );
|
||||||
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08lx\n", hr );
|
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" );
|
ok( fields2 == fields, "expected same object\n" );
|
||||||
Fields_Release( fields2 );
|
Fields_Release( fields2 );
|
||||||
|
|
||||||
|
V_VT(&filter) = VT_BSTR;
|
||||||
|
V_BSTR(&filter) = SysAllocString( L"field1 = 1" );
|
||||||
|
hr = _Recordset_put_Filter( recordset, filter );
|
||||||
|
todo_wine 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;
|
count = -1;
|
||||||
hr = Fields_get_Count( fields2, &count );
|
hr = Fields_get_Count( fields2, &count );
|
||||||
ok( count == 1, "got %ld\n", count );
|
ok( count == 1, "got %ld\n", count );
|
||||||
|
|
Loading…
Reference in a new issue