ralmsdeveloper / EntityFrameworkCore.FirebirdSQL

FirebirdSQL database provider for Entity Framework Core.
Other
44 stars 26 forks source link

Modification querys not working #5

Closed hicham-barhoumi closed 7 years ago

hicham-barhoumi commented 7 years ago

The issue

When i do an insert to the database, Firebird throws an Error.("Dynamic SQL Error SQL error code = -104 Unexpected end of command - line 4, column 93")

EFCore.FirebirdSQL 2.0.1

Steps to reproduce

        var avoir = new Avoir
        {
            Num = "TEST-110989",
            Info = "info blabla"
        };
        db.Fbonavoir.Add(avoir);
        db.SaveChanges();

Générated SQL

        EXECUTE BLOCK ( p0  char(11)=@p0,...) RETURNS (AffectedRows BIGINT) AS BEGIN
        AffectedRows=0;
        INSERT INTO "FBONAVOIR" ("NUM",...)
        VALUES (:p0,...)END;

Error details

The error is because there is a semicolon missing before the "END;"

Further technical details

Firebird version: 2.5 EntityFrameworkCore.Firebird version: 2.0.0

The correction will be simple i think. In FBModificationCommandBatch.cs Line 183 replace this :

        sbExecuteBlock.AppendLine("END;");

with this :

        sbExecuteBlock.AppendLine(";AffectedRows=row_count;Suspend;END;");

I'm not sure if this is the right fix. It works for me.

ralmsdeveloper commented 7 years ago

I'll be checking this out!

ralmsdeveloper commented 7 years ago

My suggestion is you use version 2.0.3.

I made some corrections!

ralmsdeveloper commented 7 years ago

Any questions, I'm here!