Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/mysqlfunctions

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2002 by niro, Thu Apr 14 19:29:35 2011 UTC revision 2003 by niro, Mon May 9 14:52:38 2011 UTC
# Line 1  Line 1 
1  #!/bin/bash  # $Id$
2    # mysql functions for bash
 #  
 # mysql functions for the bash  
 # Version 0.1  
 #  
 # Niels Rogalla <niro@magellan-linux.de>  
 #  
 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/mysqlfunctions,v 1.8 2005-10-09 21:32:33 niro Exp $  
3    
4  mysql_command()  mysql_command()
5  {  {
# Line 17  mysql_command() Line 10  mysql_command()
10   local SQL_DB   local SQL_DB
11   local SQL_COMMAND   local SQL_COMMAND
12    
13   SQL_USER=$1   SQL_USER="$1"
14   SQL_PASS=$2   SQL_PASS="$2"
15   SQL_HOST=$3   SQL_HOST="$3"
16   SQL_DB=$4   SQL_DB="$4"
17   SQL_COMMAND=$5   SQL_COMMAND="$5"
18    
19   #fallback (SQL_OPTS not, they are optional )   # fallback (SQL_OPTS not, they are optional )
20   if [ -z "${SQL_USER}" \   if [ -z "${SQL_USER}" \
21   -o -z "${SQL_PASS}" \   -o -z "${SQL_PASS}" \
22   -o -z "${SQL_HOST}" \   -o -z "${SQL_HOST}" \
# Line 36  mysql_command() Line 29  mysql_command()
29   echo   echo
30   return 1   return 1
31   fi   fi
32    
33   mysql \   mysql \
34   --user="${SQL_USER}" \   --user="${SQL_USER}" \
35   --password="${SQL_PASS}" \   --password="${SQL_PASS}" \
# Line 46  mysql_command() Line 39  mysql_command()
39   --skip-column-names \   --skip-column-names \
40   --execute="${SQL_COMMAND}" \   --execute="${SQL_COMMAND}" \
41   || return 1   || return 1
42    
43   return 0   return 0
44  }  }
45    
# Line 67  mysql_enum_colums() Line 60  mysql_enum_colums()
60   local key   local key
61   local default   local default
62   local extra   local extra
63    
64   SQL_USER=$1   SQL_USER=$1
65   SQL_PASS=$2   SQL_PASS=$2
66   SQL_HOST=$3   SQL_HOST=$3
67   SQL_DB=$4   SQL_DB=$4
68   SQL_TABLE=$5   SQL_TABLE=$5
69    
70   #show the column names ?   # show the column names ?
71   if [ -n "${6}" -a "${6}" == "show" ]   if [ -n "${6}" -a "${6}" == "show" ]
72   then   then
73   SHOWTABLES=true   SHOWTABLES=true
# Line 82  mysql_enum_colums() Line 75  mysql_enum_colums()
75   SHOWTABLES=false   SHOWTABLES=false
76   fi   fi
77    
78   #fallback (SQL_OPTS not, they are optional )   # fallback (SQL_OPTS not, they are optional )
79   if [ -z "${SQL_USER}" \   if [ -z "${SQL_USER}" \
80   -o -z "${SQL_PASS}" \   -o -z "${SQL_PASS}" \
81   -o -z "${SQL_HOST}" \   -o -z "${SQL_HOST}" \

Legend:
Removed from v.2002  
changed lines
  Added in v.2003