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