2019-05-25 13:43:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
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-05-25 13:43:52 +00:00
|
|
|
|
2020-08-01 00:56:32 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "$CLICKHOUSE_URL" -d "DROP TABLE IF EXISTS ps";
|
|
|
|
${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
|
|
|
|
2020-08-01 00:56: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-10-11 15:59:27 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}¶m_id=1" \
|
2019-06-04 18:15:32 +00:00
|
|
|
-d "SELECT * FROM ps WHERE i = {id:UInt8} ORDER BY i, s, d";
|
2019-10-11 15:59:27 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}¶m_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-10-11 15:59:27 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}¶m_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-10-11 15:59:27 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}¶m_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
|
|
|
|
2020-08-01 00:56:32 +00:00
|
|
|
${CLICKHOUSE_CURL} -sS "$CLICKHOUSE_URL" -d "DROP TABLE ps";
|