mirror of
https://github.com/vrana/adminer.git
synced 2025-08-11 17:14:07 +02:00
MS SQL: Limit one INSERT in export to 1000 rows (fix #983)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
- PostgreSQL: Support COPY FROM stdin in SQL query (bug #942)
|
||||
- MySQL: Display number of found rows in group queries (regression from 5.1.1)
|
||||
- non-MySQL: Parse '--' without trailing space as comment in SQL command (bug SF-842)
|
||||
- MS SQL: Limit one INSERT in export to 1000 rows (bug #983)
|
||||
- CSS: Add logo
|
||||
- Editor: Move mass sending e-mails to a plugin
|
||||
- Plugins: Allow formatting translations using Adminer\lang_format()
|
||||
|
@@ -816,6 +816,7 @@ class Adminer {
|
||||
$generated = array();
|
||||
$suffix = "";
|
||||
$fetch_function = ($table != '' ? 'fetch_assoc' : 'fetch_row');
|
||||
$count = 0;
|
||||
while ($row = $result->$fetch_function()) {
|
||||
if (!$keys) {
|
||||
$values = array();
|
||||
@@ -855,13 +856,17 @@ class Adminer {
|
||||
$s = ($max_packet ? "\n" : " ") . "(" . implode(",\t", $row) . ")";
|
||||
if (!$buffer) {
|
||||
$buffer = $insert . $s;
|
||||
} elseif (strlen($buffer) + 4 + strlen($s) + strlen($suffix) < $max_packet) { // 4 - length specification
|
||||
} elseif (JUSH == 'mssql'
|
||||
? $count % 1000 != 0 // https://learn.microsoft.com/en-us/sql/t-sql/queries/table-value-constructor-transact-sql#limitations-and-restrictions
|
||||
: strlen($buffer) + 4 + strlen($s) + strlen($suffix) < $max_packet // 4 - length specification
|
||||
) {
|
||||
$buffer .= ",$s";
|
||||
} else {
|
||||
echo $buffer . $suffix;
|
||||
$buffer = $insert . $s;
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
if ($buffer) {
|
||||
echo $buffer . $suffix;
|
||||
|
Reference in New Issue
Block a user