mysqlloadcsv: insérer les valeurs dans une transaction
This commit is contained in:
parent
d4137906be
commit
8b8cffd9f8
|
@ -361,7 +361,11 @@ elif [ "$method" == insert ]; then
|
||||||
[ -n "$prefix" ] && echo "$prefix" >>"$inserts"
|
[ -n "$prefix" ] && echo "$prefix" >>"$inserts"
|
||||||
[ -n "$truncate" ] && echo "$truncate" >>"$inserts"
|
[ -n "$truncate" ] && echo "$truncate" >>"$inserts"
|
||||||
awkcsv <"$input" >>"$inserts" -s "$skip_lines" -v table="$table" \
|
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)
|
count = length(ORIGHEADERS)
|
||||||
fields = ""
|
fields = ""
|
||||||
for (i = 1; i <= count; i++) {
|
for (i = 1; i <= count; i++) {
|
||||||
|
|
4
sqlmig
4
sqlmig
|
@ -946,7 +946,7 @@ elif [ "$action" == export ]; then
|
||||||
if [ -n "$dbdir" ]; then
|
if [ -n "$dbdir" ]; then
|
||||||
dbdirs=("$dbdir")
|
dbdirs=("$dbdir")
|
||||||
elif [ -z "$updatedir" ]; then
|
elif [ -z "$updatedir" ]; then
|
||||||
array_lsfiles files . "*.sql"
|
array_lsfiles files . "*.sql" "*my.cnf" "*ora.conf"
|
||||||
if [ ${#files[*]} -gt 0 ]; then
|
if [ ${#files[*]} -gt 0 ]; then
|
||||||
enote "Autosélection répertoire courant"
|
enote "Autosélection répertoire courant"
|
||||||
dbdir="$cwd"
|
dbdir="$cwd"
|
||||||
|
@ -967,7 +967,7 @@ elif [ "$action" == export ]; then
|
||||||
|
|
||||||
etitled "$dbname"
|
etitled "$dbname"
|
||||||
destdir="$exportdir/$dbname"
|
destdir="$exportdir/$dbname"
|
||||||
array_lsfiles updates "$dbdir" "*.sql"
|
array_lsfiles updates "$dbdir"
|
||||||
for update in "${updates[@]}"; do
|
for update in "${updates[@]}"; do
|
||||||
[ -d "$destdir" ] || mkdir -p "$destdir"
|
[ -d "$destdir" ] || mkdir -p "$destdir"
|
||||||
copy_update "$update" "$destdir"
|
copy_update "$update" "$destdir"
|
||||||
|
|
Loading…
Reference in New Issue