--- alx-src/branches/alxconf-060/functions/mysqlfunctions 2011/05/09 14:52:07 2002 +++ alx-src/branches/alxconf-060/functions/mysqlfunctions 2011/05/09 14:52:38 2003 @@ -1,12 +1,5 @@ -#!/bin/bash - -# -# mysql functions for the bash -# Version 0.1 -# -# Niels Rogalla -# -# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/mysqlfunctions,v 1.8 2005-10-09 21:32:33 niro Exp $ +# $Id$ +# mysql functions for bash mysql_command() { @@ -17,13 +10,13 @@ local SQL_DB local SQL_COMMAND - SQL_USER=$1 - SQL_PASS=$2 - SQL_HOST=$3 - SQL_DB=$4 - SQL_COMMAND=$5 + SQL_USER="$1" + SQL_PASS="$2" + SQL_HOST="$3" + SQL_DB="$4" + SQL_COMMAND="$5" - #fallback (SQL_OPTS not, they are optional ) + # fallback (SQL_OPTS not, they are optional ) if [ -z "${SQL_USER}" \ -o -z "${SQL_PASS}" \ -o -z "${SQL_HOST}" \ @@ -36,7 +29,7 @@ echo return 1 fi - + mysql \ --user="${SQL_USER}" \ --password="${SQL_PASS}" \ @@ -46,7 +39,7 @@ --skip-column-names \ --execute="${SQL_COMMAND}" \ || return 1 - + return 0 } @@ -67,14 +60,14 @@ local key local default local extra - + SQL_USER=$1 SQL_PASS=$2 SQL_HOST=$3 SQL_DB=$4 SQL_TABLE=$5 - - #show the column names ? + + # show the column names ? if [ -n "${6}" -a "${6}" == "show" ] then SHOWTABLES=true @@ -82,7 +75,7 @@ SHOWTABLES=false fi - #fallback (SQL_OPTS not, they are optional ) + # fallback (SQL_OPTS not, they are optional ) if [ -z "${SQL_USER}" \ -o -z "${SQL_PASS}" \ -o -z "${SQL_HOST}" \