--- alx-src/branches/alx-web-070/scripts/sql-schema/mcore-sql-schema.sh 2016/02/05 12:06:33 8485 +++ alx-src/branches/alx-web-070/scripts/sql-schema/mcore-sql-schema.sh 2016/02/05 12:29:42 8488 @@ -64,46 +64,6 @@ && return 0 || return 1 } -mysql_insert() -{ - local cmdline="$@" - #local table="$1" - local table="${cmdline%%,*}" - local argv - local insert_line - local update_line - local key - local value - local counter - - OLD_IFS=${IFS} - IFS=, - declare -i counter=0 - #for argv in ${cmdline/$1/} # first value is the table_name - for argv in ${cmdline#*,} # first value is the table_name - do - key="${argv%=*}" - value="${argv#*=}" - - if [ ${counter} -eq 0 ] - then - insert_keys="${key}" - insert_values="'${value}'" - update_line="${key}='${value}'" - else - insert_keys+=",${key}" - insert_values+=",'${value}'" - update_line+=",${key}='${value}'" - fi - (( counter ++ )) - done - IFS=${OLD_IFS} - - echo "INSERT INTO ${table} (${insert_keys}) VALUES(${insert_values}) ON DUPLICATE KEY UPDATE ${update_line};" - #mysqldo "insert into ${table} (${insert_keys}) values(${insert_values}) on duplicate key update ${update_line};" -} - - # creates a mysql table with help of a defined array TABLE_DEFINITION: # array values are a struct like this: # first array element is the table name, everything else are column descriptions