2 * Copyright 2019 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
23 #include "msado15_backcompat.h"
25 #include "wine/debug.h"
26 #include "wine/heap.h"
28 #include "msado15_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(msado15
);
34 _Command Command_iface
;
40 static inline struct command
*impl_from_Command( _Command
*iface
)
42 return CONTAINING_RECORD( iface
, struct command
, Command_iface
);
45 static HRESULT WINAPI
command_QueryInterface( _Command
*iface
, REFIID riid
, void **obj
)
47 TRACE( "%p, %s, %p\n", iface
, debugstr_guid(riid
), obj
);
51 if (IsEqualIID(riid
, &IID_IUnknown
) ||
52 IsEqualIID(riid
, &IID_IDispatch
) ||
53 IsEqualIID(riid
, &IID__ADO
) ||
54 IsEqualIID(riid
, &IID_Command15
) ||
55 IsEqualIID(riid
, &IID_Command25
) ||
56 IsEqualIID(riid
, &IID__Command
))
62 FIXME( "interface %s not implemented\n", debugstr_guid(riid
) );
66 _Command_AddRef( iface
);
70 static ULONG WINAPI
command_AddRef( _Command
*iface
)
72 struct command
*command
= impl_from_Command( iface
);
73 return InterlockedIncrement( &command
->ref
);
76 static ULONG WINAPI
command_Release( _Command
*iface
)
78 struct command
*command
= impl_from_Command( iface
);
79 LONG ref
= InterlockedDecrement( &command
->ref
);
82 TRACE( "destroying %p\n", command
);
83 heap_free( command
->text
);
89 static HRESULT WINAPI
command_GetTypeInfoCount( _Command
*iface
, UINT
*count
)
91 FIXME( "%p, %p\n", iface
, count
);
95 static HRESULT WINAPI
command_GetTypeInfo( _Command
*iface
, UINT index
, LCID lcid
, ITypeInfo
**info
)
97 FIXME( "%p, %u, %u, %p\n", iface
, index
, lcid
, info
);
101 static HRESULT WINAPI
command_GetIDsOfNames( _Command
*iface
, REFIID riid
, LPOLESTR
*names
, UINT count
,
102 LCID lcid
, DISPID
*dispid
)
104 FIXME( "%p, %s, %p, %u, %u, %p\n", iface
, debugstr_guid(riid
), names
, count
, lcid
, dispid
);
108 static HRESULT WINAPI
command_Invoke( _Command
*iface
, DISPID member
, REFIID riid
, LCID lcid
, WORD flags
,
109 DISPPARAMS
*params
, VARIANT
*result
, EXCEPINFO
*excep_info
, UINT
*arg_err
)
111 FIXME( "%p, %d, %s, %d, %d, %p, %p, %p, %p\n", iface
, member
, debugstr_guid(riid
), lcid
, flags
, params
,
112 result
, excep_info
, arg_err
);
116 static HRESULT WINAPI
command_get_Properties( _Command
*iface
, Properties
**props
)
118 FIXME( "%p, %p\n", iface
, props
);
122 static HRESULT WINAPI
command_get_ActiveConnection( _Command
*iface
, _Connection
**connection
)
124 FIXME( "%p, %p\n", iface
, connection
);
128 static HRESULT WINAPI
command_putref_ActiveConnection( _Command
*iface
, _Connection
*connection
)
130 FIXME( "%p, %p\n", iface
, connection
);
134 static HRESULT WINAPI
command_put_ActiveConnection( _Command
*iface
, VARIANT connection
)
136 FIXME( "%p, %s\n", iface
, debugstr_variant(&connection
) );
140 static HRESULT WINAPI
command_get_CommandText( _Command
*iface
, BSTR
*text
)
142 struct command
*command
= impl_from_Command( iface
);
143 BSTR cmd_text
= NULL
;
145 TRACE( "%p, %p\n", command
, text
);
147 if (command
->text
&& !(cmd_text
= SysAllocString( command
->text
))) return E_OUTOFMEMORY
;
152 static HRESULT WINAPI
command_put_CommandText( _Command
*iface
, BSTR text
)
154 struct command
*command
= impl_from_Command( iface
);
155 WCHAR
*source
= NULL
;
157 TRACE( "%p, %s\n", command
, debugstr_w( text
) );
159 if (text
&& !(source
= strdupW( text
))) return E_OUTOFMEMORY
;
160 heap_free( command
->text
);
161 command
->text
= source
;
165 static HRESULT WINAPI
command_get_CommandTimeout( _Command
*iface
, LONG
*timeout
)
167 FIXME( "%p, %p\n", iface
, timeout
);
171 static HRESULT WINAPI
command_put_CommandTimeout( _Command
*iface
, LONG timeout
)
173 FIXME( "%p, %d\n", iface
, timeout
);
177 static HRESULT WINAPI
command_get_Prepared( _Command
*iface
, VARIANT_BOOL
*prepared
)
179 FIXME( "%p, %p\n", iface
, prepared
);
183 static HRESULT WINAPI
command_put_Prepared( _Command
*iface
, VARIANT_BOOL prepared
)
185 FIXME( "%p, %d\n", iface
, prepared
);
189 static HRESULT WINAPI
command_Execute( _Command
*iface
, VARIANT
*affected
, VARIANT
*parameters
,
190 LONG options
, _Recordset
**recordset
)
192 FIXME( "%p, %p, %p, %d, %p\n", iface
, affected
, parameters
, options
, recordset
);
196 static HRESULT WINAPI
command_CreateParameter( _Command
*iface
, BSTR name
, DataTypeEnum type
,
197 ParameterDirectionEnum direction
, LONG size
, VARIANT value
,
198 _Parameter
**parameter
)
200 FIXME( "%p, %s, %d, %d, %d, %p\n", iface
, debugstr_w(name
), type
, direction
, size
, parameter
);
204 static HRESULT WINAPI
command_get_Parameters( _Command
*iface
, Parameters
**parameters
)
206 FIXME( "%p, %p\n", iface
, parameters
);
210 static HRESULT WINAPI
command_put_CommandType( _Command
*iface
, CommandTypeEnum type
)
212 struct command
*command
= impl_from_Command( iface
);
214 TRACE( "%p, %d\n", iface
, type
);
218 case adCmdUnspecified
:
222 case adCmdStoredProc
:
224 case adCmdTableDirect
:
225 command
->type
= type
;
229 return MAKE_ADO_HRESULT( adErrInvalidArgument
);
232 static HRESULT WINAPI
command_get_CommandType( _Command
*iface
, CommandTypeEnum
*type
)
234 struct command
*command
= impl_from_Command( iface
);
236 TRACE( "%p, %p\n", iface
, type
);
238 *type
= command
->type
;
242 static HRESULT WINAPI
command_get_Name(_Command
*iface
, BSTR
*name
)
244 FIXME( "%p, %p\n", iface
, name
);
248 static HRESULT WINAPI
command_put_Name( _Command
*iface
, BSTR name
)
250 FIXME( "%p, %s\n", iface
, debugstr_w(name
) );
254 static HRESULT WINAPI
command_get_State( _Command
*iface
, LONG
*state
)
256 FIXME( "%p, %p\n", iface
, state
);
260 static HRESULT WINAPI
command_Cancel( _Command
*iface
)
262 FIXME( "%p\n", iface
);
266 static HRESULT WINAPI
command_putref_CommandStream( _Command
*iface
, IUnknown
*stream
)
268 FIXME( "%p, %p\n", iface
, stream
);
272 static HRESULT WINAPI
command_get_CommandStream( _Command
*iface
, VARIANT
*stream
)
274 FIXME( "%p, %p\n", iface
, stream
);
278 static HRESULT WINAPI
command_put_Dialect( _Command
*iface
, BSTR dialect
)
280 FIXME( "%p, %s\n", iface
, debugstr_w(dialect
) );
284 static HRESULT WINAPI
command_get_Dialect( _Command
*iface
, BSTR
*dialect
)
286 FIXME( "%p, %p\n", iface
, dialect
);
290 static HRESULT WINAPI
command_put_NamedParameters( _Command
*iface
, VARIANT_BOOL parameters
)
292 FIXME( "%p, %d\n", iface
, parameters
);
296 static HRESULT WINAPI
command_get_NamedParameters( _Command
*iface
, VARIANT_BOOL
*parameters
)
298 FIXME( "%p, %p\n", iface
, parameters
);
302 static const struct _CommandVtbl command_vtbl
=
304 command_QueryInterface
,
307 command_GetTypeInfoCount
,
309 command_GetIDsOfNames
,
311 command_get_Properties
,
312 command_get_ActiveConnection
,
313 command_putref_ActiveConnection
,
314 command_put_ActiveConnection
,
315 command_get_CommandText
,
316 command_put_CommandText
,
317 command_get_CommandTimeout
,
318 command_put_CommandTimeout
,
319 command_get_Prepared
,
320 command_put_Prepared
,
322 command_CreateParameter
,
323 command_get_Parameters
,
324 command_put_CommandType
,
325 command_get_CommandType
,
330 command_putref_CommandStream
,
331 command_get_CommandStream
,
334 command_put_NamedParameters
,
335 command_get_NamedParameters
338 HRESULT
Command_create( void **obj
)
340 struct command
*command
;
342 if (!(command
= heap_alloc( sizeof(*command
) ))) return E_OUTOFMEMORY
;
343 command
->Command_iface
.lpVtbl
= &command_vtbl
;
344 command
->type
= adCmdUnknown
;
345 command
->text
= NULL
;
348 *obj
= &command
->Command_iface
;
349 TRACE( "returning iface %p\n", *obj
);