[PATCH 3/8] msado15: Implement _Recordset_get_BOF and _Recordset_get_EOF.
Hans Leidekker
hans at codeweavers.com
Fri Dec 13 08:52:26 CST 2019
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/msado15/recordset.c | 16 ++++++++++++----
dlls/msado15/tests/msado15.c | 18 ++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index 0f0cb24759..e7c7cdc409 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -772,8 +772,12 @@ static HRESULT WINAPI recordset_get_ActiveConnection( _Recordset *iface, VARIANT
static HRESULT WINAPI recordset_get_BOF( _Recordset *iface, VARIANT_BOOL *bof )
{
- FIXME( "%p, %p\n", iface, bof );
- return E_NOTIMPL;
+ struct recordset *recordset = impl_from_Recordset( iface );
+
+ TRACE( "%p, %p\n", recordset, bof );
+
+ *bof = (recordset->index < 0) ? VARIANT_TRUE : VARIANT_FALSE;
+ return S_OK;
}
static HRESULT WINAPI recordset_get_Bookmark( _Recordset *iface, VARIANT *bookmark )
@@ -814,8 +818,12 @@ static HRESULT WINAPI recordset_put_CursorType( _Recordset *iface, CursorTypeEnu
static HRESULT WINAPI recordset_get_EOF( _Recordset *iface, VARIANT_BOOL *eof )
{
- FIXME( "%p, %p\n", iface, eof );
- return E_NOTIMPL;
+ struct recordset *recordset = impl_from_Recordset( iface );
+
+ TRACE( "%p, %p\n", recordset, eof );
+
+ *eof = (!recordset->count || recordset->index >= recordset->count) ? VARIANT_TRUE : VARIANT_FALSE;
+ return S_OK;
}
static HRESULT WINAPI recordset_get_Fields( _Recordset *iface, Fields **obj )
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 855f138e47..f003c2bb0f 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -25,6 +25,20 @@
#define MAKE_ADO_HRESULT( err ) MAKE_HRESULT( SEVERITY_ERROR, FACILITY_CONTROL, err )
+static BOOL is_bof( _Recordset *recordset )
+{
+ VARIANT_BOOL bof = VARIANT_FALSE;
+ _Recordset_get_BOF( recordset, &bof );
+ return bof == VARIANT_TRUE;
+}
+
+static BOOL is_eof( _Recordset *recordset )
+{
+ VARIANT_BOOL eof = VARIANT_FALSE;
+ _Recordset_get_EOF( recordset, &eof );
+ return eof == VARIANT_TRUE;
+}
+
static LONG get_refs_field( Field *field )
{
Field_AddRef( field );
@@ -121,6 +135,8 @@ static void test_Recordset(void)
hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified );
ok( hr == S_OK, "got %08x\n", hr );
+ ok( is_eof( recordset ), "not eof\n" );
+ ok( is_bof( recordset ), "not bof\n" );
state = -1;
hr = _Recordset_get_State( recordset, &state );
@@ -129,6 +145,8 @@ static void test_Recordset(void)
hr = _Recordset_AddNew( recordset, missing, missing );
ok( hr == S_OK, "got %08x\n", hr );
+ ok( !is_eof( recordset ), "eof\n" );
+ ok( !is_bof( recordset ), "bof\n" );
hr = _Recordset_Close( recordset );
ok( hr == S_OK, "got %08x\n", hr );
--
2.20.1
More information about the wine-devel
mailing list