Commit 44cc7bef authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

msado15: Improve _Connection_Open/Close stubs.

parent 79228f64
......@@ -221,8 +221,14 @@ static HRESULT WINAPI connection_get_Version( _Connection *iface, BSTR *str )
static HRESULT WINAPI connection_Close( _Connection *iface )
{
FIXME( "%p\n", iface );
return E_NOTIMPL;
struct connection *connection = impl_from_Connection( iface );
TRACE( "%p\n", connection );
if (connection->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
connection->state = adStateClosed;
return S_OK;
}
static HRESULT WINAPI connection_Execute( _Connection *iface, BSTR command, VARIANT *records_affected,
......@@ -253,9 +259,14 @@ static HRESULT WINAPI connection_RollbackTrans( _Connection *iface )
static HRESULT WINAPI connection_Open( _Connection *iface, BSTR connect_str, BSTR userid, BSTR password,
LONG options )
{
struct connection *connection = impl_from_Connection( iface );
FIXME( "%p, %s, %s, %p, %08x\n", iface, debugstr_w(connect_str), debugstr_w(userid),
password, options );
return E_NOTIMPL;
if (connection->state == adStateOpen) return MAKE_ADO_HRESULT( adErrObjectOpen );
connection->state = adStateOpen;
return S_OK;
}
static HRESULT WINAPI connection_get_Errors( _Connection *iface, Errors **obj )
......
......@@ -674,7 +674,7 @@ static void test_Connection(void)
ISupportErrorInfo *errorinfo;
IConnectionPointContainer *pointcontainer;
LONG state, timeout;
BSTR str, str2;
BSTR str, str2, str3;
hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection);
ok( hr == S_OK, "got %08x\n", hr );
......@@ -702,6 +702,9 @@ if (0) /* Crashes on windows */
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(state == adStateClosed, "Unexpected state value 0x%08x\n", state);
hr = _Connection_Close(connection);
ok(hr == MAKE_ADO_HRESULT(adErrObjectClosed), "got %08x\n", hr);
timeout = 0;
hr = _Connection_get_CommandTimeout(connection, &timeout);
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
......@@ -734,8 +737,30 @@ if (0) /* Crashes on windows */
hr = _Connection_get_ConnectionString(connection, &str2);
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
ok(!wcscmp(str, str2), "wrong string %s\n", wine_dbgstr_w(str2));
hr = _Connection_Open(connection, NULL, NULL, NULL, 0);
todo_wine ok(hr == E_FAIL, "Failed, hr 0x%08x\n", hr);
/* Open adds trailing ; if it's missing */
str3 = SysAllocString(L"Provider=MSDASQL.1;Persist Security Info=False;Data Source=wine_test;");
hr = _Connection_Open(connection, NULL, NULL, NULL, adConnectUnspecified);
todo_wine ok(hr == E_FAIL, "Failed, hr 0x%08x\n", hr);
str2 = NULL;
hr = _Connection_get_ConnectionString(connection, &str2);
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
todo_wine ok(!wcscmp(str3, str2) || broken(!wcscmp(str, str2)) /* XP */, "wrong string %s\n", wine_dbgstr_w(str2));
hr = _Connection_Open(connection, str, NULL, NULL, adConnectUnspecified);
todo_wine ok(hr == E_FAIL, "Failed, hr 0x%08x\n", hr);
SysFreeString(str);
str2 = NULL;
hr = _Connection_get_ConnectionString(connection, &str2);
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
todo_wine ok(!wcscmp(str3, str2) || broken(!wcscmp(str, str2)) /* XP */, "wrong string %s\n", wine_dbgstr_w(str2));
SysFreeString(str2);
SysFreeString(str3);
hr = _Connection_put_ConnectionString(connection, NULL);
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
......
......@@ -512,6 +512,12 @@ typedef [uuid(00000531-0000-0010-8000-00aa006d2ea4)] enum EventReasonEnum
adRsnMoveLast = 15
} EventReasonEnum;
typedef [uuid(00000541-0000-0010-8000-00aa006d2ea4)] enum ConnectOptionEnum
{
adConnectUnspecified = -1,
adAsyncConnect = 0x10
} ConnectOptionEnum;
[
uuid(00000503-0000-0010-8000-00aa006d2ea4),
odl,
......
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