Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
38a362a2
Commit
38a362a2
authored
11 years ago
by
Nikolay Sivov
Committed by
Alexandre Julliard
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
oledb32: Implement DBTYPE_BSTR to DBTYPE_VARIANT conversion.
parent
960852f4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/oledb32/convert.c
+22
-0
22 additions, 0 deletions
dlls/oledb32/convert.c
dlls/oledb32/tests/convert.c
+39
-0
39 additions, 0 deletions
dlls/oledb32/tests/convert.c
with
61 additions
and
0 deletions
dlls/oledb32/convert.c
+
22
−
0
View file @
38a362a2
...
...
@@ -145,6 +145,8 @@ static int get_length(DBTYPE type)
case
DBTYPE_STR
:
case
DBTYPE_BYREF
|
DBTYPE_WSTR
:
return
0
;
case
DBTYPE_VARIANT
:
return
sizeof
(
VARIANT
);
default:
FIXME
(
"Unhandled type %04x
\n
"
,
type
);
return
0
;
...
...
@@ -727,6 +729,26 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
return
hr
;
}
case
DBTYPE_VARIANT
:
{
VARIANT
*
v
=
dst
;
switch
(
src_type
)
{
case
DBTYPE_BSTR
:
{
BSTR
s
=
*
(
WCHAR
**
)
src
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
s
));
V_VT
(
v
)
=
VT_BSTR
;
V_BSTR
(
v
)
=
SysAllocString
(
s
);
hr
=
V_BSTR
(
v
)
?
S_OK
:
E_OUTOFMEMORY
;
}
break
;
default:
FIXME
(
"Unimplemented conversion %04x -> VARIANT
\n
"
,
src_type
);
return
E_NOTIMPL
;
}
break
;
}
default:
FIXME
(
"Unimplemented conversion %04x -> %04x
\n
"
,
src_type
,
dst_type
);
return
E_NOTIMPL
;
...
...
This diff is collapsed.
Click to expand it.
dlls/oledb32/tests/convert.c
+
39
−
0
View file @
38a362a2
...
...
@@ -2440,6 +2440,7 @@ static void test_getconversionsize(void)
IDataConvert
*
convert
;
DBLENGTH
dst_len
;
HRESULT
hr
;
BSTR
str
;
hr
=
CoCreateInstance
(
&
CLSID_OLEDB_CONVERSIONLIBRARY
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDataConvert
,
(
void
**
)
&
convert
);
if
(
FAILED
(
hr
))
...
...
@@ -2461,6 +2462,43 @@ static void test_getconversionsize(void)
hr
=
IDataConvert_GetConversionSize
(
convert
,
DBTYPE_I2
,
DBTYPE_I4
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
/* size doesn't include string size */
str
=
SysAllocStringLen
(
NULL
,
10
);
dst_len
=
0
;
hr
=
IDataConvert_GetConversionSize
(
convert
,
DBTYPE_BSTR
,
DBTYPE_VARIANT
,
NULL
,
&
dst_len
,
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
dst_len
==
sizeof
(
VARIANT
),
"%ld
\n
"
,
dst_len
);
SysFreeString
(
str
);
IDataConvert_Release
(
convert
);
}
static
void
test_converttovar
(
void
)
{
static
WCHAR
strW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
IDataConvert
*
convert
;
DBSTATUS
dst_status
;
DBLENGTH
dst_len
;
VARIANT
dst
;
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_OLEDB_CONVERSIONLIBRARY
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDataConvert
,
(
void
**
)
&
convert
);
if
(
FAILED
(
hr
))
{
win_skip
(
"Unable to load oledb conversion library
\n
"
);
return
;
}
V_VT
(
&
dst
)
=
VT_EMPTY
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_WSTR
,
DBTYPE_VARIANT
,
sizeof
(
strW
),
&
dst_len
,
strW
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
dst
),
"got %ld
\n
"
,
dst_len
);
ok
(
V_VT
(
&
dst
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
dst
));
ok
(
!
lstrcmpW
(
V_BSTR
(
&
dst
),
strW
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
dst
)));
VariantClear
(
&
dst
);
IDataConvert_Release
(
convert
);
}
...
...
@@ -2482,6 +2520,7 @@ START_TEST(convert)
test_converttofiletime
();
test_converttocy
();
test_converttoui8
();
test_converttovar
();
test_getconversionsize
();
OleUninitialize
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment