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

msado15: Implement _Connection_get_CommandTimeout and _Connection_put_CommandTimeout.

parent 131cfe0b
...@@ -36,6 +36,7 @@ struct connection ...@@ -36,6 +36,7 @@ struct connection
LONG refs; LONG refs;
ObjectStateEnum state; ObjectStateEnum state;
LONG timeout;
}; };
static inline struct connection *impl_from_Connection( _Connection *iface ) static inline struct connection *impl_from_Connection( _Connection *iface )
...@@ -126,14 +127,18 @@ static HRESULT WINAPI connection_put_ConnectionString( _Connection *iface, BSTR ...@@ -126,14 +127,18 @@ static HRESULT WINAPI connection_put_ConnectionString( _Connection *iface, BSTR
static HRESULT WINAPI connection_get_CommandTimeout( _Connection *iface, LONG *timeout ) static HRESULT WINAPI connection_get_CommandTimeout( _Connection *iface, LONG *timeout )
{ {
FIXME( "%p, %p\n", iface, timeout ); struct connection *connection = impl_from_Connection( iface );
return E_NOTIMPL; TRACE( "%p, %p\n", connection, timeout );
*timeout = connection->timeout;
return S_OK;
} }
static HRESULT WINAPI connection_put_CommandTimeout( _Connection *iface, LONG timeout ) static HRESULT WINAPI connection_put_CommandTimeout( _Connection *iface, LONG timeout )
{ {
FIXME( "%p, %d\n", iface, timeout ); struct connection *connection = impl_from_Connection( iface );
return E_NOTIMPL; TRACE( "%p, %d\n", connection, timeout );
connection->timeout = timeout;
return S_OK;
} }
static HRESULT WINAPI connection_get_ConnectionTimeout( _Connection *iface, LONG *timeout ) static HRESULT WINAPI connection_get_ConnectionTimeout( _Connection *iface, LONG *timeout )
...@@ -342,6 +347,7 @@ HRESULT Connection_create( void **obj ) ...@@ -342,6 +347,7 @@ HRESULT Connection_create( void **obj )
connection->Connection_iface.lpVtbl = &connection_vtbl; connection->Connection_iface.lpVtbl = &connection_vtbl;
connection->refs = 1; connection->refs = 1;
connection->state = adStateClosed; connection->state = adStateClosed;
connection->timeout = 30;
*obj = &connection->Connection_iface; *obj = &connection->Connection_iface;
TRACE( "returning iface %p\n", *obj ); TRACE( "returning iface %p\n", *obj );
......
...@@ -286,7 +286,7 @@ static void test_Connection(void) ...@@ -286,7 +286,7 @@ static void test_Connection(void)
_Connection *connection; _Connection *connection;
IRunnableObject *runtime; IRunnableObject *runtime;
ISupportErrorInfo *errorinfo; ISupportErrorInfo *errorinfo;
LONG state; LONG state, timeout;
hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection); hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection);
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -310,6 +310,19 @@ if (0) /* Crashes on windows */ ...@@ -310,6 +310,19 @@ if (0) /* Crashes on windows */
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(state == adStateClosed, "Unexpected state value 0x%08x\n", state); ok(state == adStateClosed, "Unexpected state value 0x%08x\n", state);
timeout = 0;
hr = _Connection_get_CommandTimeout(connection, &timeout);
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(timeout == 30, "Unexpected timeout value %d\n", timeout);
hr = _Connection_put_CommandTimeout(connection, 300);
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
timeout = 0;
hr = _Connection_get_CommandTimeout(connection, &timeout);
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(timeout == 300, "Unexpected timeout value %d\n", timeout);
_Connection_Release(connection); _Connection_Release(connection);
} }
......
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