2010-09-09 22:58:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-26 22:29:28 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2022 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
|
|
|
|
file sqltest.$CMDSQL
|
|
|
|
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;"
|
|
|
|
sql --show-databases influx:///
|
|
|
|
# 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'
|
|
|
|
) | perl -pe 's/\d/0/g'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export -f $(compgen -A function | grep par_)
|
|
|
|
compgen -A function | grep par_ | sort |
|
|
|
|
parallel -j0 --tag -k --joblog +/tmp/jl-`basename $0` '{} 2>&1'
|