[PATCH] msado15: Use Recordset_Open in Connection_Execute

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Fri Apr 30 01:56:12 CDT 2021


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/msado15/connection.c | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index a3c9a450be6..2d43aff787f 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -339,51 +339,49 @@ static HRESULT WINAPI connection_Execute( _Connection *iface, BSTR command, VARI
 {
     struct connection *connection = impl_from_Connection( iface );
     HRESULT hr;
-    ICommandText *command_text;
-    DBROWCOUNT affected;
-    IUnknown *rowset;
     _Recordset *recordset;
-    ADORecordsetConstruction *construct;
+    VARIANT source, active;
+    IDispatch *dispatch;
 
     FIXME( "%p, %s, %p, 0x%08x, %p Semi-stub\n", iface, debugstr_w(command), records_affected, options, record_set );
 
     if (connection->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
 
-    hr = create_command_text(connection->session, command, &command_text);
+    hr = Recordset_create( (void**)&recordset);
     if (FAILED(hr))
+    {
         return hr;
+    }
 
-    hr = ICommandText_Execute(command_text, NULL, &IID_IUnknown, NULL, &affected, &rowset);
-    ICommandText_Release(command_text);
-    if (FAILED(hr))
-        return hr;
+    _Recordset_put_CursorLocation(recordset, connection->location);
 
-    hr = Recordset_create( (void**)&recordset);
+    V_VT(&source) = VT_BSTR;
+    V_BSTR(&source) = command;
+
+    hr = _Connection_QueryInterface(&connection->Connection_iface, &IID_IDispatch, (void**)&dispatch);
     if (FAILED(hr))
     {
-        IUnknown_Release(rowset);
+        _Recordset_Release(recordset);
         return hr;
     }
 
-    hr = _Recordset_QueryInterface(recordset, &IID_ADORecordsetConstruction, (void**)&construct);
+    V_VT(&active) = VT_DISPATCH;
+    V_DISPATCH(&active) = dispatch;
+
+    hr = _Recordset_Open(recordset, source, active, adOpenDynamic, adLockPessimistic, 0);
+    VariantClear(&active);
     if (FAILED(hr))
     {
-        IUnknown_Release(rowset);
         _Recordset_Release(recordset);
         return hr;
     }
 
-    ADORecordsetConstruction_put_Rowset(construct, rowset);
-    ADORecordsetConstruction_Release(construct);
-    IUnknown_Release(rowset);
-
     if (records_affected)
     {
         V_VT(records_affected) = VT_I4;
-        V_I4(records_affected) = affected;
+        _Recordset_get_RecordCount(recordset, &V_I4(records_affected));
     }
 
-    _Recordset_put_CursorLocation(recordset, connection->location);
     *record_set = recordset;
 
     return hr;
-- 
2.30.2




More information about the wine-devel mailing list