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
9d1e3b3a
Commit
9d1e3b3a
authored
Jan 21, 2022
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Jan 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msdasql: Connect to DSN in IDBInitialize Initialize.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
59832538
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
2 deletions
+63
-2
Makefile.in
dlls/msdasql/Makefile.in
+1
-1
msdasql_main.c
dlls/msdasql/msdasql_main.c
+62
-1
No files found.
dlls/msdasql/Makefile.in
View file @
9d1e3b3a
MODULE
=
msdasql.dll
IMPORTS
=
uuid ole32 oleaut32
IMPORTS
=
uuid ole32 oleaut32
odbc32
EXTRADLLFLAGS
=
-Wb
,--prefer-native
...
...
dlls/msdasql/msdasql_main.c
View file @
9d1e3b3a
...
...
@@ -30,6 +30,9 @@
#include "initguid.h"
#include "msdasql.h"
#include "odbcinst.h"
#include "sqlext.h"
#include "sqlucode.h"
#include "msdasql_private.h"
...
...
@@ -40,6 +43,22 @@ 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
)
{
SQLCHAR
state
[
6
],
msg
[
SQL_MAX_MESSAGE_LENGTH
];
SQLINTEGER
native
;
SQLSMALLINT
i
=
1
,
len
;
if
(
!
TRACE_ON
(
msdasql
))
return
;
while
(
SQLGetDiagRec
(
type
,
handle
,
i
,
state
,
&
native
,
msg
,
sizeof
(
msg
),
&
len
)
!=
SQL_SUCCESS
)
{
WARN
(
"%d: %s: %s
\n
"
,
i
,
state
,
msg
);
i
++
;
}
}
static
HRESULT
WINAPI
ClassFactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
*
ppv
=
NULL
;
...
...
@@ -210,6 +229,10 @@ struct msdasql
LONG
ref
;
struct
msdasql_prop
properties
[
14
];
/* ODBC Support */
HENV
henv
;
HDBC
hdbc
;
};
static
inline
struct
msdasql
*
impl_from_IUnknown
(
IUnknown
*
iface
)
...
...
@@ -294,6 +317,10 @@ static ULONG WINAPI msdsql_Release(IUnknown *iface)
if
(
!
ref
)
{
SQLDisconnect
(
provider
->
hdbc
);
SQLFreeHandle
(
SQL_HANDLE_DBC
,
provider
->
hdbc
);
SQLFreeHandle
(
SQL_HANDLE_ENV
,
provider
->
henv
);
free
(
provider
);
}
...
...
@@ -502,8 +529,33 @@ static ULONG WINAPI dbinit_Release(IDBInitialize *iface)
static
HRESULT
WINAPI
dbinit_Initialize
(
IDBInitialize
*
iface
)
{
struct
msdasql
*
provider
=
impl_from_IDBInitialize
(
iface
);
int
i
;
SQLRETURN
ret
;
FIXME
(
"%p stub
\n
"
,
provider
);
FIXME
(
"%p semi-stub
\n
"
,
provider
);
for
(
i
=
0
;
i
<
sizeof
(
provider
->
properties
);
i
++
)
{
if
(
provider
->
properties
[
i
].
id
==
DBPROP_INIT_DATASOURCE
)
break
;
}
if
(
i
>=
sizeof
(
provider
->
properties
))
{
ERR
(
"Datasource not found
\n
"
);
return
E_FAIL
;
}
ret
=
SQLConnectW
(
provider
->
hdbc
,
(
SQLWCHAR
*
)
V_BSTR
(
&
provider
->
properties
[
i
].
value
),
SQL_NTS
,
(
SQLWCHAR
*
)
NULL
,
SQL_NTS
,
(
SQLWCHAR
*
)
NULL
,
SQL_NTS
);
TRACE
(
"SQLConnectW ret %d
\n
"
,
ret
);
if
(
ret
!=
SQL_SUCCESS
)
{
dump_sql_diag_records
(
SQL_HANDLE_DBC
,
provider
->
hdbc
);
if
(
ret
!=
SQL_SUCCESS_WITH_INFO
)
return
E_FAIL
;
}
return
S_OK
;
}
...
...
@@ -653,6 +705,15 @@ static HRESULT create_msdasql_provider(REFIID riid, void **ppv)
}
}
SQLAllocHandle
(
SQL_HANDLE_ENV
,
NULL
,
&
provider
->
henv
);
if
(
SQLSetEnvAttr
(
provider
->
henv
,
SQL_ATTR_ODBC_VERSION
,
(
void
*
)
SQL_OV_ODBC3_80
,
0
)
==
SQL_ERROR
)
{
WARN
(
"Falling back to SQL_OV_ODBC3
\n
"
);
SQLSetEnvAttr
(
provider
->
henv
,
SQL_ATTR_ODBC_VERSION
,
(
void
*
)
SQL_OV_ODBC3
,
0
);
}
SQLAllocHandle
(
SQL_HANDLE_DBC
,
provider
->
henv
,
&
provider
->
hdbc
);
hr
=
IUnknown_QueryInterface
(
&
provider
->
MSDASQL_iface
,
riid
,
ppv
);
IUnknown_Release
(
&
provider
->
MSDASQL_iface
);
return
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