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

34 lines
1.4 KiB
Bash
Raw Normal View History

2019-06-04 18:15:32 +00:00
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
$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})'