Index: Doc/Extra/Provider/version.html ================================================================== --- Doc/Extra/Provider/version.html +++ Doc/Extra/Provider/version.html @@ -45,10 +45,11 @@

Version History

1.0.98.0 - August XX, 2015 (release scheduled)

1.0.97.0 - May 26, 2015

Index: System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs ================================================================== --- System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs +++ System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs @@ -225,11 +225,10 @@ // SQL) DbParameter value; if (translator.MemberValues.TryGetValue(keyMember, out value)) { commandText.Append(value.ParameterName); - commandText.AppendLine(";"); } else { // if no value is registered for the key member, it means it is an identity // which can be retrieved using the scope_identity() function @@ -236,14 +235,15 @@ if (identity) { // there can be only one server generated key throw new NotSupportedException(string.Format("Server generated keys are only supported for identity columns. More than one key column is marked as server generated in table '{0}'.", table.Name)); } - commandText.AppendLine("last_insert_rowid();"); + commandText.AppendLine("last_insert_rowid()"); identity = true; } } + commandText.AppendLine(";"); } /// /// Lightweight expression translator for DML expression trees, which have constrained /// scope and support. ADDED Tests/tkt-9d353b0bd8.eagle Index: Tests/tkt-9d353b0bd8.eagle ================================================================== --- /dev/null +++ Tests/tkt-9d353b0bd8.eagle @@ -0,0 +1,64 @@ +############################################################################### +# +# tkt-9d353b0bd8.eagle -- +# +# Written by Joe Mistachkin. +# Released to the public domain, use at your own risk! +# +############################################################################### + +package require Eagle +package require Eagle.Library +package require Eagle.Test + +runTestPrologue + +############################################################################### + +package require System.Data.SQLite.Test +runSQLiteTestPrologue +runSQLiteTestFilesPrologue + +############################################################################### + +runTest {test tkt-9d353b0bd8-1.1 {DbModificationCommandTree w/INSERT} -body { + # + # NOTE: Re-copy the reference database file used for this unit test to the + # build directory in case it has been changed by a previous test run. + # + file copy -force $northwindEfDbFile \ + [file join [getBuildDirectory] [file tail $northwindEfDbFile]] + + set result [list] + set output "" + + set code [catch { + testClrExec $testLinqExeFile [list -eventflags Wait -directory \ + [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \ + -success 0] -insert + } error] + + tlog "---- BEGIN STDOUT OUTPUT\n" + tlog $output + tlog "\n---- END STDOUT OUTPUT\n" + + lappend result $code + + if {$code == 0} then { + lappend result [string trim $output] + } else { + lappend result [string trim $error] + } + + set result +} -cleanup { + unset -nocomplain code output error result +} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\ +file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \ +-result {0 {inserted 1}}} + +############################################################################### + +runSQLiteTestFilesEpilogue +runSQLiteTestEpilogue +runTestEpilogue Index: readme.htm ================================================================== --- readme.htm +++ readme.htm @@ -212,10 +212,11 @@ 1.0.98.0 - August XX, 2015 (release scheduled)

Index: testlinq/NorthwindModel.EF6.2010.edmx ================================================================== --- testlinq/NorthwindModel.EF6.2010.edmx +++ testlinq/NorthwindModel.EF6.2010.edmx @@ -135,11 +135,17 @@ - + + Index: testlinq/NorthwindModel.EF6.2012.edmx ================================================================== --- testlinq/NorthwindModel.EF6.2012.edmx +++ testlinq/NorthwindModel.EF6.2012.edmx @@ -135,11 +135,17 @@ - + + Index: testlinq/NorthwindModel.EF6.2013.edmx ================================================================== --- testlinq/NorthwindModel.EF6.2013.edmx +++ testlinq/NorthwindModel.EF6.2013.edmx @@ -135,11 +135,17 @@ - + + Index: testlinq/NorthwindModel.Linq.2008.edmx ================================================================== --- testlinq/NorthwindModel.Linq.2008.edmx +++ testlinq/NorthwindModel.Linq.2008.edmx @@ -135,11 +135,17 @@ - + + Index: testlinq/NorthwindModel.Linq.2010.edmx ================================================================== --- testlinq/NorthwindModel.Linq.2010.edmx +++ testlinq/NorthwindModel.Linq.2010.edmx @@ -135,11 +135,17 @@ - + + Index: testlinq/NorthwindModel.Linq.2012.edmx ================================================================== --- testlinq/NorthwindModel.Linq.2012.edmx +++ testlinq/NorthwindModel.Linq.2012.edmx @@ -135,11 +135,17 @@ - + + Index: testlinq/NorthwindModel.Linq.2013.edmx ================================================================== --- testlinq/NorthwindModel.Linq.2013.edmx +++ testlinq/NorthwindModel.Linq.2013.edmx @@ -135,11 +135,17 @@ - + + Index: testlinq/Program.cs ================================================================== --- testlinq/Program.cs +++ testlinq/Program.cs @@ -142,10 +142,14 @@ } } return EFTransactionTest(value); } + case "insert": + { + return InsertTest(); + } case "update": { return UpdateTest(); } case "binaryguid": @@ -536,10 +540,65 @@ once = true; } #endif } } + + return 0; + } + + // + // NOTE: Used to test the INSERT fix (i.e. an extra semi-colon in + // the SQL statement after the actual INSERT statement in + // the follow-up SELECT statement). + // + private static int InsertTest() + { + long[] orderIds = new long[] { + 0 + }; + + using (northwindEFEntities db = new northwindEFEntities()) + { + int[] counts = { 0 }; + + // + // NOTE: *REQUIRED* This is required so that the + // Entity Framework is prevented from opening + // multiple connections to the underlying SQLite + // database (i.e. which would result in multiple + // IMMEDIATE transactions, thereby failing [later + // on] with locking errors). + // + db.Connection.Open(); + + OrderDetails newOrderDetails = new OrderDetails(); + + newOrderDetails.OrderID = 10248; + newOrderDetails.ProductID = 1; + newOrderDetails.UnitPrice = (decimal)1.23; + newOrderDetails.Quantity = 1; + newOrderDetails.Discount = 0.0f; + + db.AddObject("OrderDetails", newOrderDetails); + + try + { + db.SaveChanges(); + counts[0]++; + } + catch (Exception e) + { + Console.WriteLine(e); + } + finally + { + db.AcceptAllChanges(); + } + + Console.WriteLine("inserted {0}", counts[0]); + } return 0; } // Index: www/news.wiki ================================================================== --- www/news.wiki +++ www/news.wiki @@ -6,10 +6,11 @@ 1.0.98.0 - August XX, 2015 (release scheduled)