|
2015-08-19
| ||
| 04:23 | Corrections to the test cases for tickets [41aea496e0] and [9d353b0bd8]. closed check-in: e8e6cb1409 user: mistachkin tags: tkt-41aea496e0 | |
|
2015-06-23
| ||
| 16:44 | • Ticket [9d353b0bd8] EF-INSERT fails for multi-column-primary-key tables status still Closed with 3 other changes artifact: cced7c0657 user: mistachkin | |
| 12:59 | • Ticket [9d353b0bd8]: 3 changes artifact: e8bf64af1a user: anonymous | |
| 00:57 | • Closed ticket [9d353b0bd8]. artifact: 96ebacc5e0 user: mistachkin | |
| 00:56 | Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for [9d353b0bd8]. check-in: 01a3da88e7 user: mistachkin tags: trunk | |
|
2015-06-22
| ||
| 22:35 | • Verified ticket [9d353b0bd8]: EF-INSERT fails for multi-column-primary-key tables plus 5 other changes artifact: 2949974bd3 user: mistachkin | |
| 15:39 | • Ticket [9d353b0bd8]: 6 changes artifact: 3fc0605a9b user: anonymous | |
| 08:45 | • Ticket [9d353b0bd8]: 6 changes artifact: 13aecafe2f user: anonymous | |
| 08:38 | • New ticket [9d353b0bd8]. artifact: e2e921c03d user: anonymous | |
| Ticket Hash: | 9d353b0bd8ac3f66220dff6a58bcc157d7d29bfe | ||
| Title: | EF-INSERT fails for multi-column-primary-key tables | ||
| Status: | Closed | Type: | Code_Defect |
| Severity: | Important | Priority: | Immediate |
| Subsystem: | LINQ | Resolution: | Fixed |
| Last Modified: |
2015-06-23 16:44:35 10.81 years ago |
Created: |
2015-06-22 08:38:30 10.82 years ago |
| Version Found In: | 1.0.97 | ||
| User Comments: | ||||
anonymous added on 2015-06-22 08:38:30:
The EF to SQL translator includes a wrong ";" into SQL when the tables primary key consists of more than 1 field.
I just added a single entity to the table (EntitySet) and called SaveChanges(), below is the log created by a delegate attached to DbContext.Database.Log property:
INSERT INTO [CategoryValues]([CategoryId], [Index], [Value], [IsCustom], [XmlId], [Tooltip], [Icon], [IsDefault], [SortOrder])
VALUES (@p0, @p1, @p2, @p3, NULL, NULL, NULL, @p4, @p5);
SELECT [rowid]
FROM [CategoryValues]
WHERE last_rows_affected() > 0 AND [CategoryId] = @p0;
AND [Index] = @p1;
-- @p0: '3' (Type = Int64)
-- @p1: '0' (Type = Int16)
-- @p2: '*' (Type = String)
-- @p3: 'False' (Type = Boolean)
-- @p4: 'True' (Type = Boolean)
-- @p5: '0' (Type = Int32)
-- Executing at 2015-06-22 10:15:42 +02:00
notice the trailing ";" at the line before the line starting with " AND" which doesn't belong there, and the problem did not exist with v94 or v96.
Callstack + message:
System.Data.SQLite.SQLiteException
HResult=-2147467259
Message=SQL logic error or missing database
near "AND": syntax error
Source=System.Data.SQLite
ErrorCode=1
StackTrace:
at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
anonymous added on 2015-06-22 08:45:12:
Table definition:
CREATE TABLE [CategoryValues] (
[CategoryId] integer NOT NULL REFERENCES [Categories] ([CategoryId]),
[Index] smallint NOT NULL,
[Value] nvarchar(100) NOT NULL,
[IsCustom] bit NOT NULL DEFAULT 0,
[XmlId] nvarchar(64),
[Tooltip] ntext,
[Icon] image,
[IsDefault] bit NOT NULL DEFAULT 0,
[SortOrder] int NOT NULL DEFAULT 0,
PRIMARY KEY ([CategoryId], [Index])
);
anonymous added on 2015-06-22 15:39:44:
Maybe I forgot an implementation detail which explains why it does "SELECT [rowid]":
I "faked" the always implicitly available rowid column into the edmx file:
SSDL:
<EntityType Name="CategoryValues">
<Key>
<PropertyRef Name="CategoryId" />
<PropertyRef Name="Index" />
</Key>
<Property Name="rowid" Type="integer" Nullable="true" StoreGeneratedPattern="Identity" />
[...]
C-S mapping:
<EntitySetMapping Name="CategoryValues">
<EntityTypeMapping TypeName="DoPiMo.CategoryValue">
<MappingFragment StoreEntitySet="CategoryValues">
<ScalarProperty Name="CategoryValueId" ColumnName="rowid" />
[...]
But this worked like a charm using 1.0.94/96
mistachkin added on 2015-06-22 22:35:23:
Found the root cause of the bug. Working on fix now. Thanks for the report. mistachkin added on 2015-06-23 00:57:27:
Fixed on trunk via check-in [01a3da88e7]. anonymous added on 2015-06-23 12:59:23:
Thanks, that was quick. Are there any chances for a 1.0.97.1 NuGet build before August? mistachkin added on 2015-06-23 16:44:35:
It's unlikely, as it would not just be the NuGet packages. I would have to do an entire release. | ||||