Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msdasql/session.c | 68 +++++++++++++++++++++++++++++++++++ dlls/msdasql/tests/provider.c | 5 ++- 2 files changed, 70 insertions(+), 3 deletions(-)
diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c index e58d152a418..901a763924d 100644 --- a/dlls/msdasql/session.c +++ b/dlls/msdasql/session.c @@ -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, %d, %d\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; diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c index ee81ad1d311..22fbf26c107 100644 --- a/dlls/msdasql/tests/provider.c +++ b/dlls/msdasql/tests/provider.c @@ -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);