diff --git a/sqlmig b/sqlmig index 3b084db..979bbad 100755 --- a/sqlmig +++ b/sqlmig @@ -980,6 +980,8 @@ if [ -z "$dbdir" -a -z "$updatedir" ]; then setx parentdir=dirname -- "$cwd" if __check_devel_dir src/main/resources/database; then enote "Autosélection src/main/resources/database/" + elif __check_devel_dir config/sqlmig; then + enote "Autosélection config/sqlmig/" elif __check_devel_dir support/database; then enote "Autosélection support/database/" elif __check_devel_dir database; then @@ -1086,7 +1088,8 @@ grant resource to $dbname;" echo >"$dbdir/ora.conf" "\ # Paramètres de connexion par défaut ORACLE_SID=orcl -NLS_LANG=AMERICAN_AMERICA.AL32UTF8 +NLS_LANG=FRENCH_FRANCE.AL32UTF8 +#NLS_LANG=AMERICAN_AMERICA.AL32UTF8 # paramètres de connexion pour les mises à jour administratives # si aucune valeur n'est spécifiée, la valeur effective est '/ as sysdba' mais # cela requière que la mise à jour soit faite avec une connexion locale. @@ -1334,19 +1337,24 @@ for dbdir in "${dbdirs[@]}"; do ensure_dbtype "$dbdir" "$type" ensure_dbmode "$dbtype" "$mode" - # Conversion csv --> sql - array_lsfiles csvs "$dbdir" "*.csv" - if [ "$dbtype" == mysql -a -n "$data_csv" ]; then - etitled "Conversion" - for csv in "${csvs[@]}"; do - setx csvname=basename -- "$csv" - sql="${csv%.csv}.sql" - if [ "$data_csv" != force ]; then - testnewer "$csv" "$sql" || continue - fi + if [ -n "$data_csv" ]; then + # Conversion csv --> sql + array_lsfiles csvs "$dbdir" "*.csv" + if [ "$dbtype" == mysql ]; then + setx defaults=mysql_get_defaults "$dbdir" + set_csv_null=1 + mysql__mconf_get "$defaults" - estep "$csvname --> ${csvname%.csv}.sql" - eval "$(awk '{ + etitled "Conversion" + for csv in "${csvs[@]}"; do + setx csvname=basename -- "$csv" + sql="${csv%.csv}.sql" + if [ "$data_csv" != force ]; then + testnewer "$csv" "$sql" || continue + fi + + estep "$csvname --> ${csvname%.csv}.sql" + script='{ truncate = ($0 ~ /-data_truncate(.devel)?.csv$/)? "1": "" sub(/^.*\//, "") sub(/^[A-Z0-9.]*[0-9]-?/, "") @@ -1356,10 +1364,12 @@ for dbdir in "${dbdirs[@]}"; do print "truncate=" truncate gsub(/'\''/, "'\'\\\\\'\''") print "table='\''" $0 "'\''" -}' <<<"$csvname")" #" - "$scriptdir/mysqlloadcsv" >"$sql" ${truncate:+-T} -Z "$csv_null" -nIf "$csv" "$table" --prefix "-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8" - done - eend; eclearp +}' + eval "$(awk "$script" <<<"$csvname")" + "$scriptdir/mysqlloadcsv" >"$sql" ${truncate:+-T} -Z "$csv_null" -nIf "$csv" "$table" --prefix "-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8" + done + eend; eclearp + fi fi # lister les mises à jour disponibles