Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msado15/recordset.c | 65 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index 12bb9680258..8dab455fb67 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -1182,15 +1182,74 @@ static HRESULT WINAPI recordset_Open( _Recordset *iface, VARIANT source, VARIANT CursorTypeEnum cursor_type, LockTypeEnum lock_type, LONG options ) { struct recordset *recordset = impl_from_Recordset( iface ); + ADOConnectionConstruction15 *construct; + IUnknown *session = NULL; + IOpenRowset *openrowset = NULL; + IDBCreateCommand *create_command = NULL; + ICommand *cmd = NULL; + ICommandText *command_text = NULL; + DBROWCOUNT affected; + IUnknown *rowset = NULL; + HRESULT hr;
- FIXME( "%p, %s, %s, %d, %d, %d\n", recordset, debugstr_variant(&source), debugstr_variant(&active_connection), + FIXME( "%p, %s, %s, %d, %d, %d Semi-stub\n", recordset, debugstr_variant(&source), debugstr_variant(&active_connection), cursor_type, lock_type, options );
- if (!recordset->fields) return MAKE_ADO_HRESULT( adErrInvalidConnection ); if (recordset->state == adStateOpen) return MAKE_ADO_HRESULT( adErrObjectOpen );
+ if (V_VT(&active_connection) != VT_DISPATCH) + { + FIXME("Unsupported Active connection type %d\n", V_VT(&active_connection)); + return E_FAIL; + } + + hr = IDispatch_QueryInterface(V_DISPATCH(&active_connection), &IID_ADOConnectionConstruction15, (void**)&construct); + if (FAILED(hr)) + return E_FAIL; + + hr = ADOConnectionConstruction15_get_Session(construct, &session); + ADOConnectionConstruction15_Release(construct); + if (FAILED(hr)) + return E_FAIL; + + hr = IUnknown_QueryInterface(session, &IID_IOpenRowset, (void**)&openrowset); + if (FAILED(hr)) return hr; + + hr = IOpenRowset_QueryInterface(openrowset, &IID_IDBCreateCommand, (void**)&create_command); + if (FAILED(hr)) + goto done; + + hr = IDBCreateCommand_CreateCommand(create_command, NULL, &IID_IUnknown, (IUnknown **)&cmd); + if (FAILED(hr)) + goto done; + + hr = ICommand_QueryInterface(cmd, &IID_ICommandText, (void**)&command_text); + if (FAILED(hr)) + { + FIXME("Currently only ICommandText interface is support\n"); + goto done; + } + + hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, V_BSTR(&source)); + if (FAILED(hr)) + goto done; + + hr = ICommandText_Execute(command_text, NULL, &IID_IUnknown, NULL, &affected, &rowset); + if (FAILED(hr)) + goto done; + + ADORecordsetConstruction_put_Rowset(&recordset->ADORecordsetConstruction_iface, rowset); + recordset->cursor_type = cursor_type; recordset->state = adStateOpen; - return S_OK; + +done: + if (session) IUnknown_Release(session); + if (rowset) IUnknown_Release(rowset); + if (command_text) ICommandText_Release(command_text); + if (cmd) ICommand_Release(cmd); + if (create_command) IDBCreateCommand_Release(create_command); + if (openrowset) IOpenRowset_Release(openrowset); + return hr; }
static HRESULT WINAPI recordset_Requery( _Recordset *iface, LONG options )
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=85856
Your paranoid android.
=== debiant2 (32 bit report) ===
msado15: msado15.c:163: Test failed: got 80004005 msado15.c:179: Test failed: got 80004005 msado15.c:184: Test failed: got 80004005 msado15.c:189: Test failed: got 0 msado15.c:197: Test failed: got 800a0e78 msado15.c:198: Test failed: eof msado15.c:199: Test failed: bof msado15.c:204: Test failed: got 0 msado15.c:217: Test failed: got 800a0e78 msado15.c:223: Test failed: got 800a0e78 msado15.c:228: Test failed: got 800a0e78 msado15.c:229: Test failed: got 10 msado15.c:230: Test failed: got -2147352572 msado15.c:233: Test failed: got 800a0e78 msado15.c:239: Test failed: got 800a0e78 msado15.c:240: Test failed: got 10 msado15.c:242: Test failed: eof msado15.c:243: Test failed: bof msado15.c:246: Test failed: eof msado15.c:252: Test failed: got 800a0e78 msado15.c:253: Test failed: got 10 msado15.c:254: Test failed: got -2147352572 msado15.c:258: Test failed: eof msado15.c:268: Test failed: eof msado15.c:273: Test failed: eof msado15.c:279: Test failed: got 800a0e78 msado15.c:282: Test failed: got 800a0e78
=== debiant2 (32 bit Chinese:China report) ===
msado15: msado15.c:163: Test failed: got 80004005 msado15.c:179: Test failed: got 80004005 msado15.c:184: Test failed: got 80004005 msado15.c:189: Test failed: got 0 msado15.c:197: Test failed: got 800a0e78 msado15.c:198: Test failed: eof msado15.c:199: Test failed: bof msado15.c:204: Test failed: got 0 msado15.c:217: Test failed: got 800a0e78 msado15.c:223: Test failed: got 800a0e78 msado15.c:228: Test failed: got 800a0e78 msado15.c:229: Test failed: got 10 msado15.c:230: Test failed: got -2147352572 msado15.c:233: Test failed: got 800a0e78 msado15.c:239: Test failed: got 800a0e78 msado15.c:240: Test failed: got 10 msado15.c:242: Test failed: eof msado15.c:243: Test failed: bof msado15.c:246: Test failed: eof msado15.c:252: Test failed: got 800a0e78 msado15.c:253: Test failed: got 10 msado15.c:254: Test failed: got -2147352572 msado15.c:258: Test failed: eof msado15.c:268: Test failed: eof msado15.c:273: Test failed: eof msado15.c:279: Test failed: got 800a0e78 msado15.c:282: Test failed: got 800a0e78
=== debiant2 (32 bit WoW report) ===
msado15: msado15.c:163: Test failed: got 80004005 msado15.c:179: Test failed: got 80004005 msado15.c:184: Test failed: got 80004005 msado15.c:189: Test failed: got 0 msado15.c:197: Test failed: got 800a0e78 msado15.c:198: Test failed: eof msado15.c:199: Test failed: bof msado15.c:204: Test failed: got 0 msado15.c:217: Test failed: got 800a0e78 msado15.c:223: Test failed: got 800a0e78 msado15.c:228: Test failed: got 800a0e78 msado15.c:229: Test failed: got 10 msado15.c:230: Test failed: got -2147352572 msado15.c:233: Test failed: got 800a0e78 msado15.c:239: Test failed: got 800a0e78 msado15.c:240: Test failed: got 10 msado15.c:242: Test failed: eof msado15.c:243: Test failed: bof msado15.c:246: Test failed: eof msado15.c:252: Test failed: got 800a0e78 msado15.c:253: Test failed: got 10 msado15.c:254: Test failed: got -2147352572 msado15.c:258: Test failed: eof msado15.c:268: Test failed: eof msado15.c:273: Test failed: eof msado15.c:279: Test failed: got 800a0e78 msado15.c:282: Test failed: got 800a0e78
=== debiant2 (64 bit WoW report) ===
msado15: msado15.c:163: Test failed: got 80004005 msado15.c:179: Test failed: got 80004005 msado15.c:184: Test failed: got 80004005 msado15.c:189: Test failed: got 0 msado15.c:197: Test failed: got 800a0e78 msado15.c:198: Test failed: eof msado15.c:199: Test failed: bof msado15.c:204: Test failed: got 0 msado15.c:217: Test failed: got 800a0e78 msado15.c:223: Test failed: got 800a0e78 msado15.c:228: Test failed: got 800a0e78 msado15.c:229: Test failed: got 10 msado15.c:230: Test failed: got -2147352572 msado15.c:233: Test failed: got 800a0e78 msado15.c:239: Test failed: got 800a0e78 msado15.c:240: Test failed: got 10 msado15.c:242: Test failed: eof msado15.c:243: Test failed: bof msado15.c:246: Test failed: eof msado15.c:252: Test failed: got 800a0e78 msado15.c:253: Test failed: got 10 msado15.c:254: Test failed: got -2147352572 msado15.c:258: Test failed: eof msado15.c:268: Test failed: eof msado15.c:273: Test failed: eof msado15.c:279: Test failed: got 800a0e78 msado15.c:282: Test failed: got 800a0e78
On 2/19/21 11:58 AM, Alistair Leslie-Hughes wrote:
- hr = ADOConnectionConstruction15_get_Session(construct, &session);
- ADOConnectionConstruction15_Release(construct);
- if (FAILED(hr))
return E_FAIL;
- hr = IUnknown_QueryInterface(session, &IID_IOpenRowset, (void**)&openrowset);
- if (FAILED(hr)) return hr;
- hr = IOpenRowset_QueryInterface(openrowset, &IID_IDBCreateCommand, (void**)&create_command);
- if (FAILED(hr))
goto done;
- hr = IDBCreateCommand_CreateCommand(create_command, NULL, &IID_IUnknown, (IUnknown **)&cmd);
- if (FAILED(hr))
goto done;
- hr = ICommand_QueryInterface(cmd, &IID_ICommandText, (void**)&command_text);
- if (FAILED(hr))
- {
FIXME("Currently only ICommandText interface is support\n");
goto done;
- }
- hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, V_BSTR(&source));
- if (FAILED(hr))
goto done;
- hr = ICommandText_Execute(command_text, NULL, &IID_IUnknown, NULL, &affected, &rowset);
- if (FAILED(hr))
goto done;
Most of that could use same pattern as get_Session(), so you don't have to use a block of releases in 'done'.
Is it safe to assume that 'source' is VT_BSTR?
On Fri, 2021-02-19 at 19:58 +1100, Alistair Leslie-Hughes wrote:
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/msado15/recordset.c | 65 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index 12bb9680258..8dab455fb67 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -1182,15 +1182,74 @@ static HRESULT WINAPI recordset_Open( _Recordset *iface, VARIANT source, VARIANT CursorTypeEnum cursor_type, LockTypeEnum lock_type, LONG options ) { struct recordset *recordset = impl_from_Recordset( iface );
- ADOConnectionConstruction15 *construct;
- IUnknown *session = NULL;
- IOpenRowset *openrowset = NULL;
- IDBCreateCommand *create_command = NULL;
- ICommand *cmd = NULL;
- ICommandText *command_text = NULL;
- DBROWCOUNT affected;
- IUnknown *rowset = NULL;
- HRESULT hr;
- FIXME( "%p, %s, %s, %d, %d, %d\n", recordset, debugstr_variant(&source), debugstr_variant(&active_connection),
- FIXME( "%p, %s, %s, %d, %d, %d Semi-stub\n", recordset, debugstr_variant(&source), debugstr_variant(&active_connection),
cursor_type, lock_type, options );
- if (!recordset->fields) return MAKE_ADO_HRESULT( adErrInvalidConnection );
if (recordset->state == adStateOpen) return MAKE_ADO_HRESULT( adErrObjectOpen );
- if (V_VT(&active_connection) != VT_DISPATCH)
- {
FIXME("Unsupported Active connection type %d\n", V_VT(&active_connection));
return E_FAIL;
- }
- hr = IDispatch_QueryInterface(V_DISPATCH(&active_connection), &IID_ADOConnectionConstruction15, (void**)&construct);
- if (FAILED(hr))
return E_FAIL;
- hr = ADOConnectionConstruction15_get_Session(construct, &session);
- ADOConnectionConstruction15_Release(construct);
- if (FAILED(hr))
return E_FAIL;
- hr = IUnknown_QueryInterface(session, &IID_IOpenRowset, (void**)&openrowset);
- if (FAILED(hr)) return hr;
- hr = IOpenRowset_QueryInterface(openrowset, &IID_IDBCreateCommand, (void**)&create_command);
- if (FAILED(hr))
goto done;
- hr = IDBCreateCommand_CreateCommand(create_command, NULL, &IID_IUnknown, (IUnknown **)&cmd);
- if (FAILED(hr))
goto done;
- hr = ICommand_QueryInterface(cmd, &IID_ICommandText, (void**)&command_text);
- if (FAILED(hr))
- {
FIXME("Currently only ICommandText interface is support\n");
goto done;
- }
- hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, V_BSTR(&source));
- if (FAILED(hr))
goto done;
- hr = ICommandText_Execute(command_text, NULL, &IID_IUnknown, NULL, &affected, &rowset);
- if (FAILED(hr))
goto done;
- ADORecordsetConstruction_put_Rowset(&recordset->ADORecordsetConstruction_iface, rowset);
- recordset->cursor_type = cursor_type;
recordset->state = adStateOpen;
- return S_OK;
+done:
- if (session) IUnknown_Release(session);
- if (rowset) IUnknown_Release(rowset);
- if (command_text) ICommandText_Release(command_text);
- if (cmd) ICommand_Release(cmd);
- if (create_command) IDBCreateCommand_Release(create_command);
- if (openrowset) IOpenRowset_Release(openrowset);
- return hr;
}
This shares a lot of code with connection_Execute. I'd suggest to add a helper to execute a command with IOpenRowset.