1 /* OLE DB Conversion library
3 * Copyright 2009 Huw Davies
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define NONAMELESSUNION
24 #define NONAMELESSSTRUCT
31 #include "oledb_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
39 const struct IDataConvertVtbl *lpVtbl;
44 static inline convert *impl_from_IDataConvert(IDataConvert *iface)
46 return (convert *)((char*)iface - FIELD_OFFSET(convert, lpVtbl));
49 static HRESULT WINAPI convert_QueryInterface(IDataConvert* iface,
53 convert *This = impl_from_IDataConvert(iface);
54 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
58 if(IsEqualIID(riid, &IID_IUnknown) ||
59 IsEqualIID(riid, &IID_IDataConvert))
65 FIXME("interface %s not implemented\n", debugstr_guid(riid));
69 IDataConvert_AddRef(iface);
74 static ULONG WINAPI convert_AddRef(IDataConvert* iface)
76 convert *This = impl_from_IDataConvert(iface);
77 TRACE("(%p)\n", This);
79 return InterlockedIncrement(&This->ref);
83 static ULONG WINAPI convert_Release(IDataConvert* iface)
85 convert *This = impl_from_IDataConvert(iface);
88 TRACE("(%p)\n", This);
90 ref = InterlockedDecrement(&This->ref);
93 HeapFree(GetProcessHeap(), 0, This);
99 static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
100 DBTYPE wSrcType, DBTYPE wDstType,
101 DBLENGTH cbSrcLength, DBLENGTH *pcbDstLength,
102 void *pSrc, void *pDst,
103 DBLENGTH cbDstMaxLength,
104 DBSTATUS dbsSrcStatus, DBSTATUS *pdbsDstStatus,
105 BYTE bPrecision, BYTE bScale,
106 DBDATACONVERT dwFlags)
108 convert *This = impl_from_IDataConvert(iface);
109 FIXME("(%p)->(%d, %d, %d, %p, %p, %p, %d, %d, %p, %d, %d, %x): stub\n", This,
110 wSrcType, wDstType, cbSrcLength, pcbDstLength, pSrc, pDst, cbDstMaxLength,
111 dbsSrcStatus, pdbsDstStatus, bPrecision, bScale, dwFlags);
116 static HRESULT WINAPI convert_CanConvert(IDataConvert* iface,
117 DBTYPE wSrcType, DBTYPE wDstType)
119 convert *This = impl_from_IDataConvert(iface);
120 FIXME("(%p)->(%d, %d): stub\n", This, wSrcType, wDstType);
125 static HRESULT WINAPI convert_GetConversionSize(IDataConvert* iface,
126 DBTYPE wSrcType, DBTYPE wDstType,
127 DBLENGTH *pcbSrcLength, DBLENGTH *pcbDstLength,
130 convert *This = impl_from_IDataConvert(iface);
131 FIXME("(%p)->(%d, %d, %p, %p, %p): stub\n", This, wSrcType, wDstType, pcbSrcLength, pcbDstLength, pSrc);
137 static const struct IDataConvertVtbl convert_vtbl =
139 convert_QueryInterface,
144 convert_GetConversionSize
147 HRESULT create_oledb_convert(IUnknown *outer, void **obj)
151 TRACE("(%p, %p)\n", outer, obj);
155 if(outer) return CLASS_E_NOAGGREGATION;
157 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
158 if(!This) return E_OUTOFMEMORY;
160 This->lpVtbl = &convert_vtbl;
163 *obj = &This->lpVtbl;