@@ 161-175 (lines=15) @@ | ||
158 | * Two approaches to listing the table indexes. The information_schema is |
|
159 | * preferred, because it doesn't cause problems with SQL keywords such as "order" or "table". |
|
160 | */ |
|
161 | public function getListTableIndexesSQL($table, $currentDatabase = null) |
|
162 | { |
|
163 | if ($currentDatabase) { |
|
164 | $currentDatabase = $this->quoteStringLiteral($currentDatabase); |
|
165 | $table = $this->quoteStringLiteral($table); |
|
166 | ||
167 | return "SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, ". |
|
168 | "SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, ". |
|
169 | "CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, " . |
|
170 | "NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment " . |
|
171 | "FROM information_schema.STATISTICS WHERE TABLE_NAME = " . $table . " AND TABLE_SCHEMA = " . $currentDatabase; |
|
172 | } |
|
173 | ||
174 | return 'SHOW INDEX FROM ' . $table; |
|
175 | } |
|
176 | ||
177 | /** |
|
178 | * {@inheritDoc} |
|
@@ 378-392 (lines=15) @@ | ||
375 | /** |
|
376 | * {@inheritDoc} |
|
377 | */ |
|
378 | public function getListTableColumnsSQL($table, $database = null) |
|
379 | { |
|
380 | $table = $this->quoteStringLiteral($table); |
|
381 | ||
382 | if ($database) { |
|
383 | $database = $this->quoteStringLiteral($database); |
|
384 | } else { |
|
385 | $database = 'DATABASE()'; |
|
386 | } |
|
387 | ||
388 | return "SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ". |
|
389 | "COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, " . |
|
390 | "CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ". |
|
391 | "FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = " . $database . " AND TABLE_NAME = " . $table; |
|
392 | } |
|
393 | ||
394 | /** |
|
395 | * {@inheritDoc} |