-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add failing test * fix query string escaping * changelog
- Loading branch information
1 parent
6965b03
commit 4b0092e
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule Ch.QueryStringTest do | ||
use ExUnit.Case, async: true | ||
|
||
setup do | ||
{:ok, conn: start_supervised!({Ch, database: Ch.Test.database()})} | ||
end | ||
|
||
# For more info see | ||
# https://clickhouse.com/docs/en/interfaces/http#tabs-in-url-parameters | ||
# "escaped" format is the same as https://clickhouse.com/docs/en/interfaces/formats#tabseparated-data-formatting | ||
test "binaries are escaped properly", %{conn: conn} do | ||
for s <- ["\t", "\n", "\\", "'", "\b", "\f", "\r", "\0"] do | ||
assert Ch.query!(conn, "select {s:String}", %{"s" => s}).rows == [[s]] | ||
end | ||
|
||
# example from https://clickhouse.com/docs/en/interfaces/http#tabs-in-url-parameters | ||
assert Ch.query!(conn, "select splitByChar('\t', 'abc\t123')").rows == | ||
[[["abc", "123"]]] | ||
|
||
assert Ch.query!(conn, "select splitByChar('\t', {arg1:String})", %{"arg1" => "abc\t123"}).rows == | ||
[[["abc", "123"]]] | ||
end | ||
end |