* working db_check

*del unused func db_F-ID_getPath
This commit is contained in:
6543 2019-05-11 18:03:10 +02:00
parent 3d3641a3d9
commit 064e340c8c

View File

@ -58,7 +58,10 @@ function help() {
function main() {

#db checks
[ "$(db_check)" == $FALSE ] && exit 1
[ "$(db_check)" == $FALSE ] && {
echo "DB ERROR!!" >&2
exit 1
}

#clean DB from old stuff
{
@ -164,7 +167,7 @@ function file_add() {
[ -z "$MD5" ] && MD5="$(md5sum "$FILE" | cut -c -32)"
local SIZE="$(file_size "$FILE")"
[ "$SIZE" -le 0 ] && {
echo File to smal
[ $DEBUG == $TRUE ] && echo File to smal >&2
return 0
}

@ -207,16 +210,12 @@ function db_query() {
}

function db_check() {
echo DUMMY FUNC db_check
echo aim: check DB conection + shema
echo $TRUE
db_query "SHOW GRANTS FOR CURRENT_USER();" > /dev/null 2> /dev/null
if [ $? == 0 ]; then
echo $TRUE
else
echo $FALSE
fi
}

# db_F-ID_getPath <F-ID> -> <Path>
function db_id_getPath() {
db_query "SELECT CONCAT('$moviedir/', Folder, '/', Name) FROM File WHERE ID=$1;"
}



main #aufruf der main function (eig. programmstart)