sqlmig: support chemin config/sqlmig et bug avec csv_null
This commit is contained in:
parent
45da726704
commit
01325d0c23
44
sqlmig
44
sqlmig
|
@ -980,6 +980,8 @@ if [ -z "$dbdir" -a -z "$updatedir" ]; then
|
||||||
setx parentdir=dirname -- "$cwd"
|
setx parentdir=dirname -- "$cwd"
|
||||||
if __check_devel_dir src/main/resources/database; then
|
if __check_devel_dir src/main/resources/database; then
|
||||||
enote "Autosélection src/main/resources/database/"
|
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
|
elif __check_devel_dir support/database; then
|
||||||
enote "Autosélection support/database/"
|
enote "Autosélection support/database/"
|
||||||
elif __check_devel_dir database; then
|
elif __check_devel_dir database; then
|
||||||
|
@ -1086,7 +1088,8 @@ grant resource to $dbname;"
|
||||||
echo >"$dbdir/ora.conf" "\
|
echo >"$dbdir/ora.conf" "\
|
||||||
# Paramètres de connexion par défaut
|
# Paramètres de connexion par défaut
|
||||||
ORACLE_SID=orcl
|
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
|
# paramètres de connexion pour les mises à jour administratives
|
||||||
# si aucune valeur n'est spécifiée, la valeur effective est '/ as sysdba' mais
|
# 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.
|
# 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_dbtype "$dbdir" "$type"
|
||||||
ensure_dbmode "$dbtype" "$mode"
|
ensure_dbmode "$dbtype" "$mode"
|
||||||
|
|
||||||
# Conversion csv --> sql
|
if [ -n "$data_csv" ]; then
|
||||||
array_lsfiles csvs "$dbdir" "*.csv"
|
# Conversion csv --> sql
|
||||||
if [ "$dbtype" == mysql -a -n "$data_csv" ]; then
|
array_lsfiles csvs "$dbdir" "*.csv"
|
||||||
etitled "Conversion"
|
if [ "$dbtype" == mysql ]; then
|
||||||
for csv in "${csvs[@]}"; do
|
setx defaults=mysql_get_defaults "$dbdir"
|
||||||
setx csvname=basename -- "$csv"
|
set_csv_null=1
|
||||||
sql="${csv%.csv}.sql"
|
mysql__mconf_get "$defaults"
|
||||||
if [ "$data_csv" != force ]; then
|
|
||||||
testnewer "$csv" "$sql" || continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
estep "$csvname --> ${csvname%.csv}.sql"
|
etitled "Conversion"
|
||||||
eval "$(awk '{
|
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": ""
|
truncate = ($0 ~ /-data_truncate(.devel)?.csv$/)? "1": ""
|
||||||
sub(/^.*\//, "")
|
sub(/^.*\//, "")
|
||||||
sub(/^[A-Z0-9.]*[0-9]-?/, "")
|
sub(/^[A-Z0-9.]*[0-9]-?/, "")
|
||||||
|
@ -1356,10 +1364,12 @@ for dbdir in "${dbdirs[@]}"; do
|
||||||
print "truncate=" truncate
|
print "truncate=" truncate
|
||||||
gsub(/'\''/, "'\'\\\\\'\''")
|
gsub(/'\''/, "'\'\\\\\'\''")
|
||||||
print "table='\''" $0 "'\''"
|
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"
|
eval "$(awk "$script" <<<"$csvname")"
|
||||||
done
|
"$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"
|
||||||
eend; eclearp
|
done
|
||||||
|
eend; eclearp
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# lister les mises à jour disponibles
|
# lister les mises à jour disponibles
|
||||||
|
|
Loading…
Reference in New Issue