mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 16:53:38 +00:00
msdasql: Always return affected rows if required.
When using msadosql it always returns the number of records affected or records returned by a SELECT statement. The access database, which is what the defaults tests are using doesn't return the number of records for a SELECT. It's a known issue that you have to MoveLast/MoveFirst before the correct RecordCount value is return for an Access DB.
This commit is contained in:
parent
a40d67e04a
commit
5b9496ade6
|
@ -1242,6 +1242,7 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
|
||||||
RETCODE ret;
|
RETCODE ret;
|
||||||
SQLHSTMT hstmt = command->hstmt;
|
SQLHSTMT hstmt = command->hstmt;
|
||||||
SQLLEN results = -1;
|
SQLLEN results = -1;
|
||||||
|
BOOL free_hstmt = TRUE;
|
||||||
|
|
||||||
TRACE("%p, %p, %s, %p %p %p\n", command, outer, debugstr_guid(riid), params, affected, rowset);
|
TRACE("%p, %p, %s, %p %p %p\n", command, outer, debugstr_guid(riid), params, affected, rowset);
|
||||||
|
|
||||||
|
@ -1272,21 +1273,23 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
|
||||||
msrowset->refs = 1;
|
msrowset->refs = 1;
|
||||||
ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller);
|
ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller);
|
||||||
msrowset->hstmt = hstmt;
|
msrowset->hstmt = hstmt;
|
||||||
|
free_hstmt = FALSE;
|
||||||
|
|
||||||
hr = IRowset_QueryInterface(&msrowset->IRowset_iface, riid, (void**)rowset);
|
hr = IRowset_QueryInterface(&msrowset->IRowset_iface, riid, (void**)rowset);
|
||||||
IRowset_Release(&msrowset->IRowset_iface);
|
IRowset_Release(&msrowset->IRowset_iface);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (affected)
|
||||||
{
|
{
|
||||||
ret = SQLRowCount(hstmt, &results);
|
ret = SQLRowCount(hstmt, &results);
|
||||||
if (ret != SQL_SUCCESS)
|
if (ret != SQL_SUCCESS)
|
||||||
ERR("SQLRowCount failed (%d)\n", ret);
|
ERR("SQLRowCount failed (%d)\n", ret);
|
||||||
|
|
||||||
SQLFreeStmt(hstmt, SQL_CLOSE);
|
*affected = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (affected)
|
if (free_hstmt)
|
||||||
*affected = results;
|
SQLFreeStmt(hstmt, SQL_CLOSE);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,6 +569,13 @@ static void test_command_rowset(IUnknown *cmd)
|
||||||
if (unk)
|
if (unk)
|
||||||
IUnknown_Release(unk);
|
IUnknown_Release(unk);
|
||||||
|
|
||||||
|
/* Ensure all rows are deleted - Interactive Test */
|
||||||
|
hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, L"delete from testing");
|
||||||
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
||||||
|
|
||||||
|
hr = ICommandText_Execute(command_text, NULL, &IID_NULL, NULL, NULL, NULL);
|
||||||
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
||||||
|
|
||||||
hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, L"insert into testing values(1, 'red', 1.0)");
|
hr = ICommandText_SetCommandText(command_text, &DBGUID_DEFAULT, L"insert into testing values(1, 'red', 1.0)");
|
||||||
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
||||||
|
|
||||||
|
@ -594,7 +601,7 @@ static void test_command_rowset(IUnknown *cmd)
|
||||||
DBCOLUMNINFO *dbcolinfo;
|
DBCOLUMNINFO *dbcolinfo;
|
||||||
OLECHAR *stringsbuffer;
|
OLECHAR *stringsbuffer;
|
||||||
|
|
||||||
todo_wine ok(affected == -1, "got %Id\n", affected);
|
ok(affected == -1 || affected == 1, "got %Iu\n", affected);
|
||||||
|
|
||||||
hr = IUnknown_QueryInterface(unk, &IID_IRowset, (void**)&rowset);
|
hr = IUnknown_QueryInterface(unk, &IID_IRowset, (void**)&rowset);
|
||||||
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
||||||
|
|
Loading…
Reference in a new issue