Remove tag lines/comments from the sql to be executed

pull/175/head
Christopher Jolly 2 years ago
parent 8f5be7fb89
commit 6fe74929cf

@ -366,6 +366,11 @@ namespace EntityFrameworkCore.Jet.Data
protected virtual IList<JetCommand> SplitCommands()
{
//Remove any tag lines from the sql created by ef core. Jet doesn't like comments/tags in the SQL
var lines = CommandText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
var filteredLines = lines.Where(line => !line.TrimStart().StartsWith("--"));
CommandText = string.Join(Environment.NewLine, filteredLines).TrimStart();
// At this point, all parameters have already been expanded.
var parser = new JetCommandParser(CommandText);

@ -27,9 +27,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query
await base.From_sql_queryable_stored_procedure_with_tag(async);
AssertSql(
$@"-- Stored Procedure
EXEC `Ten Most Expensive Products`");
$@"EXEC `Ten Most Expensive Products`");
}
public override async Task From_sql_queryable_stored_procedure_with_caller_info_tag(bool async)
@ -38,9 +36,7 @@ EXEC `Ten Most Expensive Products`");
AssertSql(
"""
-- File: SampleFileName:13
[dbo].[Ten Most Expensive Products]
EXEC `Ten Most Expensive Products`
""");
}
@ -50,11 +46,7 @@ EXEC `Ten Most Expensive Products`");
AssertSql(
"""
-- Before
-- File: SampleFileName:13
-- After
[dbo].[Ten Most Expensive Products]
EXEC `Ten Most Expensive Products`
""");
}

Loading…
Cancel
Save