@@ 72-79 (lines=8) @@ | ||
69 | while ($line = fgets($in)) { |
|
70 | if (strtolower(substr($line, 0, 11)) == 'insert into') { |
|
71 | preg_match('/^insert into `(.*)` \([^)]*\) values (.*);/i', $line, $m); |
|
72 | if (count($m) < 3) { // fallback for very long lines or other cases where the preg_match fails |
|
73 | if ($currentTable != '') { |
|
74 | fwrite($out, ";\n"); |
|
75 | } |
|
76 | fwrite($out, $line); |
|
77 | $currentTable = ''; |
|
78 | continue; |
|
79 | } |
|
80 | $table = $m[1]; |
|
81 | $values = $m[2]; |
|
82 | if ($table != $currentTable || ($len > $maxlen - 1000)) { |
|
@@ 94-100 (lines=7) @@ | ||
91 | fwrite($out, ',' . $values); |
|
92 | $len += strlen($values) + 1; |
|
93 | } |
|
94 | } else { |
|
95 | if ($currentTable != '') { |
|
96 | fwrite($out, ";\n"); |
|
97 | $currentTable = ''; |
|
98 | } |
|
99 | fwrite($out, $line); |
|
100 | } |
|
101 | } |
|
102 | fwrite($out, ";\n"); |
|
103 | fwrite($out, 'COMMIT;' . "\n"); |