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