mysqlloadcsv: insérer les valeurs dans une transaction

This commit is contained in:
Jephté Clain 2018-05-07 14:26:05 +04:00
parent d4137906be
commit 8b8cffd9f8
2 changed files with 7 additions and 3 deletions

View File

@ -361,7 +361,11 @@ elif [ "$method" == insert ]; then
[ -n "$prefix" ] && echo "$prefix" >>"$inserts"
[ -n "$truncate" ] && echo "$truncate" >>"$inserts"
awkcsv <"$input" >>"$inserts" -s "$skip_lines" -v table="$table" \
-v null_value="$null_value" -v types[@] -a "$__AWK_MYSQLFUNCS"'{
-v null_value="$null_value" -v types[@] -a "$__AWK_MYSQLFUNCS"'
BEGIN {
print "start transaction;"
}
{
count = length(ORIGHEADERS)
fields = ""
for (i = 1; i <= count; i++) {

4
sqlmig
View File

@ -946,7 +946,7 @@ elif [ "$action" == export ]; then
if [ -n "$dbdir" ]; then
dbdirs=("$dbdir")
elif [ -z "$updatedir" ]; then
array_lsfiles files . "*.sql"
array_lsfiles files . "*.sql" "*my.cnf" "*ora.conf"
if [ ${#files[*]} -gt 0 ]; then
enote "Autosélection répertoire courant"
dbdir="$cwd"
@ -967,7 +967,7 @@ elif [ "$action" == export ]; then
etitled "$dbname"
destdir="$exportdir/$dbname"
array_lsfiles updates "$dbdir" "*.sql"
array_lsfiles updates "$dbdir"
for update in "${updates[@]}"; do
[ -d "$destdir" ] || mkdir -p "$destdir"
copy_update "$update" "$destdir"