#!/usr/bin/env bash # Copyright 2024 Versity Software # This file is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http:#www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. check_and_create_database() { # Define SQL commands to create a table SQL_CREATE_TABLE="CREATE TABLE IF NOT EXISTS entries ( id INTEGER PRIMARY KEY AUTOINCREMENT, command TEXT NOT NULL, client TEXT NOT NULL, count INTEGER DEFAULT 1, UNIQUE(command, client) );" # Execute the SQL commands to create the database and table sqlite3 "$COVERAGE_DB" <&1); then log 2 "error in sqlite statement: $error" fi } record_result() { if [ -z "$COVERAGE_DB" ]; then log 5 "no coverage db set, not recording" return 0 fi # Define SQL commands to create a table SQL_CREATE_TABLE="CREATE TABLE IF NOT EXISTS results ( id INTEGER PRIMARY KEY AUTOINCREMENT, command TEXT NOT NULL, client TEXT, count INTEGER, pass INTEGER DEFAULT 1, UNIQUE(command, client) );" # Execute the SQL commands to create the database and table sqlite3 "$COVERAGE_DB" <