Skip to content

Conversation

mathijs-dumon
Copy link
Contributor

This is a replacement PR for this older branch: issue-192
I compared the test case that was in the old branch, my tests are equivalent.

The generated SQL is slightly different, (INSERT ALL vs UNION ALL) but functionally equivalent. The INSERT ALL approach is more in line with what other dialects do.

This fixes #192

@@ -17,6 +17,11 @@ public partial class Compiler
protected virtual string LastId { get; set; } = "";
protected virtual string EscapeCharacter { get; set; } = "\\";


protected virtual string SingleInsertStartClause { get; set; } = "INSERT INTO";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the case for Oracle only, I prefer removing it from the global compiler, unless it's really needed

Copy link

@mattewre mattewre Apr 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently "INSERT INTO" is harcoded (around line 400) for global compiler.
Using SingleInsertStartClause by @mathijs-dumon doesn't make things worse for sure, although I can't judge if it's actually the best way. However, this PR is very important to fix the problem.

@hc-satoshiwatanabe
Copy link

@mattewre @ahmad-moussawi
これ(#192)解決されると、非常に嬉しいです。
よろしくです。

@ahmad-moussawi ahmad-moussawi merged commit d9d0441 into sqlkata:master Oct 5, 2022
@andrewhosack
Copy link

Hey Ahmad, I love your package and it's working great for me so far. I found this Oracle INSERT MANY issue while working with this compiler in particular and it looks like this merge is going to fix the issue. I was wondering if there is any timeline on the next release for SqlKata, that will include this merged Oracle Compiler change! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OracleCompiler generates invalid multiple row insert
5 participants