Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3dd785de
Commit
3dd785de
authored
Oct 31, 2021
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Oct 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msdasql: Implement ICommandText Get/Set CommandText.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
22689f6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
3 deletions
+84
-3
msdasql_main.c
dlls/msdasql/msdasql_main.c
+2
-0
session.c
dlls/msdasql/session.c
+32
-3
provider.c
dlls/msdasql/tests/provider.c
+50
-0
No files found.
dlls/msdasql/msdasql_main.c
View file @
3dd785de
...
...
@@ -36,6 +36,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msdasql);
DEFINE_GUID
(
DBPROPSET_DBINIT
,
0xc8b522bc
,
0x5cf3
,
0x11ce
,
0xad
,
0xe5
,
0x00
,
0xaa
,
0x00
,
0x44
,
0x77
,
0x3d
);
DEFINE_GUID
(
DBGUID_DEFAULT
,
0xc8b521fb
,
0x5cf3
,
0x11ce
,
0xad
,
0xe5
,
0x00
,
0xaa
,
0x00
,
0x44
,
0x77
,
0x3d
);
static
HRESULT
WINAPI
ClassFactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
*
ppv
=
NULL
;
...
...
dlls/msdasql/session.c
View file @
3dd785de
...
...
@@ -29,6 +29,7 @@
#include "wine/debug.h"
#include "msdasql.h"
#include "oledberr.h"
#include "msdasql_private.h"
...
...
@@ -283,6 +284,7 @@ struct command
IConvertType
IConvertType_iface
;
ICommandPrepare
ICommandPrepare_iface
;
LONG
refs
;
WCHAR
*
query
;
};
static
inline
struct
command
*
impl_from_ICommandText
(
ICommandText
*
iface
)
...
...
@@ -391,6 +393,7 @@ static ULONG WINAPI command_Release(ICommandText *iface)
if
(
!
refs
)
{
TRACE
(
"destroying %p
\n
"
,
command
);
heap_free
(
command
->
query
);
heap_free
(
command
);
}
return
refs
;
...
...
@@ -421,14 +424,40 @@ static HRESULT WINAPI command_GetDBSession(ICommandText *iface, REFIID riid, IUn
static
HRESULT
WINAPI
command_GetCommandText
(
ICommandText
*
iface
,
GUID
*
dialect
,
LPOLESTR
*
commandstr
)
{
struct
command
*
command
=
impl_from_ICommandText
(
iface
);
FIXME
(
"%p, %p, %p
\n
"
,
command
,
dialect
,
commandstr
);
return
E_NOTIMPL
;
HRESULT
hr
=
S_OK
;
TRACE
(
"%p, %p, %p
\n
"
,
command
,
dialect
,
commandstr
);
if
(
!
command
->
query
)
return
DB_E_NOCOMMAND
;
if
(
IsEqualGUID
(
&
DBGUID_DEFAULT
,
dialect
))
hr
=
DB_S_DIALECTIGNORED
;
*
commandstr
=
heap_alloc
((
lstrlenW
(
command
->
query
)
+
1
)
*
sizeof
(
WCHAR
));
wcscpy
(
*
commandstr
,
command
->
query
);
return
hr
;
}
static
HRESULT
WINAPI
command_SetCommandText
(
ICommandText
*
iface
,
REFGUID
dialect
,
LPCOLESTR
commandstr
)
{
struct
command
*
command
=
impl_from_ICommandText
(
iface
);
FIXME
(
"%p, %s, %s
\n
"
,
command
,
debugstr_guid
(
dialect
),
debugstr_w
(
commandstr
));
TRACE
(
"%p, %s, %s
\n
"
,
command
,
debugstr_guid
(
dialect
),
debugstr_w
(
commandstr
));
if
(
IsEqualGUID
(
&
DBGUID_DEFAULT
,
dialect
))
FIXME
(
"Currently non Default Dialect isn't supported
\n
"
);
heap_free
(
command
->
query
);
if
(
commandstr
)
{
command
->
query
=
heap_alloc
((
lstrlenW
(
commandstr
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
command
->
query
)
return
E_OUTOFMEMORY
;
wcscpy
(
command
->
query
,
commandstr
);
}
else
command
->
query
=
NULL
;
return
S_OK
;
}
...
...
dlls/msdasql/tests/provider.c
View file @
3dd785de
...
...
@@ -27,12 +27,15 @@
#include "initguid.h"
#include "msdasql.h"
#include "oledberr.h"
#include "wine/test.h"
DEFINE_GUID
(
DBPROPSET_DBINITALL
,
0xc8b522ca
,
0x5cf3
,
0x11ce
,
0xad
,
0xe5
,
0x00
,
0xaa
,
0x00
,
0x44
,
0x77
,
0x3d
);
DEFINE_GUID
(
DBPROPSET_DBINIT
,
0xc8b522bc
,
0x5cf3
,
0x11ce
,
0xad
,
0xe5
,
0x00
,
0xaa
,
0x00
,
0x44
,
0x77
,
0x3d
);
DEFINE_GUID
(
DBGUID_DEFAULT
,
0xc8b521fb
,
0x5cf3
,
0x11ce
,
0xad
,
0xe5
,
0x00
,
0xaa
,
0x00
,
0x44
,
0x77
,
0x3d
);
static
BOOL
db_created
;
static
char
mdbpath
[
MAX_PATH
];
...
...
@@ -157,6 +160,52 @@ static void test_command_interfaces(IUnknown *cmd)
ok
(
hr
==
E_NOINTERFACE
,
"got 0x%08x
\n
"
,
hr
);
}
static
void
test_command_text
(
IUnknown
*
cmd
)
{
ICommandText
*
comand_text
;
HRESULT
hr
;
OLECHAR
*
str
;
GUID
dialect
;
hr
=
IUnknown_QueryInterface
(
cmd
,
&
IID_ICommandText
,
(
void
**
)
&
comand_text
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICommandText_GetCommandText
(
comand_text
,
&
dialect
,
&
str
);
ok
(
hr
==
DB_E_NOCOMMAND
,
"got 0x%08x
\n
"
,
hr
);
if
(
0
)
{
/* Crashes under windows */
hr
=
ICommandText_SetCommandText
(
comand_text
,
NULL
,
L"select * from testing"
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
}
hr
=
ICommandText_SetCommandText
(
comand_text
,
&
DBGUID_DEFAULT
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICommandText_GetCommandText
(
comand_text
,
&
dialect
,
&
str
);
ok
(
hr
==
DB_E_NOCOMMAND
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICommandText_SetCommandText
(
comand_text
,
&
DBGUID_DEFAULT
,
L"select * from testing"
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* dialect empty value */
hr
=
ICommandText_GetCommandText
(
comand_text
,
&
dialect
,
&
str
);
ok
(
hr
==
DB_S_DIALECTIGNORED
,
"got 0x%08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
DBGUID_DEFAULT
,
&
dialect
),
"got %s
\n
"
,
debugstr_guid
(
&
dialect
));
ok
(
!
lstrcmpW
(
L"select * from testing"
,
str
),
"got %s
\n
"
,
debugstr_w
(
str
));
HeapFree
(
GetProcessHeap
(),
0
,
str
);
dialect
=
DBGUID_DEFAULT
;
hr
=
ICommandText_GetCommandText
(
comand_text
,
&
dialect
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
DBGUID_DEFAULT
,
&
dialect
),
"got %s
\n
"
,
debugstr_guid
(
&
dialect
));
ok
(
!
lstrcmpW
(
L"select * from testing"
,
str
),
"got %s
\n
"
,
debugstr_w
(
str
));
HeapFree
(
GetProcessHeap
(),
0
,
str
);
ICommandText_Release
(
comand_text
);
}
static
void
test_sessions
(
void
)
{
IDBProperties
*
props
;
...
...
@@ -231,6 +280,7 @@ static void test_sessions(void)
if
(
hr
==
S_OK
)
{
test_command_interfaces
(
cmd
);
test_command_text
(
cmd
);
IUnknown_Release
(
cmd
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment