Commit 35cf06c3 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msdasql: Add ITransaction to session interface.

parent 0b977672
......@@ -44,6 +44,7 @@ struct msdasql_session
ISessionProperties ISessionProperties_iface;
IDBCreateCommand IDBCreateCommand_iface;
ITransactionJoin ITransactionJoin_iface;
ITransaction ITransaction_iface;
LONG refs;
IUnknown *datasource;
......@@ -81,6 +82,11 @@ static inline struct msdasql_session *impl_from_ITransactionJoin( ITransactionJo
return CONTAINING_RECORD( iface, struct msdasql_session, ITransactionJoin_iface );
}
static inline struct msdasql_session *impl_from_ITransaction( ITransaction *iface )
{
return CONTAINING_RECORD( iface, struct msdasql_session, ITransaction_iface );
}
static HRESULT WINAPI session_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
struct msdasql_session *session = impl_from_IUnknown( iface );
......@@ -118,6 +124,11 @@ static HRESULT WINAPI session_QueryInterface(IUnknown *iface, REFIID riid, void
TRACE("(%p)->(ITransactionJoin %p)\n", iface, ppv);
*ppv = &session->ITransactionJoin_iface;
}
else if(IsEqualGUID(&IID_ITransaction, riid))
{
TRACE("(%p)->(ITransaction %p)\n", iface, ppv);
*ppv = &session->ITransaction_iface;
}
else if(IsEqualGUID(&IID_IBindResource, riid))
{
TRACE("(%p)->(IID_IBindResource not support)\n", iface);
......@@ -1248,6 +1259,61 @@ static const ITransactionJoinVtbl transactionjoinVtbl =
transjoin_JoinTransaction
};
static HRESULT WINAPI transaction_QueryInterface(ITransaction *iface, REFIID riid, void **out)
{
struct msdasql_session *session = impl_from_ITransaction( iface );
return IUnknown_QueryInterface(&session->session_iface, riid, out);
}
static ULONG WINAPI transaction_AddRef(ITransaction *iface)
{
struct msdasql_session *session = impl_from_ITransaction( iface );
return IUnknown_AddRef(&session->session_iface);
}
static ULONG WINAPI transaction_Release(ITransaction *iface)
{
struct msdasql_session *session = impl_from_ITransaction( iface );
return IUnknown_Release(&session->session_iface);
}
static HRESULT WINAPI transaction_Commit(ITransaction *iface, BOOL retaining, DWORD tc, DWORD rm)
{
struct msdasql_session *session = impl_from_ITransaction( iface );
FIXME("%p, %d, %ld, %ld\n", session, retaining, tc, rm);
return E_NOTIMPL;
}
static HRESULT WINAPI transaction_Abort(ITransaction *iface, BOID *reason, BOOL retaining, BOOL async)
{
struct msdasql_session *session = impl_from_ITransaction( iface );
FIXME("%p, %p, %d, %d\n", session, reason, retaining, async);
return E_NOTIMPL;
}
static HRESULT WINAPI transaction_GetTransactionInfo(ITransaction *iface, XACTTRANSINFO *info)
{
struct msdasql_session *session = impl_from_ITransaction( iface );
FIXME("%p, %p\n", session, info);
return E_NOTIMPL;
}
static const ITransactionVtbl transactionVtbl =
{
transaction_QueryInterface,
transaction_AddRef,
transaction_Release,
transaction_Commit,
transaction_Abort,
transaction_GetTransactionInfo
};
HRESULT create_db_session(REFIID riid, IUnknown *datasource, HDBC hdbc, void **unk)
{
struct msdasql_session *session;
......@@ -1263,6 +1329,8 @@ HRESULT create_db_session(REFIID riid, IUnknown *datasource, HDBC hdbc, void **u
session->ISessionProperties_iface.lpVtbl = &propertiesVtbl;
session->IDBCreateCommand_iface.lpVtbl = &createcommandVtbl;
session->ITransactionJoin_iface.lpVtbl = &transactionjoinVtbl;
session->ITransaction_iface.lpVtbl = &transactionVtbl;
IUnknown_QueryInterface(datasource, &IID_IUnknown, (void**)&session->datasource);
session->refs = 1;
session->hdbc = hdbc;
......
......@@ -481,9 +481,8 @@ static void test_sessions(void)
IGetDataSource_Release(datasource);
hr = IUnknown_QueryInterface(session, &IID_ITransaction, (void**)&transaction);
todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
if(hr == S_OK)
ITransaction_Release(transaction);
ok(hr == S_OK, "got 0x%08x\n", hr);
ITransaction_Release(transaction);
hr = IUnknown_QueryInterface(session, &IID_ITransactionLocal, (void**)&local);
todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment