Skip to content

Commit c6902d5

Browse files
Copilotrenemadsen
andcommitted
Debug: Override CreateStoreCommand to log SQL commands
Added CreateStoreCommand override in MySqlModificationCommandBatch that logs: - The actual SQL command text being executed - Parameter count This is the most direct way to capture the malformed SQL queries causing the "near ', ,'" syntax errors. The method is called right before execution, so we'll definitely see the SQL. Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
1 parent 01017e3 commit c6902d5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/EFCore.MySql/Update/Internal/MySqlModificationCommandBatch.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,12 @@ public override bool TryAddCommand(IReadOnlyModificationCommand modificationComm
378378
/// We use _pendingParameters only to support our AddParameter implementation.
379379
/// </summary>
380380
private int _pendingParameters;
381+
382+
protected override RawSqlCommand CreateStoreCommand()
383+
{
384+
var command = base.CreateStoreCommand();
385+
Console.WriteLine($"[DEBUG SQL COMMAND] CommandText: {command.RelationalCommand.CommandText}");
386+
Console.WriteLine($"[DEBUG SQL COMMAND] ParameterCount: {command.ParameterValues.Count}");
387+
return command;
388+
}
381389
}

0 commit comments

Comments
 (0)