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
7491a7f1
Commit
7491a7f1
authored
Jan 25, 2022
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Jan 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msdasql: Implement ICommandPrepare Prepare.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1636530c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
4 deletions
+48
-4
msdasql_main.c
dlls/msdasql/msdasql_main.c
+2
-2
msdasql_private.h
dlls/msdasql/msdasql_private.h
+2
-1
session.c
dlls/msdasql/session.c
+30
-1
provider.c
dlls/msdasql/tests/provider.c
+14
-0
No files found.
dlls/msdasql/msdasql_main.c
View file @
7491a7f1
...
...
@@ -43,7 +43,7 @@ DEFINE_GUID(DBPROPSET_DBINIT, 0xc8b522bc, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0
DEFINE_GUID
(
DBGUID_DEFAULT
,
0xc8b521fb
,
0x5cf3
,
0x11ce
,
0xad
,
0xe5
,
0x00
,
0xaa
,
0x00
,
0x44
,
0x77
,
0x3d
);
static
void
dump_sql_diag_records
(
SQLSMALLINT
type
,
SQLHANDLE
handle
)
void
dump_sql_diag_records
(
SQLSMALLINT
type
,
SQLHANDLE
handle
)
{
SQLCHAR
state
[
6
],
msg
[
SQL_MAX_MESSAGE_LENGTH
];
SQLINTEGER
native
;
...
...
@@ -611,7 +611,7 @@ static HRESULT WINAPI dbsess_CreateSession(IDBCreateSession *iface, IUnknown *ou
if
(
outer
)
FIXME
(
"outer currently not supported.
\n
"
);
hr
=
create_db_session
(
riid
,
&
provider
->
MSDASQL_iface
,
(
void
**
)
session
);
hr
=
create_db_session
(
riid
,
&
provider
->
MSDASQL_iface
,
provider
->
hdbc
,
(
void
**
)
session
);
return
hr
;
}
...
...
dlls/msdasql/msdasql_private.h
View file @
7491a7f1
...
...
@@ -16,4 +16,5 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
HRESULT
create_db_session
(
REFIID
riid
,
IUnknown
*
datasource
,
void
**
unk
)
DECLSPEC_HIDDEN
;
HRESULT
create_db_session
(
REFIID
riid
,
IUnknown
*
datasource
,
HDBC
hdbc
,
void
**
unk
)
DECLSPEC_HIDDEN
;
void
dump_sql_diag_records
(
SQLSMALLINT
type
,
SQLHANDLE
handle
)
DECLSPEC_HIDDEN
;
dlls/msdasql/session.c
View file @
7491a7f1
...
...
@@ -30,6 +30,7 @@
#include "msdasql.h"
#include "oledberr.h"
#include "sqlucode.h"
#include "msdasql_private.h"
...
...
@@ -45,6 +46,8 @@ struct msdasql_session
LONG
refs
;
IUnknown
*
datasource
;
HDBC
hdbc
;
};
static
inline
struct
msdasql_session
*
impl_from_IUnknown
(
IUnknown
*
iface
)
...
...
@@ -305,6 +308,8 @@ struct command
LONG
refs
;
WCHAR
*
query
;
IUnknown
*
session
;
HDBC
hdbc
;
SQLHSTMT
hstmt
;
};
static
inline
struct
command
*
impl_from_ICommandText
(
ICommandText
*
iface
)
...
...
@@ -424,6 +429,10 @@ static ULONG WINAPI command_Release(ICommandText *iface)
TRACE
(
"destroying %p
\n
"
,
command
);
if
(
command
->
session
)
IUnknown_Release
(
command
->
session
);
if
(
command
->
hstmt
)
SQLFreeHandle
(
SQL_HANDLE_STMT
,
command
->
hstmt
);
heap_free
(
command
->
query
);
heap_free
(
command
);
}
...
...
@@ -1051,7 +1060,24 @@ static ULONG WINAPI commandprepare_Release(ICommandPrepare *iface)
static
HRESULT
WINAPI
commandprepare_Prepare
(
ICommandPrepare
*
iface
,
ULONG
runs
)
{
struct
command
*
command
=
impl_from_ICommandPrepare
(
iface
);
RETCODE
ret
;
TRACE
(
"%p, %u
\n
"
,
command
,
runs
);
if
(
!
command
->
query
)
return
DB_E_NOCOMMAND
;
if
(
command
->
hstmt
)
SQLFreeHandle
(
SQL_HANDLE_STMT
,
command
->
hstmt
);
SQLAllocHandle
(
SQL_HANDLE_STMT
,
command
->
hdbc
,
&
command
->
hstmt
);
ret
=
SQLPrepareW
(
command
->
hstmt
,
command
->
query
,
SQL_NTS
);
if
(
ret
!=
SQL_SUCCESS
)
{
dump_sql_diag_records
(
SQL_HANDLE_STMT
,
command
->
hstmt
);
return
E_FAIL
;
}
return
S_OK
;
}
...
...
@@ -1147,6 +1173,8 @@ static HRESULT WINAPI createcommand_CreateCommand(IDBCreateCommand *iface, IUnkn
command
->
ICommandWithParameters_iface
.
lpVtbl
=
&
command_with_params_vtbl
;
command
->
refs
=
1
;
command
->
query
=
NULL
;
command
->
hdbc
=
session
->
hdbc
;
command
->
hstmt
=
NULL
;
IUnknown_QueryInterface
(
&
session
->
session_iface
,
&
IID_IUnknown
,
(
void
**
)
&
command
->
session
);
...
...
@@ -1163,7 +1191,7 @@ static const IDBCreateCommandVtbl createcommandVtbl =
createcommand_CreateCommand
};
HRESULT
create_db_session
(
REFIID
riid
,
IUnknown
*
datasource
,
void
**
unk
)
HRESULT
create_db_session
(
REFIID
riid
,
IUnknown
*
datasource
,
HDBC
hdbc
,
void
**
unk
)
{
struct
msdasql_session
*
session
;
HRESULT
hr
;
...
...
@@ -1179,6 +1207,7 @@ HRESULT create_db_session(REFIID riid, IUnknown *datasource, void **unk)
session
->
IDBCreateCommand_iface
.
lpVtbl
=
&
createcommandVtbl
;
IUnknown_QueryInterface
(
datasource
,
&
IID_IUnknown
,
(
void
**
)
&
session
->
datasource
);
session
->
refs
=
1
;
session
->
hdbc
=
hdbc
;
hr
=
IUnknown_QueryInterface
(
&
session
->
session_iface
,
riid
,
unk
);
IUnknown_Release
(
&
session
->
session_iface
);
...
...
dlls/msdasql/tests/provider.c
View file @
7491a7f1
...
...
@@ -354,6 +354,7 @@ static void test_rowset_interfaces(IRowset *rowset, ICommandText *commandtext)
static
void
test_command_rowset
(
IUnknown
*
cmd
)
{
ICommandText
*
command_text
;
ICommandPrepare
*
commandprepare
;
HRESULT
hr
;
IUnknown
*
unk
=
NULL
;
IRowset
*
rowset
;
...
...
@@ -362,9 +363,22 @@ static void test_command_rowset(IUnknown *cmd)
hr
=
IUnknown_QueryInterface
(
cmd
,
&
IID_ICommandText
,
(
void
**
)
&
command_text
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
cmd
,
&
IID_ICommandPrepare
,
(
void
**
)
&
commandprepare
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICommandText_SetCommandText
(
command_text
,
&
DBGUID_DEFAULT
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICommandPrepare_Prepare
(
commandprepare
,
1
);
ok
(
hr
==
DB_E_NOCOMMAND
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICommandText_SetCommandText
(
command_text
,
&
DBGUID_DEFAULT
,
L"CREATE TABLE testing (col1 INT, col2 SHORT)"
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICommandPrepare_Prepare
(
commandprepare
,
1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ICommandPrepare_Release
(
commandprepare
);
affected
=
9999
;
hr
=
ICommandText_Execute
(
command_text
,
NULL
,
&
IID_IRowset
,
NULL
,
&
affected
,
&
unk
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
...
...
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