mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-04 20:47:24 +01:00
* Patch from Ladislav Karrach to fix problems when closing TSQLQueries when the connection is not active, bug #17623
git-svn-id: trunk@17432 -
This commit is contained in:
parent
6739cec2b9
commit
428915a90b
@ -962,10 +962,11 @@ begin
|
||||
ODBCCursor.FBlobStreams.Clear;
|
||||
{$ENDIF}
|
||||
|
||||
ODBCCheckResult(
|
||||
SQLFreeStmt(ODBCCursor.FSTMTHandle, SQL_CLOSE),
|
||||
SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not close ODBC statement cursor.'
|
||||
);
|
||||
if ODBCCursor.FSTMTHandle <> SQL_NULL_HSTMT then
|
||||
ODBCCheckResult(
|
||||
SQLFreeStmt(ODBCCursor.FSTMTHandle, SQL_CLOSE),
|
||||
SQL_HANDLE_STMT, ODBCCursor.FSTMTHandle, 'Could not close ODBC statement cursor.'
|
||||
);
|
||||
end;
|
||||
|
||||
procedure TODBCConnection.AddFieldDefs(cursor: TSQLCursor; FieldDefs: TFieldDefs);
|
||||
|
||||
@ -65,6 +65,7 @@ type
|
||||
procedure TestDeleteAllInsertXML;
|
||||
|
||||
procedure TestFileNameProperty;
|
||||
procedure TestCloseDatasetNoConnection; // bug 17623
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -398,6 +399,26 @@ begin
|
||||
LoadDs.close;
|
||||
end;
|
||||
|
||||
procedure TTestBufDatasetStreams.TestCloseDatasetNoConnection;
|
||||
var SaveDs: TCustomBufDataset;
|
||||
LoadDs: TCustomBufDataset;
|
||||
Conn: TSQLConnection;
|
||||
begin
|
||||
SaveDs := DBConnector.GetNDataset(true,15) as TSQLQuery;
|
||||
SaveDs.Open;
|
||||
SaveDs.SaveToFile('Basics.xml',dfXML);
|
||||
SaveDs.Close;
|
||||
|
||||
Conn := TSQLConnectionClass(TSQLDBConnector(DBConnector).Connection.ClassType).Create(nil);
|
||||
LoadDs := TSQLQuery.Create(nil);
|
||||
LoadDs.DataBase:=Conn;
|
||||
LoadDs.LoadFromFile('Basics.xml');
|
||||
LoadDs.Next;
|
||||
LoadDs.Close;
|
||||
LoadDs.Free;
|
||||
Conn.Free;
|
||||
end;
|
||||
|
||||
procedure TTestBufDatasetStreams.TestSimpleEditApplUpd;
|
||||
begin
|
||||
TestChangesApplyUpdates(@SimpleEditChange);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user