Servant-Software-LLC / FileBased.DataProviders

ADO.NET & EF Core Data Providers for common serializable formats (JSON, XML, and CSV) stored to disk.
2 stars 1 forks source link

Must process multiple line SQL statements. #32

Closed DaveRMaltby closed 1 year ago

DaveRMaltby commented 1 year ago

EF Core provider in the GettingStarted unit tests, makes a call to INSERT and in the same call a SELECT to get the identity value that was created in the INSERT.

For SQLite the statement is: INSERT INTO "Blogs" ("Url") VALUES (@p0); SELECT "BlogId" FROM "Blogs" WHERE changes() = 1 AND "rowid" = last_insert_rowid();

For SQL Server the statement is: INSERT INTO "Blogs" ("Url") VALUES (@p0); SELECT "BlogId" FROM "Blogs" WHERE @@ROWCOUNT = 1 AND "BlogId" = scope_identity();

These statements also imply that there is some statement that is carry across the two statements (i.e. in this case, it is the identity of the newly INSERT'd row.)

DaveRMaltby commented 1 year ago

Implementation of multi-line SQL statements in place. Decided to go with approach that MySQL uses for functions querying results of previous statement executed.

INSERT INTO Blogs (Url) VALUES (@p0);

SELECT LAST_INSERT_ID() WHERE ROW_COUNT() = 1;

Will do that as a part of this task.

DaveRMaltby commented 1 year ago

Our DataReaders now support multiple statements that can be INSERT, DELETE, UPDATE. Now will work on having the function support.