--- alx-src/branches/alx-web-070/scripts/sql-schema/mcore-sql-schema.sh 2016/02/05 12:29:42 8488 +++ alx-src/branches/alx-web-070/scripts/sql-schema/mcore-sql-schema.sh 2016/02/05 12:30:35 8489 @@ -111,17 +111,14 @@ create+=", ${column} ${opts}" fi done - echo "CREATE TABLE ${MCORE_SQL_DB}.${table} ( ${create} );" mysqldo "CREATE TABLE ${MCORE_SQL_DB}.${table} ( ${create} );" || die "creating table '${table}'" if [[ -n ${primary} ]] then - echo "ALTER TABLE ${MCORE_SQL_DB}.${table} ADD PRIMARY KEY (${primary});" mysqldo "ALTER TABLE ${MCORE_SQL_DB}.${table} ADD PRIMARY KEY (${primary});" || die "adding primary key to table '${table}'" fi if [[ -n ${autoincrement} ]] then - echo "ALTER TABLE ${MCORE_SQL_DB}.${table} MODIFY ${autoincrement} AUTO_INCREMENT;" mysqldo "ALTER TABLE ${MCORE_SQL_DB}.${table} MODIFY ${autoincrement} AUTO_INCREMENT;" || die "adding auto_increment to table '${table}'" fi } @@ -171,11 +168,9 @@ if [[ -n ${id} ]] then # update value in database - echo "UPDATE ${MCORE_SQL_DB}.${table} SET ${column_value}='${value}', ${column_bool}='${bool}' WHERE ${column_id}='${id}';" mysqldo "UPDATE ${MCORE_SQL_DB}.${table} SET ${column_value}='${value}', ${column_bool}='${bool}' WHERE ${column_id}='${id}';" || die "update value in table ${table}" else # insert into the database - echo "INSERT INTO ${MCORE_SQL_DB}.${table} (${column_value}, ${column_bool}) VALUES ( '${value}', '${bool}' );" mysqldo "INSERT INTO ${MCORE_SQL_DB}.${table} (${column_value}, ${column_bool}) VALUES ( '${value}', '${bool}' );" || die "insert value into table ${table}" fi done