Alistair Leslie-Hughes : msado15: Use Recordset_Open in Connection_Execute.
Alexandre Julliard
julliard at winehq.org
Fri Apr 30 16:03:28 CDT 2021
Module: wine
Branch: master
Commit: 1b9c6227f3dc0746743f5f4e9865d6a18caa3976
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1b9c6227f3dc0746743f5f4e9865d6a18caa3976
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri Apr 30 20:52:06 2021 +1000
msado15: Use Recordset_Open in Connection_Execute.
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/connection.c | 78 +++++++++---------------------------------
dlls/msado15/msado15_private.h | 2 --
dlls/msado15/recordset.c | 42 +++++++++++++++++++++++
3 files changed, 59 insertions(+), 63 deletions(-)
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index a3c9a450be6..ce7750fef66 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -292,98 +292,54 @@ static HRESULT WINAPI connection_Close( _Connection *iface )
return S_OK;
}
-HRESULT create_command_text(IUnknown *session, BSTR command, ICommandText **cmd_text)
-{
- HRESULT hr;
- IOpenRowset *openrowset;
- ICommandText *command_text;
- ICommand *cmd;
- IDBCreateCommand *create_command;
-
- hr = IUnknown_QueryInterface(session, &IID_IOpenRowset, (void**)&openrowset);
- if (FAILED(hr))
- return hr;
-
- hr = IOpenRowset_QueryInterface(openrowset, &IID_IDBCreateCommand, (void**)&create_command);
- IOpenRowset_Release(openrowset);
- if (FAILED(hr))
- return hr;
-
- hr = IDBCreateCommand_CreateCommand(create_command, NULL, &IID_IUnknown, (IUnknown **)&cmd);
- IDBCreateCommand_Release(create_command);
- if (FAILED(hr))
- return hr;
-
- hr = ICommand_QueryInterface(cmd, &IID_ICommandText, (void**)&command_text);
- ICommand_Release(cmd);
- if (FAILED(hr))
- {
- FIXME("Currently only ICommandText interface is support\n");
- return hr;
- }
-
- hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, command);
- if (FAILED(hr))
- {
- ICommandText_Release(command_text);
- return hr;
- }
-
- *cmd_text = command_text;
-
- return S_OK;
-}
-
static HRESULT WINAPI connection_Execute( _Connection *iface, BSTR command, VARIANT *records_affected,
LONG options, _Recordset **record_set )
{
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;
diff --git a/dlls/msado15/msado15_private.h b/dlls/msado15/msado15_private.h
index 600dcb90a97..bb55eaaa3aa 100644
--- a/dlls/msado15/msado15_private.h
+++ b/dlls/msado15/msado15_private.h
@@ -26,8 +26,6 @@ HRESULT Connection_create( void ** ) DECLSPEC_HIDDEN;
HRESULT Recordset_create( void ** ) DECLSPEC_HIDDEN;
HRESULT Stream_create( void ** ) DECLSPEC_HIDDEN;
-HRESULT create_command_text(IUnknown *session, BSTR command, ICommandText **cmd_text) DECLSPEC_HIDDEN;
-
static inline void *heap_realloc_zero( void *mem, SIZE_T len )
{
if (!mem) return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index d71904193c9..2b32dc6cf94 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -1417,6 +1417,48 @@ static HRESULT WINAPI recordset_MoveLast( _Recordset *iface )
return S_OK;
}
+static HRESULT create_command_text(IUnknown *session, BSTR command, ICommandText **cmd_text)
+{
+ HRESULT hr;
+ IOpenRowset *openrowset;
+ ICommandText *command_text;
+ ICommand *cmd;
+ IDBCreateCommand *create_command;
+
+ hr = IUnknown_QueryInterface(session, &IID_IOpenRowset, (void**)&openrowset);
+ if (FAILED(hr))
+ return hr;
+
+ hr = IOpenRowset_QueryInterface(openrowset, &IID_IDBCreateCommand, (void**)&create_command);
+ IOpenRowset_Release(openrowset);
+ if (FAILED(hr))
+ return hr;
+
+ hr = IDBCreateCommand_CreateCommand(create_command, NULL, &IID_IUnknown, (IUnknown **)&cmd);
+ IDBCreateCommand_Release(create_command);
+ if (FAILED(hr))
+ return hr;
+
+ hr = ICommand_QueryInterface(cmd, &IID_ICommandText, (void**)&command_text);
+ ICommand_Release(cmd);
+ if (FAILED(hr))
+ {
+ FIXME("Currently only ICommandText interface is support\n");
+ return hr;
+ }
+
+ hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, command);
+ if (FAILED(hr))
+ {
+ ICommandText_Release(command_text);
+ return hr;
+ }
+
+ *cmd_text = command_text;
+
+ return S_OK;
+}
+
static HRESULT WINAPI recordset_Open( _Recordset *iface, VARIANT source, VARIANT active_connection,
CursorTypeEnum cursor_type, LockTypeEnum lock_type, LONG options )
{
More information about the wine-cvs
mailing list