Issue Details (XML | Word | Printable)

Key: DNET-390
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Alexander
Votes: 2
Watchers: 1

If you were logged in you would be able to see more operations.
.NET Data provider

Crash in BatchExecution when (FbTransaction == null)

Created: 22/Aug/11 01:55 PM   Updated: 03/Jul/15 05:47 AM
Component/s: ADO.NET Provider
Affects Version/s: 2.6.5
Fix Version/s:

Environment: Windows 7, Visual Studio Team System 2008

 Description  « Hide
When BatchExecution executing many sql command in 1 command without beginning transaction, there is error in this line: this.sqlTransaction.Commit(); // 242 line in FbBatchExecution.cs

This situation can be replaying to execute some query like this:

CREATE TABLE sample(id bigint not null);

and C# code like this:

FbConnection c = new FbConnection(@"Database=employee.fdb;User=SYSDBA;Password=masterkey");

 FbBatchExecution fbe = new FbBatchExecution(c);
 foreach (string cmd in script.Results) {

(copypasted from this: )

So, small fix is this:

                        case SqlStatementType.Commit:
                            if (sqlTransaction!=null)
// raise the event

this.sqlTransaction = null;

// raise the event
this.OnCommandExecuted(sqlStatement, null, -1);
                        case SqlStatementType.Rollback:
if (sqlTransaction != null)

// raise the event

this.sqlTransaction = null;

// raise the event
this.OnCommandExecuted(sqlStatement, null, -1);
but in my opinion this is looks like dirty hack...
(Sorry for my English )

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 02/Jul/15 04:08 PM
Should the OnCommandExecuting and OnCommandExecuted be called even if the command was effectively skipped (no transaction) or not?

Jiri Cincura added a comment - 03/Jul/15 05:47 AM
OK, I decided the events will be fired. Logically the command was executed. Internals doesn't matter.