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
32b6ef32
Commit
32b6ef32
authored
Aug 02, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Add support for DBTYPE_VARIANT -> DBTYPE_DATE conversion.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
788f588f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
0 deletions
+100
-0
convert.c
dlls/oledb32/convert.c
+8
-0
convert.c
dlls/oledb32/tests/convert.c
+92
-0
No files found.
dlls/oledb32/convert.c
View file @
32b6ef32
...
...
@@ -475,6 +475,14 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
hr
=
(
SystemTimeToVariantTime
(
&
st
,
d
)
?
S_OK
:
E_FAIL
);
break
;
}
case
DBTYPE_VARIANT
:
{
VARIANT
tmp
;
VariantInit
(
&
tmp
);
if
((
hr
=
VariantChangeType
(
&
tmp
,
src
,
0
,
VT_DATE
))
==
S_OK
)
*
d
=
V_DATE
(
&
tmp
);
break
;
}
default:
FIXME
(
"Unimplemented conversion %04x -> DATE
\n
"
,
src_type
);
return
E_NOTIMPL
;
}
break
;
...
...
dlls/oledb32/tests/convert.c
View file @
32b6ef32
...
...
@@ -4122,6 +4122,97 @@ static void test_converttonumeric(void)
SysFreeString
(
bstr
);
}
static
void
test_converttodate
(
void
)
{
static
const
WCHAR
strW
[]
=
{
'2'
,
'0'
,
'1'
,
'3'
,
'-'
,
'0'
,
'5'
,
'-'
,
'1'
,
'4'
,
0
};
DBLENGTH
dst_len
;
HRESULT
hr
;
DATE
dst
,
date
=
41408
.
086250
;
DBSTATUS
dst_status
;
VARIANT
var
;
BSTR
bstr
;
dst
=
0
.
0
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_DATE
,
DBTYPE_DATE
,
sizeof
(
date
),
&
dst_len
,
&
date
,
&
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
(
dst
==
41408
.
086250
,
"got %f
\n
"
,
dst
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_DATE
;
V_DATE
(
&
var
)
=
41408
.
086250
;
dst
=
0
.
0
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_DATE
,
sizeof
(
var
),
&
dst_len
,
&
var
,
&
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
(
dst
==
41408
.
086250
,
"got %f
\n
"
,
dst
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_R8
;
V_R8
(
&
var
)
=
41408
.
086250
;
dst
=
0
.
0
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_DATE
,
sizeof
(
var
),
&
dst_len
,
&
var
,
&
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
(
dst
==
41408
.
086250
,
"got %f
\n
"
,
dst
);
VariantInit
(
&
var
);
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
41408
;
dst
=
0
.
0
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_DATE
,
sizeof
(
var
),
&
dst_len
,
&
var
,
&
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
(
dst
==
41408
.
000000
,
"got %f
\n
"
,
dst
);
V_VT
(
&
var
)
=
VT_BSTR
;
V_BSTR
(
&
var
)
=
SysAllocString
(
strW
);
dst
=
0
.
0
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_DATE
,
sizeof
(
var
),
&
dst_len
,
&
var
,
&
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
(
dst
==
41408
.
000000
,
"got %f
\n
"
,
dst
);
VariantClear
(
&
var
);
dst
=
0
.
0
;
dst_len
=
0
;
bstr
=
SysAllocString
(
strW
);
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BSTR
,
DBTYPE_DATE
,
0
,
&
dst_len
,
&
bstr
,
&
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
(
dst
==
41408
.
000000
,
"got %f
\n
"
,
dst
);
SysFreeString
(
bstr
);
V_VT
(
&
var
)
=
VT_EMPTY
;
dst
=
1
.
0
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_DATE
,
sizeof
(
var
),
&
dst_len
,
&
var
,
&
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
(
dst
==
0
.
0
,
"got %f
\n
"
,
dst
);
V_VT
(
&
var
)
=
VT_NULL
;
dst
=
1
.
0
;
dst_len
=
0xdeadbeef
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_DATE
,
sizeof
(
var
),
&
dst_len
,
&
var
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_ISNULL
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
0xdeadbeef
,
"got %ld
\n
"
,
dst_len
);
ok
(
dst
==
1
.
0
,
"got %f
\n
"
,
dst
);
}
START_TEST
(
convert
)
{
HRESULT
hr
;
...
...
@@ -4164,6 +4255,7 @@ START_TEST(convert)
test_converttotimestamp
();
test_converttoiunknown
();
test_converttonumeric
();
test_converttodate
();
IDataConvert_Release
(
convert
);
...
...
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