|
2011-09-07
| ||
| 10:32 | • Closed ticket [59edc1018b]: String.EndsWith doesn't work plus 2 other changes artifact: 39cdf34b7b user: mistachkin | |
| 10:31 | Support LINQ queries with EndsWith method, fix for [59edc1018b]. Add test to verify the behavior from ticket [00f86f9739]. Modify test results/handling for ticket [8b7d179c3c] to be consistent with these new tests. check-in: 7810393e98 user: mistachkin tags: trunk | |
| 08:28 | • Ticket [59edc1018b] String.EndsWith doesn't work status still Open with 4 other changes artifact: c0ca5610ff user: mistachkin | |
|
2011-09-06
| ||
| 15:54 | • New ticket [59edc1018b]. artifact: 9d0a882cd0 user: anonymous | |
| Ticket Hash: | 59edc1018b1b07e7d96870d5f404eb98cd448f9c | ||
| Title: | String.EndsWith doesn't work | ||
| Status: | Closed | Type: | Code_Defect |
| Severity: | Severe | Priority: | Immediate |
| Subsystem: | LINQ | Resolution: | Fixed |
| Last Modified: |
2011-09-07 10:32:35 14.61 years ago |
Created: |
2011-09-06 15:54:43 14.61 years ago |
| Version Found In: | 1.0.74.0 | ||
| Description: | ||||
String.EndsWith doesn't work. For example modifying testlinq's OldTests function to read:
var query = from c in db.Customers
where c.City.EndsWith("don")
orderby c.CompanyName
select c;
int cc = query.Count();
results in the following SQL:
SELECT
[GroupBy1].[A1] AS [C1]
FROM ( SELECT 1 AS X ) AS [SingleRowTable1]
LEFT OUTER JOIN (SELECT
Count([Filter1].[A1]) AS [A1]
FROM ( SELECT
1 AS [A1]
FROM [Customers] AS [Extent1]
WHERE (Right([Extent1].[City], LENGTH('don'))) = 'don'
) AS [Filter1] ) AS [GroupBy1] ON 1 = 1
which is rejected by SQLite.
The following addition to SqlGenerator fixes the problem:
/// <summary>
/// Right(arg, len) -> SUBSTR(str, -len, len)
/// </summary>
/// <param name="sqlgen"></param>
/// <param name="e"></param>
/// <returns></returns>
private static ISqlFragment HandleCanonicalFunctionRight(SqlGenerator sqlgen, DbFunctionExpression e)
{
SqlBuilder result = new SqlBuilder();
result.Append("SUBSTR(");
Debug.Assert(e.Arguments.Count == 2, "Right should have two arguments");
result.Append(e.Arguments[0].Accept(sqlgen));
result.Append(", -");
result.Append(e.Arguments[1].Accept(sqlgen));
result.Append(", ");
result.Append(e.Arguments[1].Accept(sqlgen));
result.Append(")");
return result;
}
mistachkin added on 2011-09-07 10:32:35 UTC: | ||||