2019-05-25 13:43:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
. $CURDIR/../shell_config.sh
|
|
|
|
|
|
|
|
${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d "DROP TABLE IF EXISTS ps";
|
2019-06-04 18:15:32 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d "CREATE TABLE ps (i UInt8, s String, d Date) ENGINE = Memory";
|
2019-05-25 13:43:52 +00:00
|
|
|
|
2019-06-04 18:15:32 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d "INSERT INTO ps VALUES (1, 'Hello, world', '2005-05-05')";
|
|
|
|
${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d "INSERT INTO ps VALUES (2, 'test', '2019-05-25')";
|
2019-05-25 13:43:52 +00:00
|
|
|
|
2019-06-05 23:31:14 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?param_id=1" \
|
2019-06-04 18:15:32 +00:00
|
|
|
-d "SELECT * FROM ps WHERE i = {id:UInt8} ORDER BY i, s, d";
|
2019-06-05 23:31:14 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?param_phrase=Hello,+world" \
|
2019-06-04 18:15:32 +00:00
|
|
|
-d "SELECT * FROM ps WHERE s = {phrase:String} ORDER BY i, s, d";
|
2019-06-05 23:31:14 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?param_date=2019-05-25" \
|
2019-06-04 18:15:32 +00:00
|
|
|
-d "SELECT * FROM ps WHERE d = {date:Date} ORDER BY i, s, d";
|
2019-06-05 23:31:14 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?param_id=2¶m_phrase=test" \
|
2019-06-04 18:15:32 +00:00
|
|
|
-d "SELECT * FROM ps WHERE i = {id:UInt8} and s = {phrase:String} ORDER BY i, s, d";
|
2019-05-25 13:43:52 +00:00
|
|
|
|
|
|
|
${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d "DROP TABLE ps";
|