--- alx-src/trunk/alxconfig-ng/functions/mysqlfunctions 2005/08/17 22:09:59 286 +++ alx-src/tags/alxconf_20060908_1/alxconfig-ng/functions/mysqlfunctions 2006/02/20 14:49:31 375 @@ -6,9 +6,10 @@ # # Niels Rogalla # -# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/mysqlfunctions,v 1.5 2005-08-17 22:09:59 niro Exp $ +# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/mysqlfunctions,v 1.8 2005-10-09 21:32:33 niro Exp $ -mysql_command(){ +mysql_command() +{ local SQL_USER local SQL_PASS @@ -49,7 +50,8 @@ return 0 } -mysql_enum_colums(){ +mysql_enum_colums() +{ local SQL_USER local SQL_PASS local SQL_HOST @@ -105,7 +107,8 @@ [ "${SHOWTABLES}" == true ] || echo "${i}" } -beep3x() { +beep3x() +{ echo -en "\a" sleep 0.7 echo -en "\a" @@ -115,14 +118,14 @@ reach_mysql_server() { - # set connection timeout to 10 secs - mysql --connect_timeout=10 \ + # set connection timeout to 20 secs + mysql --connect_timeout=20 \ --user="${SQL_USER}" \ --password="${SQL_PASS}" \ --host="${SQL_HOST}" \ --database="${SQL_DB}" \ --batch \ - --execute="" $> /dev/null && return 0 || \ + --execute="" &> /dev/null && return 0 || \ ( echo -e ${COLRED} echo "Cannot reach a mysql-server at '${SQL_HOST}'." @@ -134,3 +137,14 @@ return 1 ) } + +mysqldo() +{ + mysql_command \ + "${SQL_USER}" \ + "${SQL_PASS}" \ + "${SQL_HOST}" \ + "${SQL_DB}" \ + "$@" \ + && return 0 || return 1 +}