2010-09-09 22:58:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-01-24 01:02:07 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2024 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
|
2021-03-22 20:16:35 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-07-02 19:31:25 +00:00
|
|
|
par_sqlite() {
|
|
|
|
tmp=$(mktemp -d)
|
2023-01-30 21:51:56 +00:00
|
|
|
cd "$tmp"
|
2022-07-02 19:31:25 +00:00
|
|
|
echo '### Test of sqlite'
|
|
|
|
for CMDSQL in sqlite sqlite3 ; do
|
|
|
|
echo "Current command: $CMDSQL"
|
|
|
|
rm -f sqltest.$CMDSQL
|
|
|
|
# create database & table
|
|
|
|
sql $CMDSQL:///sqltest.$CMDSQL "CREATE TABLE foo(n INT, t TEXT);"
|
|
|
|
sql --list-tables $CMDSQL:///sqltest.$CMDSQL
|
2024-08-04 08:47:04 +00:00
|
|
|
file sqltest.$CMDSQL | perl -pe 's/ version \d+//'
|
2022-07-02 19:31:25 +00:00
|
|
|
sql $CMDSQL:///sqltest.$CMDSQL "INSERT INTO foo VALUES(1,'Line 1');"
|
|
|
|
sql $CMDSQL:///sqltest.$CMDSQL "INSERT INTO foo VALUES(2,'Line 2');"
|
|
|
|
sql $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql -n $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql -s '.' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql -n -s '.' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql -s '' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql -s ' ' $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql --html $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql -n --html $CMDSQL:///sqltest.$CMDSQL "SELECT * FROM foo;"
|
|
|
|
sql --dbsize $CMDSQL:///sqltest.$CMDSQL
|
|
|
|
sql $CMDSQL:///sqltest.$CMDSQL "DROP TABLE foo;"
|
|
|
|
sql --dbsize $CMDSQL:///sqltest.$CMDSQL
|
|
|
|
rm -f sqltest.$CMDSQL
|
|
|
|
done
|
|
|
|
}
|
2010-09-09 22:58:34 +00:00
|
|
|
|
2022-07-02 19:31:25 +00:00
|
|
|
par_influx() {
|
|
|
|
echo '### Test of influx'
|
|
|
|
(
|
|
|
|
# create database & table
|
|
|
|
sql influx:/// "CREATE DATABASE parallel;"
|
2024-06-16 10:37:14 +00:00
|
|
|
sql --show-databases influx:/// | grep -v $(whoami)
|
2022-07-02 19:31:25 +00:00
|
|
|
# insert
|
|
|
|
(echo INSERT cpu,host=serverA,region=us_west value=0.64;
|
|
|
|
echo INSERT cpu,host=serverA,region=us_west value=0.65;
|
|
|
|
echo 'select * from cpu' ) |
|
|
|
|
sql influx:///parallel
|
2022-08-19 21:42:55 +00:00
|
|
|
sql --show-tables influx:///parallel | grep parallel;
|
2022-07-02 19:31:25 +00:00
|
|
|
sql influx:///parallel 'SELECT * FROM cpu;'
|
|
|
|
sql influx:///parallel 'SELECT "host", "region", "value" FROM "cpu"'
|
|
|
|
sql --pretty influx:///parallel 'SELECT * FROM cpu;'
|
|
|
|
sql --json influx:///parallel 'SELECT * FROM cpu;'
|
|
|
|
sql --dbsize influx:///parallel
|
|
|
|
sql -s . influx:///parallel 'SELECT * FROM cpu;'
|
|
|
|
sql --html influx:///parallel 'SELECT * FROM cpu;'
|
|
|
|
sql influx:///parallel 'drop database parallel'
|
2023-07-21 02:33:22 +00:00
|
|
|
) | perl -pe 's/\d/0/g;'
|
2022-07-02 19:31:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export -f $(compgen -A function | grep par_)
|
2024-06-16 10:37:14 +00:00
|
|
|
compgen -A function | G "$@" par_ | sort |
|
2022-07-02 19:31:25 +00:00
|
|
|
parallel -j0 --tag -k --joblog +/tmp/jl-`basename $0` '{} 2>&1'
|