Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple insert command is not working #9

Closed
xcHades opened this issue Aug 18, 2017 · 2 comments
Closed

Multiple insert command is not working #9

xcHades opened this issue Aug 18, 2017 · 2 comments

Comments

@xcHades
Copy link

xcHades commented Aug 18, 2017

Hello!

I'm trying to execute a multiple insert command (like INSERT INTO Table (Col1, Col2, Col3) VALUES (Val1-1, Val1-2, Val1-3),(Val2-1, Val2-2, Val2-3)), which is correctly works in clickhouse-client, but I get "Sequence contains no matching element" exception:
System.Linq.Enumerable.First[TSource](IEnumerable 1 source, Func 2 predicate) ClickHouse.Ado.ClickHouseParameterCollection.get_Item(String parameterName) ClickHouse.Ado.ClickHouseCommand.<SubstituteParameters>b__28_0(Match m) System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator, Int32 count, Int32 startat) System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator) ClickHouse.Ado.ClickHouseCommand.SubstituteParameters(String commandText) ClickHouse.Ado.ClickHouseCommand.Execute(Boolean readResponse) ClickHouse.Ado.ClickHouseCommand.ExecuteNonQuery()

This exception occures in ClickHouseCommand.SubstituteParameters method, in which, as I understand, the program should not enter at all, since I do not pass any parameters. I would not really like to use hidden bulk-insert functionality because it's very undesirable to realize the GetEnumerator() for each entity. Could you explain why an exception may occur, is it a bug?

@killwort
Copy link
Owner

killwort commented Nov 2, 2017

Do not use direct insert syntax, it is really inefficient. Use bulk insert functionality described in readme.md.

killwort added a commit that referenced this issue Nov 2, 2017
@killwort
Copy link
Owner

killwort commented Nov 2, 2017

Regarding the exception, most likely that your data contains @ or : characters followed by letters/underscores which are interpreted as parameters even if they are in quoted strings. You should escape them by doubling.

@killwort killwort closed this as completed Nov 2, 2017
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

No branches or pull requests

2 participants