File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed
lib/Doctrine/DBAL/Platforms Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -1693,20 +1693,28 @@ private function generateIdentifierName($identifier)
1693
1693
return strtoupper (dechex (crc32 ($ identifier ->getName ())));
1694
1694
}
1695
1695
1696
+ public function getCommentOnTableSQL (string $ tableName , ?string $ comment ) : string
1697
+ {
1698
+ return sprintf (
1699
+ 'EXEC sys.sp_addextendedproperty @name=N \'MS_Description \',
1700
+ @value=N%s , @level0type=N \'SCHEMA \',@level0name=N \'dbo \',
1701
+ @level1type=N \'TABLE \',@level1name=N%s ' ,
1702
+ $ this ->quoteStringLiteral ((string ) $ comment ),
1703
+ $ this ->quoteStringLiteral ($ tableName )
1704
+ );
1705
+ }
1706
+
1696
1707
public function getListTableMetadataSQL (string $ table ) : string
1697
1708
{
1698
1709
return sprintf (
1699
1710
<<<'SQL'
1700
- SELECT td.value AS [table_comment],
1701
- FROM sysobjects t
1702
- INNER JOIN sysusers u
1703
- ON u.uid = t.uid
1704
- LEFT OUTER JOIN sys.extended_properties td
1705
- ON td.major_id = t.id
1706
- AND td.minor_id = 0
1707
- AND td.name = 'MS_Description'
1708
- WHERE t.type = %s
1709
- ORDER BY t.name, c.colorder
1711
+ SELECT
1712
+ p.value AS [table_comment]
1713
+ FROM
1714
+ sys.tables AS tbl
1715
+ INNER JOIN sys.extended_properties AS p ON p.major_id=tbl.object_id AND p.minor_id=0 AND p.class=1
1716
+ WHERE
1717
+ (tbl.name=N%s and SCHEMA_NAME(tbl.schema_id)=N'dbo' and p.name=N'MS_Description')
1710
1718
SQL
1711
1719
,
1712
1720
$ this ->quoteStringLiteral ($ table )
You can’t perform that action at this time.
0 commit comments