Commit a40d67e0 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msdasql: Use SQLDriverConnectW to connect to the ODBC driver.

parent 96e18688
...@@ -530,26 +530,35 @@ static ULONG WINAPI dbinit_Release(IDBInitialize *iface) ...@@ -530,26 +530,35 @@ static ULONG WINAPI dbinit_Release(IDBInitialize *iface)
static HRESULT WINAPI dbinit_Initialize(IDBInitialize *iface) static HRESULT WINAPI dbinit_Initialize(IDBInitialize *iface)
{ {
struct msdasql *provider = impl_from_IDBInitialize(iface); struct msdasql *provider = impl_from_IDBInitialize(iface);
int i; int i, len;
SQLRETURN ret; SQLRETURN ret;
WCHAR connection[1024], *p = connection, outstr[1024];
FIXME("%p semi-stub\n", provider); FIXME("%p semi-stub\n", provider);
for(i=0; i < sizeof(provider->properties); i++) *p = 0;
for(i=0; i < ARRAY_SIZE(provider->properties); i++)
{ {
if (provider->properties[i].id == DBPROP_INIT_DATASOURCE) if (provider->properties[i].id == DBPROP_INIT_DATASOURCE)
break; {
} len = swprintf(p, ARRAY_SIZE(connection) - (p - connection),
L"DSN=%s;", V_BSTR(&provider->properties[i].value));
if (i >= sizeof(provider->properties)) p+= len;
{ }
ERR("Datasource not found\n"); else if (provider->properties[i].id == DBPROP_INIT_PROVIDERSTRING)
return E_FAIL; {
if (V_VT(&provider->properties[i].value) == VT_BSTR && SysStringLen(V_BSTR(&provider->properties[i].value)) )
{
len = swprintf(p, ARRAY_SIZE(connection) - (p - connection),
L"%s;", V_BSTR(&provider->properties[i].value));
p+= len;
}
}
} }
ret = SQLConnectW( provider->hdbc, (SQLWCHAR *)V_BSTR(&provider->properties[i].value), ret = SQLDriverConnectW( provider->hdbc, NULL, connection, wcslen(connection),
SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS ); outstr, ARRAY_SIZE(outstr), NULL, 0);
TRACE("SQLConnectW ret %d\n", ret); TRACE("SQLDriverConnectW ret %d\n", ret);
if (ret != SQL_SUCCESS) if (ret != SQL_SUCCESS)
{ {
dump_sql_diag_records(SQL_HANDLE_DBC, provider->hdbc); dump_sql_diag_records(SQL_HANDLE_DBC, provider->hdbc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment