1 | <?php declare(strict_types=1); |
||
14 | final class TableMetadata |
||
15 | { |
||
16 | /** @var string */ |
||
17 | private $databaseName; |
||
18 | |||
19 | /** @var string */ |
||
20 | private $tableName; |
||
21 | |||
22 | /** @var string */ |
||
23 | private $engine; |
||
24 | |||
25 | /** @var string */ |
||
26 | private $collation; |
||
27 | |||
28 | /** @var string */ |
||
29 | private $charset; |
||
30 | |||
31 | /** @var int */ |
||
32 | private $rowCount; |
||
33 | |||
34 | /** @var ColumnMetadata[] */ |
||
35 | private $columnMetadataList = []; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @param string $databaseName |
||
40 | * @param string $tableName |
||
41 | * @param string $engine |
||
42 | * @param string $collation |
||
43 | * @param string $charset |
||
44 | * @param int $rowCount |
||
45 | * @param ColumnMetadata[] $columnMetadataList |
||
46 | */ |
||
47 | 14 | public function __construct( |
|
67 | |||
68 | 1 | public function getDatabaseName(): string |
|
72 | |||
73 | 7 | public function getTableName(): string |
|
77 | |||
78 | 1 | public function getEngine(): string |
|
82 | |||
83 | 1 | public function getCollation(): string |
|
87 | |||
88 | 1 | public function getCharset(): string |
|
92 | |||
93 | 1 | public function getRowCount(): int |
|
97 | |||
98 | /** |
||
99 | * Get the metadata for a single column. |
||
100 | * |
||
101 | * @throws \RuntimeException when the column does not exist. |
||
102 | */ |
||
103 | 2 | public function getColumnMetadata(string $columnName): ColumnMetadata |
|
111 | |||
112 | /** |
||
113 | * Get the metadata for all columns. |
||
114 | * |
||
115 | * @return ColumnMetadata[] |
||
116 | */ |
||
117 | 1 | public function getAllColumnMetadata(): array |
|
121 | |||
122 | /** |
||
123 | * Returns true if the table has at least one column that is a string type. |
||
124 | */ |
||
125 | 2 | public function hasStringTypeColumn(): bool |
|
133 | |||
134 | /** |
||
135 | * Returns the primary key column metadata. |
||
136 | */ |
||
137 | 1 | public function getPrimaryKeyMetadata(): ?ColumnMetadata |
|
145 | } |