Migrated to postgres and added pub32 tests

This commit is contained in:
kexkey
2021-11-05 22:46:36 -04:00
parent da35fc50e3
commit 8a62c146a9
44 changed files with 2299 additions and 530 deletions

View File

@@ -3,6 +3,35 @@
. ./trace.sh
sql() {
trace "Entering sql()..."
local select_id=${2}
local response
local inserted_id
trace "[sql] psql -qAtX -h postgres -U cyphernode -c \"${1}\""
response=$(psql -qAtX -h postgres -U cyphernode -c "${1}")
returncode=$?
trace_rc ${returncode}
if [ -n "${select_id}" ]; then
if [ "${returncode}" -eq "0" ]; then
inserted_id=$(echo "${response}" | cut -d ' ' -f1)
else
trace "[sql] psql -qAtX -h postgres -U cyphernode -c \"${select_id}\""
inserted_id=$(psql -qAtX -h postgres -U cyphernode -c "${select_id}")
returncode=$?
trace_rc ${returncode}
fi
echo -n "${inserted_id}"
else
echo -n "${response}"
fi
return ${returncode}
}
sql_sqlite() {
trace "sqlite3 -cmd \".timeout 40000\" ${DB_FILE} \"${1}\""
sqlite3 -cmd ".timeout 40000" ${DB_FILE} "${1}"
@@ -14,16 +43,3 @@ sql() {
return $?
}
sql_rawtx() {
trace "sqlite3 -cmd \".timeout 40000\" ${DB_FILE}_rawtx \"${1}\""
sqlite3 -cmd ".timeout 40000" ${DB_FILE}_rawtx "${1}"
if [ "$?" -ne 0 ]; then
# SQL didn't work, let's retry to be sure...
trace "SQL didn't work, let's retry..."
sqlite3 -cmd ".timeout 40000" ${DB_FILE}_rawtx "${1}"
fi
return $?
}