Skip to content

Commit 1090ee3

Browse files
committed
Make sure the start index for Instr is set. Normally is optional but it seems some sections seem to prefer it to be defined
1 parent 34f124c commit 1090ee3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ private SqlExpression TranslateIndexOf(
276276
? _sqlExpressionFactory.Constant(constantStartIndex + 1, typeof(int))
277277
: _sqlExpressionFactory.Add(startIndex, _sqlExpressionFactory.Constant(1)));
278278
}
279+
else
280+
{
281+
charIndexArguments.Insert(0, _sqlExpressionFactory.Constant(1));
282+
}
279283
charIndexArguments.Add(_sqlExpressionFactory.Constant(1));
280284

281285
var argumentsPropagateNullability = Enumerable.Repeat(true, charIndexArguments.Count);
@@ -286,7 +290,7 @@ private SqlExpression TranslateIndexOf(
286290
|| string.Equals(storeType, "varchar(max)", StringComparison.OrdinalIgnoreCase))
287291
{
288292
charIndexExpression = _sqlExpressionFactory.Function(
289-
"InStr",
293+
"INSTR",
290294
charIndexArguments,
291295
nullable: true,
292296
argumentsPropagateNullability,
@@ -297,7 +301,7 @@ private SqlExpression TranslateIndexOf(
297301
else
298302
{
299303
charIndexExpression = _sqlExpressionFactory.Function(
300-
"InStr",
304+
"INSTR",
301305
charIndexArguments,
302306
nullable: true,
303307
argumentsPropagateNullability,

0 commit comments

Comments
 (0)