Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add test to make sure that the SQL statements generated for a DbUpdateCommandTree via the LINQ assembly are properly delimited (i.e. by a semi-colon). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e0cbe7cc0d2994b09c8cc6ca08b8f082 |
User & Date: | mistachkin 2014-09-23 01:21:49.495 |
Context
2014-09-23
| ||
02:18 | Centralize most test suite handling of constraints that check for the existence of files. check-in: 530c121d5f user: mistachkin tags: trunk | |
01:21 | Add test to make sure that the SQL statements generated for a DbUpdateCommandTree via the LINQ assembly are properly delimited (i.e. by a semi-colon). check-in: e0cbe7cc0d user: mistachkin tags: trunk | |
2014-09-22
| ||
20:09 | In SQLiteDataReader.VerifyType method, remove duplicate 'if' statement for the DbType.SByte value and move the remaining 'if' to the Int64 affinity. Fix for [c5cc2fb334]. check-in: 24b429ba4d user: mistachkin tags: trunk | |
Changes
Changes to Setup/data/verify.lst.
︙ | ︙ | |||
647 648 649 650 651 652 653 654 655 656 657 658 659 660 | Tests/data/Uninstaller_Test_Vs2008.log Tests/data/Uninstaller_Test_Vs2010.log Tests/data/Uninstaller_Test_Vs2012.log Tests/data/Uninstaller_Test_Vs2013.log Tests/data/wal.db Tests/empty.eagle Tests/installer.eagle Tests/pkgIndex.eagle Tests/speed.eagle Tests/stress.eagle Tests/thread.eagle Tests/tkt-00f86f9739.eagle Tests/tkt-0d5b1ef362.eagle Tests/tkt-17045010df.eagle | > | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | Tests/data/Uninstaller_Test_Vs2008.log Tests/data/Uninstaller_Test_Vs2010.log Tests/data/Uninstaller_Test_Vs2012.log Tests/data/Uninstaller_Test_Vs2013.log Tests/data/wal.db Tests/empty.eagle Tests/installer.eagle Tests/linq.eagle Tests/pkgIndex.eagle Tests/speed.eagle Tests/stress.eagle Tests/thread.eagle Tests/tkt-00f86f9739.eagle Tests/tkt-0d5b1ef362.eagle Tests/tkt-17045010df.eagle |
︙ | ︙ |
Changes to System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs.
︙ | ︙ | |||
223 224 225 226 227 228 229 230 231 232 233 234 235 236 | // retrieve member value sql. the translator remembers member values // as it constructs the DML statement (which precedes the "returning" // SQL) DbParameter value; if (translator.MemberValues.TryGetValue(keyMember, out value)) { commandText.Append(value.ParameterName); } 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 if (identity) { | > | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | // retrieve member value sql. the translator remembers member values // as it constructs the DML statement (which precedes the "returning" // 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 if (identity) { |
︙ | ︙ |
Added Tests/linq.eagle.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | ############################################################################### # # linq.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 ############################################################################### # # NOTE: Setup the variables that refer to the various non-data files required # by the tests in this file. # set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll] set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll] set systemDataSQLiteEf6DllFile [getBuildFileName System.Data.SQLite.EF6.dll] set testLinqExeFile [getBuildFileName testlinq.exe] set testEf6ExeFile [getBuildFileName testef6.exe] # # NOTE: Setup the variables that refer to the various data files required by # the tests in this file. # set northwindEfDbFile [file nativename [file join \ [file dirname [file dirname [getSQLiteTestDataPath]]] testlinq \ northwindEF.db]] # # NOTE: Setup the test constraints specific to the tests in this file. # if {![haveConstraint [appendArgs file_ \ [file tail $systemDataSQLiteDllFile]]]} then { checkForFile $test_channel $systemDataSQLiteDllFile } if {![haveConstraint [appendArgs file_ \ [file tail $systemDataSQLiteLinqDllFile]]]} then { checkForFile $test_channel $systemDataSQLiteLinqDllFile } if {![haveConstraint [appendArgs file_ \ [file tail $systemDataSQLiteEf6DllFile]]]} then { checkForFile $test_channel $systemDataSQLiteEf6DllFile } if {![haveConstraint [appendArgs file_ [file tail $testLinqExeFile]]]} then { checkForFile $test_channel $testLinqExeFile testlinq.exe } if {![haveConstraint [appendArgs file_ [file tail $testEf6ExeFile]]]} then { checkForFile $test_channel $testEf6ExeFile testef6.exe } if {![haveConstraint [appendArgs file_ [file tail $northwindEfDbFile]]]} then { checkForFile $test_channel $northwindEfDbFile } ############################################################################### runTest {test linq-1.1 {LINQ Transaction Scope} -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] -update } 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 updated 1}}} ############################################################################### unset -nocomplain northwindEfDbFile testEf6ExeFile testLinqExeFile \ systemDataSQLiteEf6DllFile systemDataSQLiteLinqDllFile \ systemDataSQLiteDllFile ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to testlinq/NorthwindModel.EF6.2010.edmx.
︙ | ︙ | |||
145 146 147 148 149 150 151 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> | > > > > > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <!-- NOTE: The "Freight" column is not actually generated by the store; however, it has a default value and can be utilized to test generating an DbUpdateCommandTree with a Returning property value that is not null. --> <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> |
︙ | ︙ |
Changes to testlinq/NorthwindModel.EF6.2012.edmx.
︙ | ︙ | |||
145 146 147 148 149 150 151 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> | > > > > > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <!-- NOTE: The "Freight" column is not actually generated by the store; however, it has a default value and can be utilized to test generating an DbUpdateCommandTree with a Returning property value that is not null. --> <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> |
︙ | ︙ |
Changes to testlinq/NorthwindModel.EF6.2013.edmx.
︙ | ︙ | |||
145 146 147 148 149 150 151 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> | > > > > > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <!-- NOTE: The "Freight" column is not actually generated by the store; however, it has a default value and can be utilized to test generating an DbUpdateCommandTree with a Returning property value that is not null. --> <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> |
︙ | ︙ |
Changes to testlinq/NorthwindModel.Linq.2008.edmx.
︙ | ︙ | |||
145 146 147 148 149 150 151 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> | > > > > > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <!-- NOTE: The "Freight" column is not actually generated by the store; however, it has a default value and can be utilized to test generating an DbUpdateCommandTree with a Returning property value that is not null. --> <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> |
︙ | ︙ |
Changes to testlinq/NorthwindModel.Linq.2010.edmx.
︙ | ︙ | |||
145 146 147 148 149 150 151 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> | > > > > > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <!-- NOTE: The "Freight" column is not actually generated by the store; however, it has a default value and can be utilized to test generating an DbUpdateCommandTree with a Returning property value that is not null. --> <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> |
︙ | ︙ |
Changes to testlinq/NorthwindModel.Linq.2012.edmx.
︙ | ︙ | |||
145 146 147 148 149 150 151 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> | > > > > > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <!-- NOTE: The "Freight" column is not actually generated by the store; however, it has a default value and can be utilized to test generating an DbUpdateCommandTree with a Returning property value that is not null. --> <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> |
︙ | ︙ |
Changes to testlinq/NorthwindModel.Linq.2013.edmx.
︙ | ︙ | |||
145 146 147 148 149 150 151 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> | > > > > > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | </Key> <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="CustomerID" Type="nvarchar" MaxLength="5" /> <Property Name="EmployeeID" Type="integer" /> <Property Name="OrderDate" Type="datetime" /> <Property Name="RequiredDate" Type="datetime" /> <Property Name="ShippedDate" Type="datetime" /> <!-- NOTE: The "Freight" column is not actually generated by the store; however, it has a default value and can be utilized to test generating an DbUpdateCommandTree with a Returning property value that is not null. --> <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" /> <Property Name="ShipName" Type="nvarchar" MaxLength="40" /> <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" /> <Property Name="ShipCity" Type="nvarchar" MaxLength="15" /> <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" /> <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" /> <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" /> </EntityType> |
︙ | ︙ |
Changes to testlinq/Program.cs.
︙ | ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 | return 1; } } return EFTransactionTest(value); } default: { Console.WriteLine("unknown test \"{0}\"", arg); return 1; } } } | > > > > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | return 1; } } return EFTransactionTest(value); } case "update": { return UpdateTest(); } default: { Console.WriteLine("unknown test \"{0}\"", arg); return 1; } } } |
︙ | ︙ | |||
322 323 324 325 326 327 328 329 330 331 332 333 334 335 | Console.Write(territories.TerritoryID); once = true; } #endif } } return 0; } private static int DateTimeTest() { using (northwindEFEntities db = new northwindEFEntities()) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | Console.Write(territories.TerritoryID); once = true; } #endif } } return 0; } // // NOTE: Used to test the UPDATE fix (i.e. the missing semi-colon // in the SQL statement between the actual UPDATE statement // and the follow-up SELECT statement). // private static int UpdateTest() { long[] orderIds = new long[] { 0 }; using (northwindEFEntities db = new northwindEFEntities()) { int[] counts = { 0, 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(); for (int index = 0; index < orderIds.Length; index++) { Orders newOrders = new Orders(); newOrders.ShipAddress = String.Format( "Test Order Ship Address, Index #{0}", index); db.Orders.AddObject(newOrders); try { db.SaveChanges(); counts[0]++; // StoreGeneratedPattern="Identity" orderIds[index] = newOrders.OrderID; // StoreGeneratedPattern="None" newOrders.ShipAddress = String.Format( "New Order Ship Address #{0}", orderIds[index]); // StoreGeneratedPattern="Computed" newOrders.Freight = 1; db.SaveChanges(); counts[1]++; } catch (Exception e) { Console.WriteLine(e); } finally { db.AcceptAllChanges(); } } Console.WriteLine( "inserted {0} updated {1}", counts[0], counts[1]); } return 0; } private static int DateTimeTest() { using (northwindEFEntities db = new northwindEFEntities()) |
︙ | ︙ |