d3d11/tests: Move the is_warp_device() call out of the loop in check_format_support().
[wine.git] / dlls / msdasql / session.c
blob199eb0830d67e87c5561c163765948b7c1a5b706
1 /*
2 * Copyright 2020 Alistair Leslie-Hughes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "objbase.h"
26 #include "rpcproxy.h"
27 #include "msdasc.h"
28 #include "wine/heap.h"
29 #include "wine/debug.h"
31 #include "msdasql.h"
32 #include "oledberr.h"
33 #include "sqlucode.h"
35 #include "msdasql_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msdasql);
39 struct msdasql_session
41 IUnknown session_iface;
42 IGetDataSource IGetDataSource_iface;
43 IOpenRowset IOpenRowset_iface;
44 ISessionProperties ISessionProperties_iface;
45 IDBCreateCommand IDBCreateCommand_iface;
46 ITransactionJoin ITransactionJoin_iface;
47 ITransaction ITransaction_iface;
48 LONG refs;
50 IUnknown *datasource;
52 HDBC hdbc;
55 static inline struct msdasql_session *impl_from_IUnknown( IUnknown *iface )
57 return CONTAINING_RECORD( iface, struct msdasql_session, session_iface );
60 static inline struct msdasql_session *impl_from_IGetDataSource( IGetDataSource *iface )
62 return CONTAINING_RECORD( iface, struct msdasql_session, IGetDataSource_iface );
65 static inline struct msdasql_session *impl_from_IOpenRowset( IOpenRowset *iface )
67 return CONTAINING_RECORD( iface, struct msdasql_session, IOpenRowset_iface );
70 static inline struct msdasql_session *impl_from_ISessionProperties( ISessionProperties *iface )
72 return CONTAINING_RECORD( iface, struct msdasql_session, ISessionProperties_iface );
75 static inline struct msdasql_session *impl_from_IDBCreateCommand( IDBCreateCommand *iface )
77 return CONTAINING_RECORD( iface, struct msdasql_session, IDBCreateCommand_iface );
80 static inline struct msdasql_session *impl_from_ITransactionJoin( ITransactionJoin *iface )
82 return CONTAINING_RECORD( iface, struct msdasql_session, ITransactionJoin_iface );
85 static inline struct msdasql_session *impl_from_ITransaction( ITransaction *iface )
87 return CONTAINING_RECORD( iface, struct msdasql_session, ITransaction_iface );
90 static HRESULT WINAPI session_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
92 struct msdasql_session *session = impl_from_IUnknown( iface );
94 TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), ppv );
95 *ppv = NULL;
97 if(IsEqualGUID(&IID_IUnknown, riid))
99 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
100 *ppv = &session->session_iface;
102 else if(IsEqualGUID(&IID_IGetDataSource, riid))
104 TRACE("(%p)->(IID_IGetDataSource %p)\n", iface, ppv);
105 *ppv = &session->IGetDataSource_iface;
107 else if(IsEqualGUID(&IID_IOpenRowset, riid))
109 TRACE("(%p)->(IID_IOpenRowset %p)\n", iface, ppv);
110 *ppv = &session->IOpenRowset_iface;
112 else if(IsEqualGUID(&IID_ISessionProperties, riid))
114 TRACE("(%p)->(IID_ISessionProperties %p)\n", iface, ppv);
115 *ppv = &session->ISessionProperties_iface;
117 else if(IsEqualGUID(&IID_IDBCreateCommand, riid))
119 TRACE("(%p)->(IDBCreateCommand_iface %p)\n", iface, ppv);
120 *ppv = &session->IDBCreateCommand_iface;
122 else if(IsEqualGUID(&IID_ITransactionJoin, riid))
124 TRACE("(%p)->(ITransactionJoin %p)\n", iface, ppv);
125 *ppv = &session->ITransactionJoin_iface;
127 else if(IsEqualGUID(&IID_ITransaction, riid))
129 TRACE("(%p)->(ITransaction %p)\n", iface, ppv);
130 *ppv = &session->ITransaction_iface;
132 else if(IsEqualGUID(&IID_IBindResource, riid))
134 TRACE("(%p)->(IID_IBindResource not support)\n", iface);
135 return E_NOINTERFACE;
137 else if(IsEqualGUID(&IID_ICreateRow, riid))
139 TRACE("(%p)->(IID_ICreateRow not support)\n", iface);
140 return E_NOINTERFACE;
143 if(*ppv)
145 IUnknown_AddRef((IUnknown*)*ppv);
146 return S_OK;
149 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
150 return E_NOINTERFACE;
153 static ULONG WINAPI session_AddRef(IUnknown *iface)
155 struct msdasql_session *session = impl_from_IUnknown( iface );
156 LONG refs = InterlockedIncrement( &session->refs );
157 TRACE( "%p new refcount %ld\n", session, refs );
158 return refs;
161 static ULONG WINAPI session_Release(IUnknown *iface)
163 struct msdasql_session *session = impl_from_IUnknown( iface );
164 LONG refs = InterlockedDecrement( &session->refs );
165 TRACE( "%p new refcount %ld\n", session, refs );
166 if (!refs)
168 TRACE( "destroying %p\n", session );
170 IUnknown_Release(session->datasource);
171 heap_free( session );
173 return refs;
176 static const IUnknownVtbl unkfactoryVtbl =
178 session_QueryInterface,
179 session_AddRef,
180 session_Release,
184 HRESULT WINAPI datasource_QueryInterface(IGetDataSource *iface, REFIID riid, void **out)
186 struct msdasql_session *session = impl_from_IGetDataSource( iface );
187 return IUnknown_QueryInterface(&session->session_iface, riid, out);
190 ULONG WINAPI datasource_AddRef(IGetDataSource *iface)
192 struct msdasql_session *session = impl_from_IGetDataSource( iface );
193 return IUnknown_AddRef(&session->session_iface);
196 ULONG WINAPI datasource_Release(IGetDataSource *iface)
198 struct msdasql_session *session = impl_from_IGetDataSource( iface );
199 return IUnknown_Release(&session->session_iface);
202 HRESULT WINAPI datasource_GetDataSource(IGetDataSource *iface, REFIID riid, IUnknown **datasource)
204 struct msdasql_session *session = impl_from_IGetDataSource( iface );
206 TRACE("%p, %s, %p stub\n", session, debugstr_guid(riid), datasource);
208 if (!datasource)
209 return E_INVALIDARG;
211 return IUnknown_QueryInterface(session->datasource, riid, (void**)datasource);
214 static const IGetDataSourceVtbl datasourceVtbl =
216 datasource_QueryInterface,
217 datasource_AddRef,
218 datasource_Release,
219 datasource_GetDataSource
222 HRESULT WINAPI openrowset_QueryInterface(IOpenRowset *iface, REFIID riid, void **out)
224 struct msdasql_session *session = impl_from_IOpenRowset( iface );
225 return IUnknown_QueryInterface(&session->session_iface, riid, out);
228 ULONG WINAPI openrowset_AddRef(IOpenRowset *iface)
230 struct msdasql_session *session = impl_from_IOpenRowset( iface );
231 return IUnknown_AddRef(&session->session_iface);
234 ULONG WINAPI openrowset_Release(IOpenRowset *iface)
236 struct msdasql_session *session = impl_from_IOpenRowset( iface );
237 return IUnknown_Release(&session->session_iface);
240 HRESULT WINAPI openrowset_OpenRowset(IOpenRowset *iface, IUnknown *pUnkOuter, DBID *table,
241 DBID *index, REFIID riid, ULONG count, DBPROPSET propertysets[], IUnknown **rowset)
243 struct msdasql_session *session = impl_from_IOpenRowset( iface );
244 FIXME("%p, %p, %p %p %s, %ld %p %p stub\n", session, pUnkOuter, table, index, debugstr_guid(riid),
245 count, propertysets, rowset);
247 return E_NOTIMPL;
250 static const IOpenRowsetVtbl openrowsetVtbl =
252 openrowset_QueryInterface,
253 openrowset_AddRef,
254 openrowset_Release,
255 openrowset_OpenRowset
258 static HRESULT WINAPI properties_QueryInterface(ISessionProperties *iface, REFIID riid, void **out)
260 struct msdasql_session *session = impl_from_ISessionProperties( iface );
261 return IUnknown_QueryInterface(&session->session_iface, riid, out);
264 static ULONG WINAPI properties_AddRef(ISessionProperties *iface)
266 struct msdasql_session *session = impl_from_ISessionProperties( iface );
267 return IUnknown_AddRef(&session->session_iface);
270 static ULONG WINAPI properties_Release(ISessionProperties *iface)
272 struct msdasql_session *session = impl_from_ISessionProperties( iface );
273 return IUnknown_Release(&session->session_iface);
277 static HRESULT WINAPI properties_GetProperties(ISessionProperties *iface, ULONG set_count,
278 const DBPROPIDSET id_sets[], ULONG *count, DBPROPSET **sets)
280 struct msdasql_session *session = impl_from_ISessionProperties( iface );
281 FIXME("%p %lu %p %p %p\n", session, set_count, id_sets, count, sets);
283 return E_NOTIMPL;
286 static HRESULT WINAPI properties_SetProperties(ISessionProperties *iface, ULONG count,
287 DBPROPSET sets[])
289 struct msdasql_session *session = impl_from_ISessionProperties( iface );
290 FIXME("%p %lu %p\n", session, count, sets);
292 return S_OK;
295 static const ISessionPropertiesVtbl propertiesVtbl =
297 properties_QueryInterface,
298 properties_AddRef,
299 properties_Release,
300 properties_GetProperties,
301 properties_SetProperties
304 static HRESULT WINAPI createcommand_QueryInterface(IDBCreateCommand *iface, REFIID riid, void **out)
306 struct msdasql_session *session = impl_from_IDBCreateCommand( iface );
307 return IUnknown_QueryInterface(&session->session_iface, riid, out);
310 static ULONG WINAPI createcommand_AddRef(IDBCreateCommand *iface)
312 struct msdasql_session *session = impl_from_IDBCreateCommand( iface );
313 return IUnknown_AddRef(&session->session_iface);
316 static ULONG WINAPI createcommand_Release(IDBCreateCommand *iface)
318 struct msdasql_session *session = impl_from_IDBCreateCommand( iface );
319 return IUnknown_Release(&session->session_iface);
322 struct command
324 ICommandText ICommandText_iface;
325 ICommandProperties ICommandProperties_iface;
326 IColumnsInfo IColumnsInfo_iface;
327 IConvertType IConvertType_iface;
328 ICommandPrepare ICommandPrepare_iface;
329 ICommandWithParameters ICommandWithParameters_iface;
330 LONG refs;
331 WCHAR *query;
332 IUnknown *session;
333 HDBC hdbc;
334 SQLHSTMT hstmt;
337 static inline struct command *impl_from_ICommandText( ICommandText *iface )
339 return CONTAINING_RECORD( iface, struct command, ICommandText_iface );
342 static inline struct command *impl_from_ICommandProperties( ICommandProperties *iface )
344 return CONTAINING_RECORD( iface, struct command, ICommandProperties_iface );
347 static inline struct command *impl_from_IColumnsInfo( IColumnsInfo *iface )
349 return CONTAINING_RECORD( iface, struct command, IColumnsInfo_iface );
352 static inline struct command *impl_from_IConvertType( IConvertType *iface )
354 return CONTAINING_RECORD( iface, struct command, IConvertType_iface );
357 static inline struct command *impl_from_ICommandPrepare( ICommandPrepare *iface )
359 return CONTAINING_RECORD( iface, struct command, ICommandPrepare_iface );
362 static inline struct command *impl_from_ICommandWithParameters( ICommandWithParameters *iface )
364 return CONTAINING_RECORD( iface, struct command, ICommandWithParameters_iface );
367 static HRESULT WINAPI command_QueryInterface(ICommandText *iface, REFIID riid, void **ppv)
369 struct command *command = impl_from_ICommandText( iface );
371 TRACE( "%p, %s, %p\n", command, debugstr_guid(riid), ppv );
372 *ppv = NULL;
374 if(IsEqualGUID(&IID_IUnknown, riid) ||
375 IsEqualGUID(&IID_ICommand, riid) ||
376 IsEqualGUID(&IID_ICommandText, riid))
378 *ppv = &command->ICommandText_iface;
380 else if(IsEqualGUID(&IID_ICommandProperties, riid))
382 *ppv = &command->ICommandProperties_iface;
384 else if(IsEqualGUID(&IID_IColumnsInfo, riid))
386 *ppv = &command->IColumnsInfo_iface;
388 else if(IsEqualGUID(&IID_IConvertType, riid))
390 *ppv = &command->IConvertType_iface;
392 else if(IsEqualGUID(&IID_ICommandPrepare, riid))
394 *ppv = &command->ICommandPrepare_iface;
396 else if(IsEqualGUID(&IID_ICommandWithParameters, riid))
398 *ppv = &command->ICommandWithParameters_iface;
401 if(*ppv)
403 IUnknown_AddRef((IUnknown*)*ppv);
404 return S_OK;
406 else if (IsEqualGUID(&IID_IMultipleResults, riid))
408 TRACE("IID_IMultipleResults not supported\n");
409 return E_NOINTERFACE;
411 else if(IsEqualGUID(&IID_ICommandStream, riid))
413 TRACE("ICommandStream not support\n");
414 return E_NOINTERFACE;
416 else if (IsEqualGUID(&IID_IRowsetChange, riid))
418 TRACE("IID_IRowsetChange not supported\n");
419 return E_NOINTERFACE;
421 else if (IsEqualGUID(&IID_IRowsetUpdate, riid))
423 TRACE("IID_IRowsetUpdate not supported\n");
424 return E_NOINTERFACE;
426 else if (IsEqualGUID(&IID_IRowsetLocate, riid))
428 TRACE("IID_IRowsetLocate not supported\n");
429 return E_NOINTERFACE;
432 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
433 return E_NOINTERFACE;
436 static ULONG WINAPI command_AddRef(ICommandText *iface)
438 struct command *command = impl_from_ICommandText( iface );
439 LONG refs = InterlockedIncrement( &command->refs );
440 TRACE( "%p new refcount %ld\n", command, refs );
441 return refs;
444 static ULONG WINAPI command_Release(ICommandText *iface)
446 struct command *command = impl_from_ICommandText( iface );
447 LONG refs = InterlockedDecrement( &command->refs );
448 TRACE( "%p new refcount %ld\n", command, refs );
449 if (!refs)
451 TRACE( "destroying %p\n", command );
452 if (command->session)
453 IUnknown_Release(command->session);
455 if (command->hstmt)
456 SQLFreeHandle(SQL_HANDLE_STMT, command->hstmt);
458 heap_free( command->query );
459 heap_free( command );
461 return refs;
464 static HRESULT WINAPI command_Cancel(ICommandText *iface)
466 struct command *command = impl_from_ICommandText( iface );
467 FIXME("%p\n", command);
468 return E_NOTIMPL;
471 struct msdasql_rowset
473 IRowset IRowset_iface;
474 IRowsetInfo IRowsetInfo_iface;
475 IColumnsInfo IColumnsInfo_iface;
476 IAccessor IAccessor_iface;
477 IColumnsRowset IColumnsRowset_iface;
478 IUnknown *caller;
479 LONG refs;
480 SQLHSTMT hstmt;
483 static inline struct msdasql_rowset *impl_from_IRowset( IRowset *iface )
485 return CONTAINING_RECORD( iface, struct msdasql_rowset, IRowset_iface );
488 static inline struct msdasql_rowset *impl_from_IRowsetInfo( IRowsetInfo *iface )
490 return CONTAINING_RECORD( iface, struct msdasql_rowset, IRowsetInfo_iface );
493 static inline struct msdasql_rowset *rowset_impl_from_IColumnsInfo( IColumnsInfo *iface )
495 return CONTAINING_RECORD( iface, struct msdasql_rowset, IColumnsInfo_iface );
498 static inline struct msdasql_rowset *impl_from_IAccessor ( IAccessor *iface )
500 return CONTAINING_RECORD( iface, struct msdasql_rowset, IAccessor_iface );
503 static inline struct msdasql_rowset *impl_from_IColumnsRowset ( IColumnsRowset *iface )
505 return CONTAINING_RECORD( iface, struct msdasql_rowset, IColumnsRowset_iface );
508 static HRESULT WINAPI msdasql_rowset_QueryInterface(IRowset *iface, REFIID riid, void **ppv)
510 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
512 TRACE( "%p, %s, %p\n", rowset, debugstr_guid(riid), ppv );
514 *ppv = NULL;
515 if(IsEqualGUID(&IID_IUnknown, riid) ||
516 IsEqualGUID(&IID_IRowset, riid))
518 *ppv = &rowset->IRowset_iface;
520 else if (IsEqualGUID(&IID_IRowsetInfo, riid))
522 *ppv = &rowset->IRowsetInfo_iface;
524 else if (IsEqualGUID(&IID_IColumnsInfo, riid))
526 *ppv = &rowset->IColumnsInfo_iface;
528 else if(IsEqualGUID(&IID_IAccessor, riid))
530 *ppv = &rowset->IAccessor_iface;
532 else if(IsEqualGUID(&IID_IColumnsRowset, riid))
534 *ppv = &rowset->IColumnsRowset_iface;
536 else if (IsEqualGUID(&IID_IRowsetChange, riid))
538 TRACE("IID_IRowsetChange not supported\n");
539 return E_NOINTERFACE;
541 else if (IsEqualGUID(&IID_IRowsetUpdate, riid))
543 TRACE("IID_IRowsetUpdate not supported\n");
544 return E_NOINTERFACE;
546 else if (IsEqualGUID(&IID_IRowsetLocate, riid))
548 TRACE("IID_IRowsetLocate not supported\n");
549 return E_NOINTERFACE;
552 if(*ppv)
554 IUnknown_AddRef((IUnknown*)*ppv);
555 return S_OK;
558 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
559 return E_NOINTERFACE;
562 static ULONG WINAPI msdasql_rowset_AddRef(IRowset *iface)
564 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
565 LONG refs = InterlockedIncrement( &rowset->refs );
566 TRACE( "%p new refcount %ld\n", rowset, refs );
567 return refs;
570 static ULONG WINAPI msdasql_rowset_Release(IRowset *iface)
572 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
573 LONG refs = InterlockedDecrement( &rowset->refs );
574 TRACE( "%p new refcount %ld\n", rowset, refs );
575 if (!refs)
577 TRACE( "destroying %p\n", rowset );
579 SQLFreeHandle(SQL_HANDLE_STMT, rowset->hstmt);
581 if (rowset->caller)
582 IUnknown_Release(rowset->caller);
584 heap_free( rowset );
586 return refs;
589 static HRESULT WINAPI msdasql_rowset_AddRefRows(IRowset *iface, DBCOUNTITEM count,
590 const HROW rows[], DBREFCOUNT ref_counts[], DBROWSTATUS status[])
592 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
593 FIXME("%p, %Id, %p, %p, %p\n", rowset, count, rows, ref_counts, status);
594 return E_NOTIMPL;
597 static HRESULT WINAPI msdasql_rowset_GetData(IRowset *iface, HROW row, HACCESSOR accessor, void *data)
599 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
600 FIXME("%p, %Id, %Id, %p\n", rowset, row, accessor, data);
601 return E_NOTIMPL;
604 static HRESULT WINAPI msdasql_rowset_GetNextRows(IRowset *iface, HCHAPTER reserved, DBROWOFFSET offset,
605 DBROWCOUNT count, DBCOUNTITEM *obtained, HROW **rows)
607 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
608 FIXME("%p, %Id, %Id, %Id, %p, %p\n", rowset, reserved, offset, count, obtained, rows);
609 return E_NOTIMPL;
612 static HRESULT WINAPI msdasql_rowset_ReleaseRows(IRowset *iface, DBCOUNTITEM count,
613 const HROW rows[], DBROWOPTIONS options[], DBREFCOUNT ref_counts[], DBROWSTATUS status[])
615 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
617 FIXME("%p, %Id, %p, %p, %p, %p\n", rowset, count, rows, options, ref_counts, status);
618 return E_NOTIMPL;
621 static HRESULT WINAPI msdasql_rowset_RestartPosition(IRowset *iface, HCHAPTER reserved)
623 struct msdasql_rowset *rowset = impl_from_IRowset( iface );
624 FIXME("%p, %Id\n", rowset, reserved);
625 return E_NOTIMPL;
628 static const struct IRowsetVtbl msdasql_rowset_vtbl =
630 msdasql_rowset_QueryInterface,
631 msdasql_rowset_AddRef,
632 msdasql_rowset_Release,
633 msdasql_rowset_AddRefRows,
634 msdasql_rowset_GetData,
635 msdasql_rowset_GetNextRows,
636 msdasql_rowset_ReleaseRows,
637 msdasql_rowset_RestartPosition
640 static HRESULT WINAPI rowset_info_QueryInterface(IRowsetInfo *iface, REFIID riid, void **ppv)
642 struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
643 return IRowset_QueryInterface(&rowset->IRowset_iface, riid, ppv);
646 static ULONG WINAPI rowset_info_AddRef(IRowsetInfo *iface)
648 struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
649 return IRowset_AddRef(&rowset->IRowset_iface);
652 static ULONG WINAPI rowset_info_Release(IRowsetInfo *iface)
654 struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
655 return IRowset_Release(&rowset->IRowset_iface);
658 static HRESULT WINAPI rowset_info_GetProperties(IRowsetInfo *iface, const ULONG count,
659 const DBPROPIDSET propertyidsets[], ULONG *out_count, DBPROPSET **propertysets)
661 struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
662 FIXME("%p, %lu, %p, %p, %p\n", rowset, count, propertyidsets, out_count, propertysets);
663 return E_NOTIMPL;
666 static HRESULT WINAPI rowset_info_GetReferencedRowset(IRowsetInfo *iface, DBORDINAL ordinal,
667 REFIID riid, IUnknown **unk)
669 struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
670 FIXME("%p, %Id, %s, %p\n", rowset, ordinal, debugstr_guid(riid), unk);
671 return E_NOTIMPL;
674 static HRESULT WINAPI rowset_info_GetSpecification(IRowsetInfo *iface, REFIID riid,
675 IUnknown **specification)
677 struct msdasql_rowset *rowset = impl_from_IRowsetInfo( iface );
679 TRACE("%p, %s, %p\n", rowset, debugstr_guid(riid), specification);
681 if (!specification)
682 return E_INVALIDARG;
684 if (!rowset->caller)
685 return S_FALSE;
687 return IUnknown_QueryInterface(rowset->caller, riid, (void**)specification);
690 struct IRowsetInfoVtbl rowset_info_vtbl =
692 rowset_info_QueryInterface,
693 rowset_info_AddRef,
694 rowset_info_Release,
695 rowset_info_GetProperties,
696 rowset_info_GetReferencedRowset,
697 rowset_info_GetSpecification
700 static HRESULT WINAPI rowset_colsinfo_QueryInterface(IColumnsInfo *iface, REFIID riid, void **out)
702 struct msdasql_rowset *rowset = rowset_impl_from_IColumnsInfo( iface );
703 return IRowset_QueryInterface(&rowset->IRowset_iface, riid, out);
706 static ULONG WINAPI rowset_colsinfo_AddRef(IColumnsInfo *iface)
708 struct msdasql_rowset *rowset = rowset_impl_from_IColumnsInfo( iface );
709 return IRowset_AddRef(&rowset->IRowset_iface);
712 static ULONG WINAPI rowset_colsinfo_Release(IColumnsInfo *iface)
714 struct msdasql_rowset *rowset = rowset_impl_from_IColumnsInfo( iface );
715 return IRowset_Release(&rowset->IRowset_iface);
718 static HRESULT WINAPI rowset_colsinfo_GetColumnInfo(IColumnsInfo *iface, DBORDINAL *columns,
719 DBCOLUMNINFO **colinfo, OLECHAR **stringsbuffer)
721 struct msdasql_rowset *rowset = rowset_impl_from_IColumnsInfo( iface );
722 FIXME("%p, %p, %p, %p\n", rowset, columns, colinfo, stringsbuffer);
723 return E_NOTIMPL;
726 static HRESULT WINAPI rowset_colsinfo_MapColumnIDs(IColumnsInfo *iface, DBORDINAL column_ids,
727 const DBID *dbids, DBORDINAL *columns)
729 struct msdasql_rowset *rowset = rowset_impl_from_IColumnsInfo( iface );
730 FIXME("%p, %Id, %p, %p\n", rowset, column_ids, dbids, columns);
731 return E_NOTIMPL;
734 static struct IColumnsInfoVtbl rowset_columninfo_vtbll =
736 rowset_colsinfo_QueryInterface,
737 rowset_colsinfo_AddRef,
738 rowset_colsinfo_Release,
739 rowset_colsinfo_GetColumnInfo,
740 rowset_colsinfo_MapColumnIDs
743 static HRESULT WINAPI rowset_accessor_QueryInterface(IAccessor *iface, REFIID riid, void **out)
745 struct msdasql_rowset *rowset = impl_from_IAccessor( iface );
746 return IRowset_QueryInterface(&rowset->IRowset_iface, riid, out);
749 static ULONG WINAPI rowset_accessor_AddRef(IAccessor *iface)
751 struct msdasql_rowset *rowset = impl_from_IAccessor( iface );
752 return IRowset_AddRef(&rowset->IRowset_iface);
755 static ULONG WINAPI rowset_accessor_Release(IAccessor *iface)
757 struct msdasql_rowset *rowset = impl_from_IAccessor( iface );
758 return IRowset_Release(&rowset->IRowset_iface);
761 static HRESULT WINAPI rowset_accessor_AddRefAccessor(IAccessor *iface, HACCESSOR accessor, DBREFCOUNT *count)
763 struct msdasql_rowset *rowset = impl_from_IAccessor( iface );
764 FIXME("%p, %Id, %p\n", rowset, accessor, count);
765 return E_NOTIMPL;
768 static HRESULT WINAPI rowset_accessor_CreateAccessor(IAccessor *iface, DBACCESSORFLAGS flags,
769 DBCOUNTITEM count, const DBBINDING bindings[], DBLENGTH row_size, HACCESSOR *accessor,
770 DBBINDSTATUS status[])
772 struct msdasql_rowset *rowset = impl_from_IAccessor( iface );
773 FIXME("%p, 0x%08lx, %Id, %p, %Id, %p, %p\n", rowset, flags, count, bindings, row_size, accessor, status);
774 return E_NOTIMPL;
777 static HRESULT WINAPI rowset_accessor_GetBindings(IAccessor *iface, HACCESSOR accessor,
778 DBACCESSORFLAGS *flags, DBCOUNTITEM *count, DBBINDING **bindings)
780 struct msdasql_rowset *rowset = impl_from_IAccessor( iface );
781 FIXME("%p, %Id, %p, %p, %p\n", rowset, accessor, flags, count, bindings);
782 return E_NOTIMPL;
785 static HRESULT WINAPI rowset_accessor_ReleaseAccessor(IAccessor *iface, HACCESSOR accessor, DBREFCOUNT *count)
787 struct msdasql_rowset *rowset = impl_from_IAccessor( iface );
788 FIXME("%p, %Id, %p\n", rowset, accessor, count);
789 return E_NOTIMPL;
792 struct IAccessorVtbl accessor_vtbl =
794 rowset_accessor_QueryInterface,
795 rowset_accessor_AddRef,
796 rowset_accessor_Release,
797 rowset_accessor_AddRefAccessor,
798 rowset_accessor_CreateAccessor,
799 rowset_accessor_GetBindings,
800 rowset_accessor_ReleaseAccessor
803 static HRESULT WINAPI column_rs_QueryInterface(IColumnsRowset *iface, REFIID riid, void **out)
805 struct msdasql_rowset *rowset = impl_from_IColumnsRowset( iface );
806 return IRowset_QueryInterface(&rowset->IRowset_iface, riid, out);
809 static ULONG WINAPI column_rs_AddRef(IColumnsRowset *iface)
811 struct msdasql_rowset *rowset = impl_from_IColumnsRowset( iface );
812 return IRowset_AddRef(&rowset->IRowset_iface);
815 static ULONG WINAPI column_rs_Release(IColumnsRowset *iface)
817 struct msdasql_rowset *rowset = impl_from_IColumnsRowset( iface );
818 return IRowset_Release(&rowset->IRowset_iface);
821 static HRESULT WINAPI column_rs_GetAvailableColumns(IColumnsRowset *iface, DBORDINAL *count, DBID **columns)
823 struct msdasql_rowset *rowset = impl_from_IColumnsRowset( iface );
824 FIXME("%p, %p, %p\n", rowset, count, columns);
825 return E_NOTIMPL;
828 static HRESULT WINAPI column_rs_GetColumnsRowset(IColumnsRowset *iface, IUnknown *outer, DBORDINAL count,
829 const DBID columns[], REFIID riid, ULONG property_cnt, DBPROPSET property_sets[], IUnknown **unk_rs)
831 struct msdasql_rowset *rowset = impl_from_IColumnsRowset( iface );
832 FIXME("(%p)->(%p, %Id, %p, %s, %lu, %p, %p): stub\n", rowset, outer, count, columns, debugstr_guid(riid),
833 property_cnt, property_sets, unk_rs);
834 return E_NOTIMPL;
837 struct IColumnsRowsetVtbl columnrs_rs_vtbl =
839 column_rs_QueryInterface,
840 column_rs_AddRef,
841 column_rs_Release,
842 column_rs_GetAvailableColumns,
843 column_rs_GetColumnsRowset
846 static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFIID riid,
847 DBPARAMS *params, DBROWCOUNT *affected, IUnknown **rowset)
849 struct command *command = impl_from_ICommandText( iface );
850 struct msdasql_rowset *msrowset;
851 HRESULT hr = S_OK;
852 RETCODE ret;
853 SQLHSTMT hstmt = command->hstmt;
854 SQLLEN results = -1;
856 TRACE("%p, %p, %s, %p %p %p\n", command, outer, debugstr_guid(riid), params, affected, rowset);
858 if (!hstmt)
859 SQLAllocHandle(SQL_HANDLE_STMT, command->hdbc, &hstmt);
861 ret = SQLExecDirectW(hstmt, command->query, SQL_NTS);
862 if (ret != SQL_SUCCESS)
864 dump_sql_diag_records(SQL_HANDLE_STMT, hstmt);
865 return E_FAIL;
868 ret = SQLRowCount(hstmt, &results);
869 if (ret != SQL_SUCCESS)
870 ERR("SQLRowCount failed (%d)\n", ret);
872 if (affected)
873 *affected = results;
875 *rowset = NULL;
876 if (!wcsnicmp( command->query, L"select ", 7 ))
878 msrowset = heap_alloc(sizeof(*msrowset));
879 if (!msrowset)
880 return E_OUTOFMEMORY;
882 command->hstmt = NULL;
884 msrowset->IRowset_iface.lpVtbl = &msdasql_rowset_vtbl;
885 msrowset->IRowsetInfo_iface.lpVtbl = &rowset_info_vtbl;
886 msrowset->IColumnsInfo_iface.lpVtbl = &rowset_columninfo_vtbll;
887 msrowset->IAccessor_iface.lpVtbl = &accessor_vtbl;
888 msrowset->IColumnsRowset_iface.lpVtbl = &columnrs_rs_vtbl;
889 msrowset->refs = 1;
890 ICommandText_QueryInterface(iface, &IID_IUnknown, (void**)&msrowset->caller);
891 msrowset->hstmt = hstmt;
893 hr = IRowset_QueryInterface(&msrowset->IRowset_iface, riid, (void**)rowset);
894 IRowset_Release(&msrowset->IRowset_iface);
896 else
897 SQLFreeStmt(hstmt, SQL_CLOSE);
899 return hr;
902 static HRESULT WINAPI command_GetDBSession(ICommandText *iface, REFIID riid, IUnknown **session)
904 struct command *command = impl_from_ICommandText( iface );
906 TRACE("%p, %s, %p\n", command, debugstr_guid(riid), session);
908 if (!session)
909 return E_INVALIDARG;
911 *session = NULL;
913 if (!command->session)
914 return S_FALSE;
916 return IUnknown_QueryInterface(command->session, riid, (void**)session);
919 static HRESULT WINAPI command_GetCommandText(ICommandText *iface, GUID *dialect, LPOLESTR *commandstr)
921 struct command *command = impl_from_ICommandText( iface );
922 HRESULT hr = S_OK;
923 TRACE("%p, %p, %p\n", command, dialect, commandstr);
925 if (!command->query)
926 return DB_E_NOCOMMAND;
928 if (dialect && !IsEqualGUID(&DBGUID_DEFAULT, dialect))
930 *dialect = DBGUID_DEFAULT;
931 hr = DB_S_DIALECTIGNORED;
934 *commandstr = heap_alloc((lstrlenW(command->query)+1)*sizeof(WCHAR));
935 wcscpy(*commandstr, command->query);
936 return hr;
939 static HRESULT WINAPI command_SetCommandText(ICommandText *iface, REFGUID dialect, LPCOLESTR commandstr)
941 struct command *command = impl_from_ICommandText( iface );
942 TRACE("%p, %s, %s\n", command, debugstr_guid(dialect), debugstr_w(commandstr));
944 if (!IsEqualGUID(&DBGUID_DEFAULT, dialect))
945 FIXME("Currently non Default Dialect isn't supported\n");
947 heap_free(command->query);
949 if (commandstr)
951 command->query = heap_alloc((lstrlenW(commandstr)+1)*sizeof(WCHAR));
952 if (!command->query)
953 return E_OUTOFMEMORY;
955 wcscpy(command->query, commandstr);
957 else
958 command->query = NULL;
959 return S_OK;
962 static const ICommandTextVtbl commandVtbl =
964 command_QueryInterface,
965 command_AddRef,
966 command_Release,
967 command_Cancel,
968 command_Execute,
969 command_GetDBSession,
970 command_GetCommandText,
971 command_SetCommandText
974 static HRESULT WINAPI command_prop_QueryInterface(ICommandProperties *iface, REFIID riid, void **out)
976 struct command *command = impl_from_ICommandProperties( iface );
977 return ICommandText_QueryInterface(&command->ICommandText_iface, riid, out);
980 static ULONG WINAPI command_prop_AddRef(ICommandProperties *iface)
982 struct command *command = impl_from_ICommandProperties( iface );
983 return ICommandText_AddRef(&command->ICommandText_iface);
986 static ULONG WINAPI command_prop_Release(ICommandProperties *iface)
988 struct command *command = impl_from_ICommandProperties( iface );
989 return ICommandText_Release(&command->ICommandText_iface);
992 static HRESULT WINAPI command_prop_GetProperties(ICommandProperties *iface, ULONG count,
993 const DBPROPIDSET propertyidsets[], ULONG *sets_cnt, DBPROPSET **propertyset)
995 struct command *command = impl_from_ICommandProperties( iface );
996 FIXME("%p %lu %p %p %p\n", command, count, propertyidsets, sets_cnt, propertyset);
997 return E_NOTIMPL;
1000 static HRESULT WINAPI command_prop_SetProperties(ICommandProperties *iface, ULONG count,
1001 DBPROPSET propertyset[])
1003 struct command *command = impl_from_ICommandProperties( iface );
1004 FIXME("%p, %lu, %p\n", command, count, propertyset);
1005 return S_OK;
1008 static const ICommandPropertiesVtbl commonpropsVtbl =
1010 command_prop_QueryInterface,
1011 command_prop_AddRef,
1012 command_prop_Release,
1013 command_prop_GetProperties,
1014 command_prop_SetProperties
1017 static HRESULT WINAPI colsinfo_QueryInterface(IColumnsInfo *iface, REFIID riid, void **out)
1019 struct command *command = impl_from_IColumnsInfo( iface );
1020 return ICommandText_QueryInterface(&command->ICommandText_iface, riid, out);
1023 static ULONG WINAPI colsinfo_AddRef(IColumnsInfo *iface)
1025 struct command *command = impl_from_IColumnsInfo( iface );
1026 return ICommandText_AddRef(&command->ICommandText_iface);
1029 static ULONG WINAPI colsinfo_Release(IColumnsInfo *iface)
1031 struct command *command = impl_from_IColumnsInfo( iface );
1032 return ICommandText_Release(&command->ICommandText_iface);
1035 static HRESULT WINAPI colsinfo_GetColumnInfo(IColumnsInfo *iface, DBORDINAL *columns,
1036 DBCOLUMNINFO **colinfo, OLECHAR **stringsbuffer)
1038 struct command *command = impl_from_IColumnsInfo( iface );
1039 FIXME("%p, %p, %p, %p\n", command, columns, colinfo, stringsbuffer);
1040 return E_NOTIMPL;
1043 static HRESULT WINAPI colsinfo_MapColumnIDs(IColumnsInfo *iface, DBORDINAL column_ids,
1044 const DBID *dbids, DBORDINAL *columns)
1046 struct command *command = impl_from_IColumnsInfo( iface );
1047 FIXME("%p, %Iu, %p, %p\n", command, column_ids, dbids, columns);
1048 return E_NOTIMPL;
1051 static struct IColumnsInfoVtbl columninfoVtbl =
1053 colsinfo_QueryInterface,
1054 colsinfo_AddRef,
1055 colsinfo_Release,
1056 colsinfo_GetColumnInfo,
1057 colsinfo_MapColumnIDs
1060 static HRESULT WINAPI converttype_QueryInterface(IConvertType *iface, REFIID riid, void **out)
1062 struct command *command = impl_from_IConvertType( iface );
1063 return ICommandText_QueryInterface(&command->ICommandText_iface, riid, out);
1066 static ULONG WINAPI converttype_AddRef(IConvertType *iface)
1068 struct command *command = impl_from_IConvertType( iface );
1069 return ICommandText_AddRef(&command->ICommandText_iface);
1072 static ULONG WINAPI converttype_Release(IConvertType *iface)
1074 struct command *command = impl_from_IConvertType( iface );
1075 return ICommandText_Release(&command->ICommandText_iface);
1078 static HRESULT WINAPI converttype_CanConvert(IConvertType *iface, DBTYPE from, DBTYPE to, DBCONVERTFLAGS flags)
1080 struct command *command = impl_from_IConvertType( iface );
1081 FIXME("%p, %u, %d, 0x%08lx\n", command, from, to, flags);
1082 return E_NOTIMPL;
1085 static struct IConvertTypeVtbl converttypeVtbl =
1087 converttype_QueryInterface,
1088 converttype_AddRef,
1089 converttype_Release,
1090 converttype_CanConvert
1093 static HRESULT WINAPI commandprepare_QueryInterface(ICommandPrepare *iface, REFIID riid, void **out)
1095 struct command *command = impl_from_ICommandPrepare( iface );
1096 return ICommandText_QueryInterface(&command->ICommandText_iface, riid, out);
1099 static ULONG WINAPI commandprepare_AddRef(ICommandPrepare *iface)
1101 struct command *command = impl_from_ICommandPrepare( iface );
1102 return ICommandText_AddRef(&command->ICommandText_iface);
1105 static ULONG WINAPI commandprepare_Release(ICommandPrepare *iface)
1107 struct command *command = impl_from_ICommandPrepare( iface );
1108 return ICommandText_Release(&command->ICommandText_iface);
1111 static HRESULT WINAPI commandprepare_Prepare(ICommandPrepare *iface, ULONG runs)
1113 struct command *command = impl_from_ICommandPrepare( iface );
1114 RETCODE ret;
1116 TRACE("%p, %lu\n", command, runs);
1118 if (!command->query)
1119 return DB_E_NOCOMMAND;
1121 if (command->hstmt)
1122 SQLFreeHandle(SQL_HANDLE_STMT, command->hstmt);
1124 SQLAllocHandle(SQL_HANDLE_STMT, command->hdbc, &command->hstmt);
1126 ret = SQLPrepareW(command->hstmt, command->query, SQL_NTS);
1127 if (ret != SQL_SUCCESS)
1129 dump_sql_diag_records(SQL_HANDLE_STMT, command->hstmt);
1130 return E_FAIL;
1132 return S_OK;
1135 static HRESULT WINAPI commandprepare_Unprepare(ICommandPrepare *iface)
1137 struct command *command = impl_from_ICommandPrepare( iface );
1138 TRACE("%p\n", command);
1139 return S_OK;
1142 struct ICommandPrepareVtbl commandprepareVtbl =
1144 commandprepare_QueryInterface,
1145 commandprepare_AddRef,
1146 commandprepare_Release,
1147 commandprepare_Prepare,
1148 commandprepare_Unprepare
1151 static HRESULT WINAPI cmd_with_params_QueryInterface(ICommandWithParameters *iface, REFIID riid, void **out)
1153 struct command *command = impl_from_ICommandWithParameters( iface );
1154 return ICommandText_QueryInterface(&command->ICommandText_iface, riid, out);
1157 static ULONG WINAPI cmd_with_params_AddRef(ICommandWithParameters *iface)
1159 struct command *command = impl_from_ICommandWithParameters( iface );
1160 return ICommandText_AddRef(&command->ICommandText_iface);
1163 static ULONG WINAPI cmd_with_params_Release(ICommandWithParameters *iface)
1165 struct command *command = impl_from_ICommandWithParameters( iface );
1166 return ICommandText_Release(&command->ICommandText_iface);
1169 static HRESULT WINAPI cmd_with_params_GetParameterInfo(ICommandWithParameters *iface, DB_UPARAMS *uparams,
1170 DBPARAMINFO **info, OLECHAR **buffer)
1172 struct command *command = impl_from_ICommandWithParameters( iface );
1173 FIXME("%p, %p, %p, %p\n", command, uparams, info, buffer);
1174 return E_NOTIMPL;
1177 static HRESULT WINAPI cmd_with_params_MapParameterNames(ICommandWithParameters *iface, DB_UPARAMS uparams,
1178 LPCWSTR names[], DB_LPARAMS ordinals[])
1180 struct command *command = impl_from_ICommandWithParameters( iface );
1181 FIXME("%p, %Iu, %p, %p\n", command, uparams, names, ordinals);
1182 return E_NOTIMPL;
1185 static HRESULT WINAPI cmd_with_params_SetParameterInfo(ICommandWithParameters *iface, DB_UPARAMS uparams,
1186 const DB_UPARAMS ordinals[], const DBPARAMBINDINFO bindinfo[])
1188 struct command *command = impl_from_ICommandWithParameters( iface );
1189 FIXME("%p, %Iu, %p, %p\n", command, uparams, ordinals, bindinfo);
1190 return E_NOTIMPL;
1193 struct ICommandWithParametersVtbl command_with_params_vtbl =
1195 cmd_with_params_QueryInterface,
1196 cmd_with_params_AddRef,
1197 cmd_with_params_Release,
1198 cmd_with_params_GetParameterInfo,
1199 cmd_with_params_MapParameterNames,
1200 cmd_with_params_SetParameterInfo
1203 static HRESULT WINAPI createcommand_CreateCommand(IDBCreateCommand *iface, IUnknown *outer, REFIID riid,
1204 IUnknown **out)
1206 struct msdasql_session *session = impl_from_IDBCreateCommand( iface );
1207 struct command *command;
1208 HRESULT hr;
1210 TRACE("%p, %p, %s, %p\n", session, outer, debugstr_guid(riid), out);
1212 if (outer)
1213 FIXME("Outer not currently supported\n");
1215 command = heap_alloc(sizeof(*command));
1216 if (!command)
1217 return E_OUTOFMEMORY;
1219 command->ICommandText_iface.lpVtbl = &commandVtbl;
1220 command->ICommandProperties_iface.lpVtbl = &commonpropsVtbl;
1221 command->IColumnsInfo_iface.lpVtbl = &columninfoVtbl;
1222 command->IConvertType_iface.lpVtbl = &converttypeVtbl;
1223 command->ICommandPrepare_iface.lpVtbl = &commandprepareVtbl;
1224 command->ICommandWithParameters_iface.lpVtbl = &command_with_params_vtbl;
1225 command->refs = 1;
1226 command->query = NULL;
1227 command->hdbc = session->hdbc;
1228 command->hstmt = NULL;
1230 IUnknown_QueryInterface(&session->session_iface, &IID_IUnknown, (void**)&command->session);
1232 hr = ICommandText_QueryInterface(&command->ICommandText_iface, riid, (void**)out);
1233 ICommandText_Release(&command->ICommandText_iface);
1234 return hr;
1237 static const IDBCreateCommandVtbl createcommandVtbl =
1239 createcommand_QueryInterface,
1240 createcommand_AddRef,
1241 createcommand_Release,
1242 createcommand_CreateCommand
1245 static HRESULT WINAPI transjoin_QueryInterface(ITransactionJoin *iface, REFIID riid, void **out)
1247 struct msdasql_session *session = impl_from_ITransactionJoin( iface );
1248 return IUnknown_QueryInterface(&session->session_iface, riid, out);
1251 static ULONG WINAPI transjoin_AddRef(ITransactionJoin *iface)
1253 struct msdasql_session *session = impl_from_ITransactionJoin( iface );
1254 return IUnknown_AddRef(&session->session_iface);
1257 static ULONG WINAPI transjoin_Release(ITransactionJoin *iface)
1259 struct msdasql_session *session = impl_from_ITransactionJoin( iface );
1260 return IUnknown_Release(&session->session_iface);
1263 static HRESULT WINAPI transjoin_GetOptionsObject(ITransactionJoin *iface, ITransactionOptions **options)
1265 struct msdasql_session *session = impl_from_ITransactionJoin( iface );
1267 FIXME("%p, %p\n", session, options);
1269 return E_NOTIMPL;
1272 static HRESULT WINAPI transjoin_JoinTransaction(ITransactionJoin *iface, IUnknown *unk, ISOLEVEL level,
1273 ULONG flags, ITransactionOptions *options)
1275 struct msdasql_session *session = impl_from_ITransactionJoin( iface );
1277 FIXME("%p, %p, %lu, 0x%08lx, %p\n", session, unk, level, flags, options);
1279 return E_NOTIMPL;
1282 static const ITransactionJoinVtbl transactionjoinVtbl =
1284 transjoin_QueryInterface,
1285 transjoin_AddRef,
1286 transjoin_Release,
1287 transjoin_GetOptionsObject,
1288 transjoin_JoinTransaction
1291 static HRESULT WINAPI transaction_QueryInterface(ITransaction *iface, REFIID riid, void **out)
1293 struct msdasql_session *session = impl_from_ITransaction( iface );
1294 return IUnknown_QueryInterface(&session->session_iface, riid, out);
1297 static ULONG WINAPI transaction_AddRef(ITransaction *iface)
1299 struct msdasql_session *session = impl_from_ITransaction( iface );
1300 return IUnknown_AddRef(&session->session_iface);
1303 static ULONG WINAPI transaction_Release(ITransaction *iface)
1305 struct msdasql_session *session = impl_from_ITransaction( iface );
1306 return IUnknown_Release(&session->session_iface);
1309 static HRESULT WINAPI transaction_Commit(ITransaction *iface, BOOL retaining, DWORD tc, DWORD rm)
1311 struct msdasql_session *session = impl_from_ITransaction( iface );
1313 FIXME("%p, %d, %ld, %ld\n", session, retaining, tc, rm);
1315 return E_NOTIMPL;
1318 static HRESULT WINAPI transaction_Abort(ITransaction *iface, BOID *reason, BOOL retaining, BOOL async)
1320 struct msdasql_session *session = impl_from_ITransaction( iface );
1322 FIXME("%p, %p, %d, %d\n", session, reason, retaining, async);
1324 return E_NOTIMPL;
1327 static HRESULT WINAPI transaction_GetTransactionInfo(ITransaction *iface, XACTTRANSINFO *info)
1329 struct msdasql_session *session = impl_from_ITransaction( iface );
1331 FIXME("%p, %p\n", session, info);
1333 return E_NOTIMPL;
1336 static const ITransactionVtbl transactionVtbl =
1338 transaction_QueryInterface,
1339 transaction_AddRef,
1340 transaction_Release,
1341 transaction_Commit,
1342 transaction_Abort,
1343 transaction_GetTransactionInfo
1346 HRESULT create_db_session(REFIID riid, IUnknown *datasource, HDBC hdbc, void **unk)
1348 struct msdasql_session *session;
1349 HRESULT hr;
1351 session = heap_alloc(sizeof(*session));
1352 if (!session)
1353 return E_OUTOFMEMORY;
1355 session->session_iface.lpVtbl = &unkfactoryVtbl;
1356 session->IGetDataSource_iface.lpVtbl = &datasourceVtbl;
1357 session->IOpenRowset_iface.lpVtbl = &openrowsetVtbl;
1358 session->ISessionProperties_iface.lpVtbl = &propertiesVtbl;
1359 session->IDBCreateCommand_iface.lpVtbl = &createcommandVtbl;
1360 session->ITransactionJoin_iface.lpVtbl = &transactionjoinVtbl;
1361 session->ITransaction_iface.lpVtbl = &transactionVtbl;
1363 IUnknown_QueryInterface(datasource, &IID_IUnknown, (void**)&session->datasource);
1364 session->refs = 1;
1365 session->hdbc = hdbc;
1367 hr = IUnknown_QueryInterface(&session->session_iface, riid, unk);
1368 IUnknown_Release(&session->session_iface);
1369 return hr;