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
a9452acb
Commit
a9452acb
authored
Dec 12, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msado15: Implement Fields_get_Item.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c4be51d7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
4 deletions
+80
-4
recordset.c
dlls/msado15/recordset.c
+40
-2
msado15.c
dlls/msado15/tests/msado15.c
+40
-2
No files found.
dlls/msado15/recordset.c
View file @
a9452acb
...
@@ -433,10 +433,48 @@ static HRESULT WINAPI fields_Refresh( Fields *iface )
...
@@ -433,10 +433,48 @@ static HRESULT WINAPI fields_Refresh( Fields *iface )
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
map_index
(
struct
fields
*
fields
,
VARIANT
*
index
,
ULONG
*
ret
)
{
ULONG
i
;
if
(
V_VT
(
index
)
!=
VT_BSTR
)
{
FIXME
(
"variant type %u not supported
\n
"
,
V_VT
(
index
)
);
return
E_INVALIDARG
;
}
for
(
i
=
0
;
i
<
fields
->
count
;
i
++
)
{
BSTR
name
;
BOOL
match
;
HRESULT
hr
;
if
((
hr
=
Field_get_Name
(
fields
->
field
[
i
],
&
name
))
!=
S_OK
)
return
hr
;
match
=
!
wcsicmp
(
V_BSTR
(
index
),
name
);
SysFreeString
(
name
);
if
(
match
)
{
*
ret
=
i
;
return
S_OK
;
}
}
return
E_INVALIDARG
;
}
static
HRESULT
WINAPI
fields_get_Item
(
Fields
*
iface
,
VARIANT
index
,
Field
**
obj
)
static
HRESULT
WINAPI
fields_get_Item
(
Fields
*
iface
,
VARIANT
index
,
Field
**
obj
)
{
{
FIXME
(
"%p, %s, %p
\n
"
,
iface
,
debugstr_variant
(
&
index
),
obj
);
struct
fields
*
fields
=
impl_from_Fields
(
iface
);
return
E_NOTIMPL
;
HRESULT
hr
;
ULONG
i
;
TRACE
(
"%p, %s, %p
\n
"
,
fields
,
debugstr_variant
(
&
index
),
obj
);
if
((
hr
=
map_index
(
fields
,
&
index
,
&
i
))
!=
S_OK
)
return
hr
;
Field_AddRef
(
fields
->
field
[
i
]
);
*
obj
=
fields
->
field
[
i
];
return
S_OK
;
}
}
static
BOOL
resize_fields
(
struct
fields
*
fields
,
ULONG
count
)
static
BOOL
resize_fields
(
struct
fields
*
fields
,
ULONG
count
)
...
...
dlls/msado15/tests/msado15.c
View file @
a9452acb
...
@@ -25,6 +25,12 @@
...
@@ -25,6 +25,12 @@
#define MAKE_ADO_HRESULT( err ) MAKE_HRESULT( SEVERITY_ERROR, FACILITY_CONTROL, err )
#define MAKE_ADO_HRESULT( err ) MAKE_HRESULT( SEVERITY_ERROR, FACILITY_CONTROL, err )
static
LONG
get_refs_field
(
Field
*
field
)
{
Field_AddRef
(
field
);
return
Field_Release
(
field
);
}
static
LONG
get_refs_fields
(
Fields
*
fields
)
static
LONG
get_refs_fields
(
Fields
*
fields
)
{
{
Fields_AddRef
(
fields
);
Fields_AddRef
(
fields
);
...
@@ -92,9 +98,10 @@ static void test_Fields(void)
...
@@ -92,9 +98,10 @@ static void test_Fields(void)
{
{
_Recordset
*
recordset
;
_Recordset
*
recordset
;
Fields
*
fields
;
Fields
*
fields
;
VARIANT
val
;
Field
*
field
,
*
field2
;
VARIANT
val
,
index
;
BSTR
name
;
BSTR
name
;
LONG
count
;
LONG
refs
,
count
;
HRESULT
hr
;
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_Recordset
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID__Recordset
,
(
void
**
)
&
recordset
);
hr
=
CoCreateInstance
(
&
CLSID_Recordset
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID__Recordset
,
(
void
**
)
&
recordset
);
...
@@ -127,6 +134,37 @@ static void test_Fields(void)
...
@@ -127,6 +134,37 @@ static void test_Fields(void)
hr
=
Fields_get_Count
(
fields
,
&
count
);
hr
=
Fields_get_Count
(
fields
,
&
count
);
ok
(
count
==
2
,
"got %d
\n
"
,
count
);
ok
(
count
==
2
,
"got %d
\n
"
,
count
);
/* handing out field object doesn't add reference to fields or recordset object */
name
=
SysAllocString
(
L"field"
);
V_VT
(
&
index
)
=
VT_BSTR
;
V_BSTR
(
&
index
)
=
name
;
refs
=
get_refs_recordset
(
recordset
);
ok
(
refs
==
2
,
"got %d
\n
"
,
refs
);
refs
=
get_refs_fields
(
fields
);
ok
(
refs
==
1
,
"got %d
\n
"
,
refs
);
hr
=
Fields_get_Item
(
fields
,
index
,
&
field
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
refs
=
get_refs_field
(
field
);
ok
(
refs
==
1
,
"got %d
\n
"
,
refs
);
refs
=
get_refs_recordset
(
recordset
);
ok
(
refs
==
2
,
"got %d
\n
"
,
refs
);
refs
=
get_refs_fields
(
fields
);
ok
(
refs
==
1
,
"got %d
\n
"
,
refs
);
/* calling get_Item again returns the same object and adds reference */
hr
=
Fields_get_Item
(
fields
,
index
,
&
field2
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
field2
==
field
,
"expected same object
\n
"
);
refs
=
get_refs_field
(
field2
);
ok
(
refs
==
2
,
"got %d
\n
"
,
refs
);
refs
=
get_refs_recordset
(
recordset
);
ok
(
refs
==
2
,
"got %d
\n
"
,
refs
);
refs
=
get_refs_fields
(
fields
);
ok
(
refs
==
1
,
"got %d
\n
"
,
refs
);
Field_Release
(
field2
);
SysFreeString
(
name
);
Field_Release
(
field
);
Fields_Release
(
fields
);
Fields_Release
(
fields
);
_Recordset_Release
(
recordset
);
_Recordset_Release
(
recordset
);
}
}
...
...
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