oledb32: Stub for IRowPosition.

This commit is contained in:
Nikolay Sivov 2013-08-01 07:48:13 +04:00 committed by Alexandre Julliard
parent 8fcac3b2bb
commit 6297ba3dcb
7 changed files with 192 additions and 1 deletions

View File

@ -6,7 +6,8 @@ C_SRCS = \
convert.c \
datainit.c \
errorinfo.c \
main.c
main.c \
rowpos.c
IDL_I_SRCS = convert.idl

View File

@ -129,6 +129,7 @@ static const IClassFactoryVtbl CF_Vtbl =
static cf oledb_convert_cf = { { &CF_Vtbl }, create_oledb_convert };
static cf oledb_datainit_cf = { { &CF_Vtbl }, create_data_init };
static cf oledb_errorinfo_cf = { { &CF_Vtbl }, create_error_info };
static cf oledb_rowpos_cf = { { &CF_Vtbl }, create_oledb_rowpos };
/******************************************************************
* DllGetClassObject
@ -152,6 +153,11 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **obj)
*obj = &oledb_errorinfo_cf;
return S_OK;
}
else if ( IsEqualCLSID (rclsid, &CLSID_OLEDB_ROWPOSITIONLIBRARY) )
{
*obj = &oledb_rowpos_cf;
return S_OK;
}
return CLASS_E_CLASSNOTAVAILABLE;
}

View File

@ -41,3 +41,15 @@ coclass OLEDB_CONVERSIONLIBRARY
coclass OLEDB_MSDAER
{
}
[
helpstring("OLE DB Row Position Library"),
threading(both),
progid("RowPosition.RowPosition.1"),
vi_progid("RowPosition.RowPosition"),
uuid(2048eee6-7fa2-11d0-9e6a-00a0c9138c29)
]
coclass OLEDB_ROWPOSITIONLIBRARY
{
interface IRowPosition;
}

View File

@ -20,3 +20,4 @@
HRESULT create_oledb_convert(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT create_data_init(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT create_error_info(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;
HRESULT create_oledb_rowpos(IUnknown *outer, void **obj) DECLSPEC_HIDDEN;

155
dlls/oledb32/rowpos.c Normal file
View File

@ -0,0 +1,155 @@
/* OLE DB Row Position library
*
* Copyright 2013 Nikolay Sivov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "windef.h"
#include "ole2.h"
#include "oledb.h"
#include "oledb_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(oledb);
typedef struct
{
IRowPosition IRowPosition_iface;
LONG ref;
} rowpos;
static inline rowpos *impl_from_IRowPosition(IRowPosition *iface)
{
return CONTAINING_RECORD(iface, rowpos, IRowPosition_iface);
}
static HRESULT WINAPI rowpos_QueryInterface(IRowPosition* iface, REFIID riid, void **obj)
{
rowpos *This = impl_from_IRowPosition(iface);
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
*obj = NULL;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IRowPosition))
{
*obj = iface;
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IRowPosition_AddRef(iface);
return S_OK;
}
static ULONG WINAPI rowpos_AddRef(IRowPosition* iface)
{
rowpos *This = impl_from_IRowPosition(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
return ref;
}
static ULONG WINAPI rowpos_Release(IRowPosition* iface)
{
rowpos *This = impl_from_IRowPosition(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
static HRESULT WINAPI rowpos_ClearRowPosition(IRowPosition* iface)
{
rowpos *This = impl_from_IRowPosition(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI rowpos_GetRowPosition(IRowPosition *iface, HCHAPTER *chapter,
HROW *row, DBPOSITIONFLAGS *flags)
{
rowpos *This = impl_from_IRowPosition(iface);
FIXME("(%p)->(%p %p %p): stub\n", This, chapter, row, flags);
return E_NOTIMPL;
}
static HRESULT WINAPI rowpos_GetRowset(IRowPosition *iface, REFIID riid, IUnknown **rowset)
{
rowpos *This = impl_from_IRowPosition(iface);
FIXME("(%p)->(%s %p): stub\n", This, debugstr_guid(riid), rowset);
return E_NOTIMPL;
}
static HRESULT WINAPI rowpos_Initialize(IRowPosition *iface, IUnknown *rowset)
{
rowpos *This = impl_from_IRowPosition(iface);
FIXME("(%p)->(%p): stub\n", This, rowset);
return E_NOTIMPL;
}
static HRESULT WINAPI rowpos_SetRowPosition(IRowPosition *iface, HCHAPTER chapter,
HROW row, DBPOSITIONFLAGS flags)
{
rowpos *This = impl_from_IRowPosition(iface);
FIXME("(%p)->(%lx %lx %d): stub\n", This, chapter, row, flags);
return E_NOTIMPL;
}
static const struct IRowPositionVtbl rowpos_vtbl =
{
rowpos_QueryInterface,
rowpos_AddRef,
rowpos_Release,
rowpos_ClearRowPosition,
rowpos_GetRowPosition,
rowpos_GetRowset,
rowpos_Initialize,
rowpos_SetRowPosition
};
HRESULT create_oledb_rowpos(IUnknown *outer, void **obj)
{
rowpos *This;
TRACE("(%p, %p)\n", outer, obj);
*obj = NULL;
if(outer) return CLASS_E_NOAGGREGATION;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if(!This) return E_OUTOFMEMORY;
This->IRowPosition_iface.lpVtbl = &rowpos_vtbl;
This->ref = 1;
*obj = &This->IRowPosition_iface;
return S_OK;
}

View File

@ -28,6 +28,7 @@
#include "msdadc.h"
#include "msdasc.h"
#include "shlobj.h"
#include "msdaguid.h"
#include "initguid.h"
#include "wine/test.h"
@ -185,6 +186,17 @@ static void test_initializationstring(void)
}
}
static void test_rowposition(void)
{
IRowPosition *rowpos;
HRESULT hr;
hr = CoCreateInstance(&CLSID_OLEDB_ROWPOSITIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IRowPosition, (void**)&rowpos);
ok(hr == S_OK, "got %08x\n", hr);
IRowPosition_Release(rowpos);
}
START_TEST(database)
{
OleInitialize(NULL);
@ -193,5 +205,8 @@ START_TEST(database)
test_errorinfo();
test_initializationstring();
/* row position */
test_rowposition();
OleUninitialize();
}

View File

@ -22,5 +22,6 @@
DEFINE_GUID(CLSID_EXTENDEDERRORINFO, 0xc8b522cf, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);
DEFINE_GUID(CLSID_OLEDB_ENUMERATOR, 0xc8b522d0, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);
DEFINE_GUID(CLSID_OLEDB_CONVERSIONLIBRARY, 0xc8b522d1, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);
DEFINE_GUID(CLSID_OLEDB_ROWPOSITIONLIBRARY,0x2048eee6, 0x7fa2, 0x11d0, 0x9e, 0x6a, 0x00, 0xa0, 0xc9, 0x13, 0x8c, 0x29);
#endif /*__WINE_MSDAGUID_H */