inversion mysql -> sqlite par defaut
This commit is contained in:
parent
beecdac997
commit
f45cf6d29f
@ -37,13 +37,12 @@ NORMAL='\e[0m'
|
||||
|
||||
db_query() {
|
||||
local sql="$1"
|
||||
if [ "$dbtype" = "sqlite" ]; then
|
||||
sqlite3 "$DB_FILE" "$sql"
|
||||
else
|
||||
# Le séparateur par défaut de --batch est tabulation
|
||||
if [ "$dbtype" = "mysql" ]; then
|
||||
mysql --batch --raw --default-character-set=utf8mb4 \
|
||||
-h "$MYSQL_HOST" -P "$MYSQL_PORT" \
|
||||
-u "$MYSQL_USER" -p"$MYSQL_PASS" \
|
||||
-D "$MYSQL_DB" -e "$sql" | sed '1d' | tr '\t' '|'
|
||||
else
|
||||
sqlite3 "$DB_FILE" "$sql"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,14 +8,14 @@ checkdb() {
|
||||
if [ "$dbtype" = "sqlite" ]; then
|
||||
if [ ! -f "$DB_FILE" ]; then
|
||||
echo "La base de données n'existe pas. Création..."
|
||||
#do_createdb
|
||||
do_createdb
|
||||
fi
|
||||
else
|
||||
# Vérifie si la table existe, sinon crée-la
|
||||
exists=$(db_query "SHOW TABLES LIKE 'release';")
|
||||
if [ -z "$exists" ]; then
|
||||
echo "La table 'release' n'existe pas. Création..."
|
||||
#do_createdb
|
||||
do_createdb
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user