msado15: Prevent multiple Open/Close of a _Recordset.
Based on a patch by Alistair Leslie-Hughes. Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e22f85853a
commit
0bfb3826ad
|
@ -1035,6 +1035,8 @@ static HRESULT WINAPI recordset_Close( _Recordset *iface )
|
|||
|
||||
TRACE( "%p\n", recordset );
|
||||
|
||||
if (recordset->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
|
||||
|
||||
close_recordset( recordset );
|
||||
recordset->state = adStateClosed;
|
||||
return S_OK;
|
||||
|
@ -1106,6 +1108,9 @@ static HRESULT WINAPI recordset_Open( _Recordset *iface, VARIANT source, VARIANT
|
|||
FIXME( "%p, %s, %s, %d, %d, %d\n", recordset, debugstr_variant(&source), debugstr_variant(&active_connection),
|
||||
cursor_type, lock_type, options );
|
||||
|
||||
if (!recordset->fields) return MAKE_ADO_HRESULT( adErrInvalidConnection );
|
||||
if (recordset->state == adStateOpen) return MAKE_ADO_HRESULT( adErrObjectOpen );
|
||||
|
||||
recordset->state = adStateOpen;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,9 @@ static void test_Recordset(void)
|
|||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( !count, "got %d\n", count );
|
||||
|
||||
hr = _Recordset_Close( recordset );
|
||||
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
|
||||
|
||||
refs = _Recordset_Release( recordset );
|
||||
ok( !refs, "got %d\n", refs );
|
||||
|
||||
|
@ -136,7 +139,7 @@ static void test_Recordset(void)
|
|||
V_VT( &missing ) = VT_ERROR;
|
||||
V_ERROR( &missing ) = DISP_E_PARAMNOTFOUND;
|
||||
hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified );
|
||||
todo_wine ok( hr == MAKE_ADO_HRESULT( adErrInvalidConnection ), "got %08x\n", hr );
|
||||
ok( hr == MAKE_ADO_HRESULT( adErrInvalidConnection ), "got %08x\n", hr );
|
||||
|
||||
hr = _Recordset_get_Fields( recordset, &fields );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
@ -156,6 +159,9 @@ static void test_Recordset(void)
|
|||
ok( is_eof( recordset ), "not eof\n" );
|
||||
ok( is_bof( recordset ), "not bof\n" );
|
||||
|
||||
hr = _Recordset_Open( recordset, missing, missing, adOpenStatic, adLockBatchOptimistic, adCmdUnspecified );
|
||||
ok( hr == MAKE_ADO_HRESULT( adErrObjectOpen ), "got %08x\n", hr );
|
||||
|
||||
state = -1;
|
||||
hr = _Recordset_get_State( recordset, &state );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
|
Loading…
Reference in New Issue