Alistair Leslie-Hughes : msado15: Implement ADORecordsetConstruction get/put Rowset.

Alexandre Julliard julliard at winehq.org
Fri Nov 20 14:54:32 CST 2020


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

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Fri Nov 20 19:16:26 2020 +1100

msado15: Implement ADORecordsetConstruction get/put Rowset.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msado15/recordset.c     | 31 ++++++++++++++++++++++++++-----
 dlls/msado15/tests/msado15.c |  8 ++++----
 2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index 79679e455af..17200d73790 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -23,6 +23,7 @@
 #define COBJMACROS
 #include "objbase.h"
 #include "msado15_backcompat.h"
+#include "oledb.h"
 
 #include "wine/debug.h"
 #include "wine/heap.h"
@@ -46,6 +47,7 @@ struct recordset
     VARIANT           *data;
     CursorLocationEnum cursor_location;
     CursorTypeEnum     cursor_type;
+    IRowset           *row_set;
 };
 
 struct fields
@@ -757,6 +759,8 @@ static void close_recordset( struct recordset *recordset )
 {
     ULONG row, col, col_count;
 
+    if ( recordset->row_set ) IRowset_Release( recordset->row_set );
+
     if (!recordset->fields) return;
     col_count = get_column_count( recordset );
 
@@ -1611,15 +1615,31 @@ static HRESULT WINAPI rsconstruction_Invoke(ADORecordsetConstruction *iface, DIS
 static HRESULT WINAPI rsconstruction_get_Rowset(ADORecordsetConstruction *iface, IUnknown **row_set)
 {
     struct recordset *recordset = impl_from_ADORecordsetConstruction( iface );
-    FIXME( "%p, %p\n", recordset, row_set );
-    return E_NOTIMPL;
+    HRESULT hr;
+
+    TRACE( "%p, %p\n", recordset, row_set );
+
+    hr = IRowset_QueryInterface(recordset->row_set, &IID_IUnknown, (void**)row_set);
+    if ( FAILED(hr) ) return E_FAIL;
+
+    return S_OK;
 }
 
-static HRESULT WINAPI rsconstruction_put_Rowset(ADORecordsetConstruction *iface, IUnknown *row_set)
+static HRESULT WINAPI rsconstruction_put_Rowset(ADORecordsetConstruction *iface, IUnknown *unk)
 {
     struct recordset *recordset = impl_from_ADORecordsetConstruction( iface );
-    FIXME( "%p, %p\n", recordset, row_set );
-    return E_NOTIMPL;
+    HRESULT hr;
+    IRowset *rowset;
+
+    TRACE( "%p, %p\n", recordset, unk );
+
+    hr = IUnknown_QueryInterface(unk, &IID_IRowset, (void**)&rowset);
+    if ( FAILED(hr) ) return E_FAIL;
+
+    if ( recordset->row_set ) IRowset_Release( recordset->row_set );
+    recordset->row_set = rowset;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI rsconstruction_get_Chapter(ADORecordsetConstruction *iface, LONG *chapter)
@@ -1679,6 +1699,7 @@ HRESULT Recordset_create( void **obj )
     recordset->index = -1;
     recordset->cursor_location = adUseServer;
     recordset->cursor_type = adOpenForwardOnly;
+    recordset->row_set = NULL;
 
     *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 288e579f10c..cafb73d64e4 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -582,17 +582,17 @@ static void test_ADORecordsetConstruction(void)
     ref = get_refcount( rowset );
     ok( ref == 1, "got %d\n", ref );
     hr = ADORecordsetConstruction_put_Rowset( construct, (IUnknown*)rowset );
-    todo_wine ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08x\n", hr );
 
     ref = get_refcount( rowset );
-    todo_wine ok( ref == 2, "got %d\n", ref );
+    ok( ref == 2, "got %d\n", ref );
 
     hr = _Recordset_get_Fields( recordset, &fields );
     ok( hr == S_OK, "got %08x\n", hr );
     ok( fields != NULL, "NULL value\n");
 
     ref = get_refcount( rowset );
-    todo_wine ok( ref == 2, "got %d\n", ref );
+    ok( ref == 2, "got %d\n", ref );
 
     count = -1;
     hr = Fields_get_Count( fields, &count );
@@ -623,7 +623,7 @@ static void test_ADORecordsetConstruction(void)
     }
 
     ref = get_refcount(rowset);
-    todo_wine ok( ref == 2, "got %d\n", ref );
+    ok( ref == 2, "got %d\n", ref );
 
     Fields_Release(fields);
 




More information about the wine-cvs mailing list