]> git.joonet.de Git - adminer.git/commitdiff
MS SQL: Display default values (bug #732)
authorJakub Vrana <jakub@vrana.cz>
Sat, 22 Feb 2025 09:11:03 +0000 (10:11 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sat, 22 Feb 2025 09:11:03 +0000 (10:11 +0100)
adminer/drivers/mssql.inc.php
changes.txt

index df2ef50734b903419ff13e9eb355ecfd4a6ca4f1..4195c163579f3e1f26e7887fcac36788d901531a 100644 (file)
@@ -389,7 +389,7 @@ WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V')
 FROM sys.all_columns c
 JOIN sys.all_objects o ON c.object_id = o.object_id
 JOIN sys.types t ON c.user_type_id = t.user_type_id
-LEFT JOIN sys.default_constraints d ON c.default_object_id = d.parent_column_id
+LEFT JOIN sys.default_constraints d ON c.default_object_id = d.object_id
 WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U', 'V') AND o.name = " . q($table)
                ) as $row) {
                        $type = $row["type"];
@@ -399,7 +399,7 @@ WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U',
                                "full_type" => $type . ($length ? "($length)" : ""),
                                "type" => $type,
                                "length" => $length,
-                               "default" => $row["default"],
+                               "default" => (preg_match("~^\('(.*)'\)$~", $row["default"], $match) ? str_replace("''", "'", $match[1]) : $row["default"]),
                                "null" => $row["is_nullable"],
                                "auto_increment" => $row["is_identity"],
                                "collation" => $row["collation_name"],
index 95eaa49514445646d811bc9015f00433a8499e8d..0f1be4a7bc2695106832f34bd796f3cc9ef1152c 100644 (file)
@@ -2,6 +2,7 @@ Adminer 4.16.1-dev:
 Hide index column options by default
 SQLite: Show all supported pragmas in Variables
 MS SQL: Allow altering table in non-default schema (bug #405)
+MS SQL: Display default values (bug #732)
 Editor: PDO: Select value of foreign key in edit (bug #847)
 
 Adminer 4.16.0 (released 2025-02-20):