| @@ 335-355 (lines=21) @@ | ||
| 332 | $this->execute($sql); |
|
| 333 | } |
|
| 334 | ||
| 335 | public function getColumnComment($tableName, $columnName) |
|
| 336 | { |
|
| 337 | $sql = sprintf("SELECT cast(extended_properties.[value] as nvarchar(4000)) comment |
|
| 338 | FROM sys.schemas |
|
| 339 | INNER JOIN sys.tables |
|
| 340 | ON schemas.schema_id = tables.schema_id |
|
| 341 | INNER JOIN sys.columns |
|
| 342 | ON tables.object_id = columns.object_id |
|
| 343 | INNER JOIN sys.extended_properties |
|
| 344 | ON tables.object_id = extended_properties.major_id |
|
| 345 | AND columns.column_id = extended_properties.minor_id |
|
| 346 | AND extended_properties.name = 'MS_Description' |
|
| 347 | WHERE schemas.[name] = '%s' AND tables.[name] = '%s' AND columns.[name] = '%s'", $this->schema, $tableName, $columnName); |
|
| 348 | $row = $this->fetchRow($sql); |
|
| 349 | ||
| 350 | if ($row) { |
|
| 351 | return $row['comment']; |
|
| 352 | } |
|
| 353 | ||
| 354 | return false; |
|
| 355 | } |
|
| 356 | ||
| 357 | /** |
|
| 358 | * {@inheritdoc} |
|
| @@ 333-344 (lines=12) @@ | ||
| 330 | * |
|
| 331 | * @return string |
|
| 332 | */ |
|
| 333 | public function getColumnComment($tableName, $columnName) |
|
| 334 | { |
|
| 335 | $sql = sprintf( |
|
| 336 | "select COMMENTS from ALL_COL_COMMENTS WHERE COLUMN_NAME = '%s' and TABLE_NAME = '%s'", |
|
| 337 | $columnName, |
|
| 338 | $tableName |
|
| 339 | ); |
|
| 340 | $row = $this->fetchRow($sql); |
|
| 341 | ||
| 342 | if ($row['COMMENTS'] != 'NULL') { |
|
| 343 | return $row['COMMENTS']; |
|
| 344 | } |
|
| 345 | ||
| 346 | return false; |
|
| 347 | } |
|