Problem with DBXCommand_GetRowsAffected() in dbexp4

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
NickoP
Posts: 3
Joined: Fri 22 Apr 2016 14:02

Problem with DBXCommand_GetRowsAffected() in dbexp4

Post by NickoP » Thu 11 Aug 2016 15:35

There is a TSQLConnection and a TSQLQuery using it to select some data from a MS SQL Server database. If the connection is closed, and after that we perform cleanup of the query (query.SQL.Clear()), an AccessViolation exception is produced in the DBXCommand_GetRowsAffected() method, because the Handle parameter is not checked before usage. This is reproduced regardless of whether the query is closed before the Clear() or not.
The sample code in Delphi (XE8 in our case) is:

Code: Select all

Q.Close();
Q.Prepared := False;
Q.SQL.Clear();
Version 7.2.4 of the driver is used and the exception is raised in unit dbexp4.pas, method DBXCommand_GetRowsAffected(Handle: TCRSQLObject; out Rows: Int64): TDBXErrorCode;
The same code works fine if the Interbase/Firebird driver (dbxida v.4.8.12) is used - no exception is produced.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Problem with DBXCommand_GetRowsAffected() in dbexp4

Post by ViktorV » Fri 12 Aug 2016 12:58

Unfortunately, we couldn't reproduce the issue. To ivestigate the issue, please compose a small sample reproducing the issue and send it to viktorv*devart*com , including scripts to create database objects.

Post Reply