@@ -68,47 +68,41 @@ restore()
68
68
bunzip2 -k $DIR /$TABLE .txt.bz2
69
69
fi
70
70
71
- if [ -s " $DIR /$TABLE .txt" ]; then
72
-
73
- if [ ! -z " $( cat $DIR /$BDD /$TABLE .sql | grep -i ' DEFAULT CHARSET=CP1251' ) " ]; then
74
- charset=' cp1251'
75
- else
76
- charset=' utf8'
77
- fi
78
-
79
- f_log " + $TABLE , Set default charset: $charset "
71
+ if [ -s " $DIR /$TABLE .txt" ]; then
72
+
73
+ f_log " + $TABLE "
80
74
81
- split -l $CONFIG_CHUNK " $DIR /$TABLE .txt" " $DIR /${TABLE} _part_"
82
- for segment in " $DIR /${TABLE} " _part_* ; do
83
- f_log " Restore from $segment "
84
- time mysql --defaults-extra-file=$CONFIG_FILE $BDD --local-infile -e " SET foreign_key_checks = 0; SET unique_checks = 0; SET sql_log_bin = 0;
85
- SET character_set_database = $charset ;
86
- LOAD DATA LOCAL INFILE '$segment '
87
- INTO TABLE $TABLE ;
88
- SET foreign_key_checks = 1; SET unique_checks = 1; SET sql_log_bin = 1;"
89
-
90
- if [ -f " $segment " ]; then
91
- f_log " Delete segment $segment "
92
- rm " $segment "
93
- fi
94
- done
75
+ split -l $CONFIG_CHUNK " $DIR /$TABLE .txt" " $DIR /${TABLE} _part_"
76
+ for segment in " $DIR /${TABLE} " _part_* ; do
77
+ f_log " Restore from $segment "
78
+ mysql --defaults-extra-file=$CONFIG_FILE $BDD --local-infile -e " SET foreign_key_checks = 0; SET unique_checks = 0; SET sql_log_bin = 0;
79
+ SET character_set_database=utf8;
80
+ LOAD DATA LOCAL INFILE '$segment '
81
+ INTO TABLE $TABLE ;
82
+ SET foreign_key_checks = 1; SET unique_checks = 1; SET sql_log_bin = 1;"
95
83
96
- if [ ! -f " $DIR /$TABLE .txt.bz2" ]; then
97
- f_log " Delete source file: $TABLE .txt"
98
- rm $DIR /$TABLE .txt
99
- fi
84
+ if [ -f " $segment " ]; then
85
+ f_log " Delete segment $segment "
86
+ rm " $segment "
87
+ fi
88
+ done
89
+
90
+ if [ ! -f " $DIR /$TABLE .txt.bz2" ]; then
91
+ f_log " Delete source file: $TABLE .txt"
92
+ rm $DIR /$TABLE .txt
93
+ fi
100
94
101
- fi
102
-
103
- if [ $DATABASES_TABLE_CHECK ]; then
104
- if [ -f " $DIR /$BDD /$TABLE .ibd" ]; then
105
- if [ ! $( innochecksum $DIR /$TABLE .ibd) ]; then
106
- f_log " $TABLE [OK]"
107
- else
108
- f_log " $TABLE [ERR]"
109
- fi
95
+ fi
96
+
97
+ if [ $DATABASES_TABLE_CHECK ]; then
98
+ if [ -f " $DIR /$BDD /$TABLE .ibd" ]; then
99
+ if [ ! $( innochecksum $DIR /$TABLE .ibd) ]; then
100
+ f_log " $TABLE [OK]"
101
+ else
102
+ f_log " $TABLE [ERR]"
110
103
fi
111
104
fi
105
+ fi
112
106
113
107
done
114
108
0 commit comments