Magellan Linux

Diff of /alx-src/trunk/tinyalxconfig-ng/functions/mysqlfunctions

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

revision 471 by niro, Thu Jun 5 18:16:20 2008 UTC revision 472 by niro, Fri Jun 6 23:19:08 2008 UTC
# Line 6  Line 6 
6  #  #
7  # Niels Rogalla <niro@magellan-linux.de>  # Niels Rogalla <niro@magellan-linux.de>
8  #  #
9  # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/mysqlfunctions,v 1.6 2008-06-05 18:16:20 niro Exp $  # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/mysqlfunctions,v 1.7 2008-06-06 23:19:08 niro Exp $
10    
11  mysql_command()  mysql_command()
12  {  {
# Line 186  evaluate_table() Line 186  evaluate_table()
186   export ${table}_${all_vars[${i}]}   export ${table}_${all_vars[${i}]}
187   done   done
188  }  }
189    
190    # read tables and evaluate all variables
191    # cmd:    evaluate_table cfg_network
192    # result: cfg_network_hostname=DUMMY_HOSTNAME
193    evaluate_table_xml()
194    {
195     local table="$1"
196     local where_statement
197    
198     if [[ -z $2 ]]
199     then
200     where_statement="where serial='${ALX_SERIAL}'"
201     else
202     where_statement="$2"
203     fi
204    
205     export eval $(mysql \
206     --user="${SQL_USER}" \
207     --password="${SQL_PASS}" \
208     --host="${SQL_HOST}" \
209     --database="${SQL_DB}" \
210     --xml \
211     --execute="select * from ${table} ${where_statement}" \
212     | xml sel -T -t -m //row/field \
213     -v "concat('${table}_',@name,'=',self::field)" -n)
214    }

Legend:
Removed from v.471  
changed lines
  Added in v.472