mirror of
https://github.com/vrana/adminer.git
synced 2025-08-17 20:01:25 +02:00
MS SQL: Fix CSV import (bug #859)
This commit is contained in:
@@ -206,12 +206,16 @@ if (isset($_GET["mssql"])) {
|
|||||||
foreach ($rows as $set) {
|
foreach ($rows as $set) {
|
||||||
$values[] = "(" . implode(", ", $set) . ")";
|
$values[] = "(" . implode(", ", $set) . ")";
|
||||||
}
|
}
|
||||||
queries("SET IDENTITY_INSERT " . table($table) . " ON");
|
if ($where) {
|
||||||
$return = queries("MERGE " . table($table) . " USING (VALUES\n\t" . implode(",\n\t", $values) . "\n) AS source ($columns) ON " . implode(" AND ", $where) //! source, c1 - possible conflict
|
queries("SET IDENTITY_INSERT " . table($table) . " ON");
|
||||||
. ($update ? "\nWHEN MATCHED THEN UPDATE SET " . implode(", ", $update) : "")
|
$return = queries("MERGE " . table($table) . " USING (VALUES\n\t" . implode(",\n\t", $values) . "\n) AS source ($columns) ON " . implode(" AND ", $where) //! source, c1 - possible conflict
|
||||||
. "\nWHEN NOT MATCHED THEN INSERT (" . implode(", ", array_keys($set)) . ") VALUES ($columns);" // ; is mandatory
|
. ($update ? "\nWHEN MATCHED THEN UPDATE SET " . implode(", ", $update) : "")
|
||||||
);
|
. "\nWHEN NOT MATCHED THEN INSERT (" . implode(", ", array_keys($set)) . ") VALUES ($columns);" // ; is mandatory
|
||||||
queries("SET IDENTITY_INSERT " . table($table) . " OFF");
|
);
|
||||||
|
queries("SET IDENTITY_INSERT " . table($table) . " OFF");
|
||||||
|
} else {
|
||||||
|
$return = queries("INSERT INTO " . table($table) . " VALUES\n" . implode(",\n", $values));
|
||||||
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@ SQLite: Display all rows of variable values
|
|||||||
SQLite: Remove support for SQLite version 2
|
SQLite: Remove support for SQLite version 2
|
||||||
MS SQL: Support export (bug #480)
|
MS SQL: Support export (bug #480)
|
||||||
MS SQL: Display foreign keys ON UPDATE and ON DELETE
|
MS SQL: Display foreign keys ON UPDATE and ON DELETE
|
||||||
|
MS SQL: Fix CSV import (bug #859)
|
||||||
MS SQL: Fix altering foreign key
|
MS SQL: Fix altering foreign key
|
||||||
MS SQL PDO: Support offset
|
MS SQL PDO: Support offset
|
||||||
MS SQL: Remove support for MSSQL extension
|
MS SQL: Remove support for MSSQL extension
|
||||||
|
Reference in New Issue
Block a user