ClickHouse/tests/queries/0_stateless/00954_client_prepared_statements.sh

36 lines
1.5 KiB
Bash
Raw Normal View History

2019-06-04 18:15:32 +00:00
#!/usr/bin/env bash
2021-09-12 12:35:27 +00:00
# Tags: no-fasttest
2019-06-04 18:15:32 +00:00
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2020-12-28 11:46:53 +00:00
# shellcheck source=../shell_config.sh
2020-08-01 00:51:12 +00:00
. "$CURDIR"/../shell_config.sh
2019-06-04 18:15:32 +00:00
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS ps";
$CLICKHOUSE_CLIENT -q "CREATE TABLE ps (i UInt8, s String, d DateTime) ENGINE = Memory";
$CLICKHOUSE_CLIENT -q "INSERT INTO ps VALUES (1, 'Hello, world', '2005-05-05 05:05:05')";
$CLICKHOUSE_CLIENT -q "INSERT INTO ps VALUES (2, 'test', '2005-05-25 15:00:00')";
2019-06-05 23:31:14 +00:00
$CLICKHOUSE_CLIENT --max_threads=1 --param_id=1 \
2019-06-04 18:15:32 +00:00
-q "SELECT * FROM ps WHERE i = {id:UInt8}";
2019-06-05 23:31:14 +00:00
$CLICKHOUSE_CLIENT --max_threads=1 --param_phrase='Hello, world' \
2019-06-04 18:15:32 +00:00
-q "SELECT * FROM ps WHERE s = {phrase:String}";
2019-06-05 23:31:14 +00:00
$CLICKHOUSE_CLIENT --max_threads=1 --param_date='2005-05-25 15:00:00' \
2019-06-04 18:15:32 +00:00
-q "SELECT * FROM ps WHERE d = {date:DateTime}";
2019-06-05 23:31:14 +00:00
$CLICKHOUSE_CLIENT --max_threads=1 --param_id=2 --param_phrase='test' \
2019-06-04 18:15:32 +00:00
-q "SELECT * FROM ps WHERE i = {id:UInt8} and s = {phrase:String}";
2019-06-16 22:02:56 +00:00
$CLICKHOUSE_CLIENT -q "SELECT {s:String}" 2>&1 | grep -oP '^Code: 456\.'
2019-06-15 17:52:53 +00:00
2019-06-04 18:15:32 +00:00
$CLICKHOUSE_CLIENT -q "DROP TABLE ps";
$CLICKHOUSE_CLIENT --param_test abc --query 'SELECT {test:String}'
$CLICKHOUSE_CLIENT --param_test=abc --query 'SELECT {test:String}'
$CLICKHOUSE_CLIENT --param_test 'Hello, world' --query 'SELECT {test:String}'
$CLICKHOUSE_CLIENT --param_test='Hello, world' --query 'SELECT {test:String}'
$CLICKHOUSE_CLIENT --param_test '' --query 'SELECT length({test:String})'
$CLICKHOUSE_CLIENT --param_test='' --query 'SELECT length({test:String})'