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
50fc9d7d
Commit
50fc9d7d
authored
Feb 06, 2022
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Feb 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msdasql: ICommandText Execute use ODBC to fetch results.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
111c87f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
18 deletions
+56
-18
session.c
dlls/msdasql/session.c
+44
-15
provider.c
dlls/msdasql/tests/provider.c
+12
-3
No files found.
dlls/msdasql/session.c
View file @
50fc9d7d
...
@@ -477,6 +477,7 @@ struct msdasql_rowset
...
@@ -477,6 +477,7 @@ struct msdasql_rowset
IColumnsRowset
IColumnsRowset_iface
;
IColumnsRowset
IColumnsRowset_iface
;
IUnknown
*
caller
;
IUnknown
*
caller
;
LONG
refs
;
LONG
refs
;
SQLHSTMT
hstmt
;
};
};
static
inline
struct
msdasql_rowset
*
impl_from_IRowset
(
IRowset
*
iface
)
static
inline
struct
msdasql_rowset
*
impl_from_IRowset
(
IRowset
*
iface
)
...
@@ -575,6 +576,8 @@ static ULONG WINAPI msdasql_rowset_Release(IRowset *iface)
...
@@ -575,6 +576,8 @@ static ULONG WINAPI msdasql_rowset_Release(IRowset *iface)
{
{
TRACE
(
"destroying %p
\n
"
,
rowset
);
TRACE
(
"destroying %p
\n
"
,
rowset
);
SQLFreeHandle
(
SQL_HANDLE_STMT
,
rowset
->
hstmt
);
if
(
rowset
->
caller
)
if
(
rowset
->
caller
)
IUnknown_Release
(
rowset
->
caller
);
IUnknown_Release
(
rowset
->
caller
);
...
@@ -845,27 +848,53 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
...
@@ -845,27 +848,53 @@ static HRESULT WINAPI command_Execute(ICommandText *iface, IUnknown *outer, REFI
{
{
struct
command
*
command
=
impl_from_ICommandText
(
iface
);
struct
command
*
command
=
impl_from_ICommandText
(
iface
);
struct
msdasql_rowset
*
msrowset
;
struct
msdasql_rowset
*
msrowset
;
HRESULT
hr
;
HRESULT
hr
=
S_OK
;
RETCODE
ret
;
SQLHSTMT
hstmt
=
command
->
hstmt
;
SQLLEN
results
=
-
1
;
FIXME
(
"%p, %p, %s, %p %p %p Semi Stub
\n
"
,
command
,
outer
,
debugstr_guid
(
riid
),
params
,
affected
,
rowset
);
TRACE
(
"%p, %p, %s, %p %p %p
\n
"
,
command
,
outer
,
debugstr_guid
(
riid
),
params
,
affected
,
rowset
);
msrowset
=
heap_alloc
(
sizeof
(
*
msrowset
));
if
(
!
hstmt
)
if
(
!
msrowset
)
SQLAllocHandle
(
SQL_HANDLE_STMT
,
command
->
hdbc
,
&
hstmt
);
return
E_OUTOFMEMORY
;
msrowset
->
IRowset_iface
.
lpVtbl
=
&
msdasql_rowset_vtbl
;
ret
=
SQLExecDirectW
(
hstmt
,
command
->
query
,
SQL_NTS
);
msrowset
->
IRowsetInfo_iface
.
lpVtbl
=
&
rowset_info_vtbl
;
if
(
ret
!=
SQL_SUCCESS
)
msrowset
->
IColumnsInfo_iface
.
lpVtbl
=
&
rowset_columninfo_vtbll
;
{
msrowset
->
IAccessor_iface
.
lpVtbl
=
&
accessor_vtbl
;
dump_sql_diag_records
(
SQL_HANDLE_STMT
,
hstmt
);
msrowset
->
IColumnsRowset_iface
.
lpVtbl
=
&
columnrs_rs_vtbl
;
return
E_FAIL
;
msrowset
->
refs
=
1
;
}
ICommandText_QueryInterface
(
iface
,
&
IID_IUnknown
,
(
void
**
)
&
msrowset
->
caller
);
ret
=
SQLRowCount
(
hstmt
,
&
results
);
if
(
ret
!=
SQL_SUCCESS
)
ERR
(
"SQLRowCount failed (%d)
\n
"
,
ret
);
if
(
affected
)
if
(
affected
)
*
affected
=
0
;
/* FIXME */
*
affected
=
results
;
*
rowset
=
NULL
;
if
(
!
wcsnicmp
(
command
->
query
,
L"select "
,
7
))
{
msrowset
=
heap_alloc
(
sizeof
(
*
msrowset
));
if
(
!
msrowset
)
return
E_OUTOFMEMORY
;
hr
=
IRowset_QueryInterface
(
&
msrowset
->
IRowset_iface
,
riid
,
(
void
**
)
rowset
);
command
->
hstmt
=
NULL
;
IRowset_Release
(
&
msrowset
->
IRowset_iface
);
msrowset
->
IRowset_iface
.
lpVtbl
=
&
msdasql_rowset_vtbl
;
msrowset
->
IRowsetInfo_iface
.
lpVtbl
=
&
rowset_info_vtbl
;
msrowset
->
IColumnsInfo_iface
.
lpVtbl
=
&
rowset_columninfo_vtbll
;
msrowset
->
IAccessor_iface
.
lpVtbl
=
&
accessor_vtbl
;
msrowset
->
IColumnsRowset_iface
.
lpVtbl
=
&
columnrs_rs_vtbl
;
msrowset
->
refs
=
1
;
ICommandText_QueryInterface
(
iface
,
&
IID_IUnknown
,
(
void
**
)
&
msrowset
->
caller
);
msrowset
->
hstmt
=
hstmt
;
hr
=
IRowset_QueryInterface
(
&
msrowset
->
IRowset_iface
,
riid
,
(
void
**
)
rowset
);
IRowset_Release
(
&
msrowset
->
IRowset_iface
);
}
else
SQLFreeStmt
(
hstmt
,
SQL_CLOSE
);
return
hr
;
return
hr
;
}
}
...
...
dlls/msdasql/tests/provider.c
View file @
50fc9d7d
...
@@ -382,11 +382,20 @@ static void test_command_rowset(IUnknown *cmd)
...
@@ -382,11 +382,20 @@ static void test_command_rowset(IUnknown *cmd)
affected
=
9999
;
affected
=
9999
;
hr
=
ICommandText_Execute
(
command_text
,
NULL
,
&
IID_IRowset
,
NULL
,
&
affected
,
&
unk
);
hr
=
ICommandText_Execute
(
command_text
,
NULL
,
&
IID_IRowset
,
NULL
,
&
affected
,
&
unk
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\n
"
,
hr
);
todo_wine
ok
(
unk
==
NULL
,
"Unexpected value
\n
"
);
ok
(
unk
==
NULL
,
"Unexpected value
\n
"
);
todo_wine
ok
(
affected
==
-
1
,
"got %Id
\n
"
,
affected
);
ok
(
affected
==
-
1
,
"got %Id
\n
"
,
affected
);
if
(
unk
)
if
(
unk
)
IUnknown_Release
(
unk
);
IUnknown_Release
(
unk
);
hr
=
ICommandText_SetCommandText
(
command_text
,
&
DBGUID_DEFAULT
,
L"insert into testing values(1, 0)"
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\n
"
,
hr
);
affected
=
9999
;
hr
=
ICommandText_Execute
(
command_text
,
NULL
,
&
IID_IRowset
,
NULL
,
&
affected
,
&
unk
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\n
"
,
hr
);
ok
(
affected
==
1
,
"got %Id
\n
"
,
affected
);
ok
(
unk
==
NULL
,
"Unexpected value
\n
"
);
hr
=
ICommandText_SetCommandText
(
command_text
,
&
DBGUID_DEFAULT
,
L"select * from testing"
);
hr
=
ICommandText_SetCommandText
(
command_text
,
&
DBGUID_DEFAULT
,
L"select * from testing"
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\n
"
,
hr
);
...
@@ -396,7 +405,7 @@ static void test_command_rowset(IUnknown *cmd)
...
@@ -396,7 +405,7 @@ static void test_command_rowset(IUnknown *cmd)
ok
(
unk
!=
NULL
,
"Unexpected value
\n
"
);
ok
(
unk
!=
NULL
,
"Unexpected value
\n
"
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
{
{
ok
(
affected
==
-
1
,
"
wrong affected value
\n
"
);
ok
(
affected
==
-
1
,
"
got %Id
\n
"
,
affected
);
hr
=
IUnknown_QueryInterface
(
unk
,
&
IID_IRowset
,
(
void
**
)
&
rowset
);
hr
=
IUnknown_QueryInterface
(
unk
,
&
IID_IRowset
,
(
void
**
)
&
rowset
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08lx
\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