msdasql: Implement ICommandText GetDBSession.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3dd785def7
commit
dd279bd015
|
@ -285,6 +285,7 @@ struct command
|
|||
ICommandPrepare ICommandPrepare_iface;
|
||||
LONG refs;
|
||||
WCHAR *query;
|
||||
IUnknown *session;
|
||||
};
|
||||
|
||||
static inline struct command *impl_from_ICommandText( ICommandText *iface )
|
||||
|
@ -393,6 +394,8 @@ static ULONG WINAPI command_Release(ICommandText *iface)
|
|||
if (!refs)
|
||||
{
|
||||
TRACE( "destroying %p\n", command );
|
||||
if (command->session)
|
||||
IUnknown_Release(command->session);
|
||||
heap_free( command->query );
|
||||
heap_free( command );
|
||||
}
|
||||
|
@ -417,8 +420,18 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
|
|||
static HRESULT WINAPI command_GetDBSession(ICommandText *iface, REFIID riid, IUnknown **session)
|
||||
{
|
||||
struct command *command = impl_from_ICommandText( iface );
|
||||
FIXME("%p, %s, %p\n", command, debugstr_guid(riid), session);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("%p, %s, %p\n", command, debugstr_guid(riid), session);
|
||||
|
||||
if (!session)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*session = NULL;
|
||||
|
||||
if (!command->session)
|
||||
return S_FALSE;
|
||||
|
||||
return IUnknown_QueryInterface(command->session, riid, (void**)session);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI command_GetCommandText(ICommandText *iface, GUID *dialect, LPOLESTR *commandstr)
|
||||
|
@ -656,6 +669,8 @@ static HRESULT WINAPI createcommand_CreateCommand(IDBCreateCommand *iface, IUnkn
|
|||
command->ICommandPrepare_iface.lpVtbl = &commandprepareVtbl;
|
||||
command->refs = 1;
|
||||
|
||||
IUnknown_QueryInterface(&session->session_iface, &IID_IUnknown, (void**)&command->session);
|
||||
|
||||
hr = ICommandText_QueryInterface(&command->ICommandText_iface, riid, (void**)out);
|
||||
ICommandText_Release(&command->ICommandText_iface);
|
||||
return hr;
|
||||
|
|
|
@ -206,6 +206,22 @@ if (0)
|
|||
ICommandText_Release(comand_text);
|
||||
}
|
||||
|
||||
static void test_command_dbsession(IUnknown *cmd, IUnknown *session)
|
||||
{
|
||||
ICommandText *comand_text;
|
||||
HRESULT hr;
|
||||
IUnknown *sess;
|
||||
|
||||
hr = IUnknown_QueryInterface(cmd, &IID_ICommandText, (void**)&comand_text);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = ICommandText_GetDBSession(comand_text, &IID_IUnknown, &sess);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(session == sess, "different session pointers\n");
|
||||
|
||||
ICommandText_Release(comand_text);
|
||||
}
|
||||
|
||||
static void test_sessions(void)
|
||||
{
|
||||
IDBProperties *props;
|
||||
|
@ -281,6 +297,7 @@ static void test_sessions(void)
|
|||
{
|
||||
test_command_interfaces(cmd);
|
||||
test_command_text(cmd);
|
||||
test_command_dbsession(cmd, session);
|
||||
IUnknown_Release(cmd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue