Hans Leidekker : msado15: Implement _Recordset_get_BOF and _Recordset_get_EOF.

Alexandre Julliard julliard at winehq.org
Fri Dec 13 15:27:22 CST 2019


Module: wine
Branch: master
Commit: 55020bf23962d537535eaacb20b218406af023bd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=55020bf23962d537535eaacb20b218406af023bd

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Dec 13 15:52:26 2019 +0100

msado15: Implement _Recordset_get_BOF and _Recordset_get_EOF.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 b0ca9cf2a5..bac1c34a46 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 );
@@ -122,6 +136,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 );
@@ -130,6 +146,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 );




More information about the wine-cvs mailing list