|
@@ 172-186 (lines=15) @@
|
| 169 |
|
* Two approaches to listing the table indexes. The information_schema is |
| 170 |
|
* preferred, because it doesn't cause problems with SQL keywords such as "order" or "table". |
| 171 |
|
*/ |
| 172 |
|
public function getListTableIndexesSQL($table, $currentDatabase = null) |
| 173 |
|
{ |
| 174 |
|
if ($currentDatabase) { |
| 175 |
|
$currentDatabase = $this->quoteStringLiteral($currentDatabase); |
| 176 |
|
$table = $this->quoteStringLiteral($table); |
| 177 |
|
|
| 178 |
|
return "SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, ". |
| 179 |
|
"SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, ". |
| 180 |
|
"CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, " . |
| 181 |
|
"NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment " . |
| 182 |
|
"FROM information_schema.STATISTICS WHERE TABLE_NAME = " . $table . " AND TABLE_SCHEMA = " . $currentDatabase; |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
return 'SHOW INDEX FROM ' . $table; |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
/** |
| 189 |
|
* {@inheritDoc} |
|
@@ 389-403 (lines=15) @@
|
| 386 |
|
/** |
| 387 |
|
* {@inheritDoc} |
| 388 |
|
*/ |
| 389 |
|
public function getListTableColumnsSQL($table, $database = null) |
| 390 |
|
{ |
| 391 |
|
$table = $this->quoteStringLiteral($table); |
| 392 |
|
|
| 393 |
|
if ($database) { |
| 394 |
|
$database = $this->quoteStringLiteral($database); |
| 395 |
|
} else { |
| 396 |
|
$database = 'DATABASE()'; |
| 397 |
|
} |
| 398 |
|
|
| 399 |
|
return "SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ". |
| 400 |
|
"COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, " . |
| 401 |
|
"CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ". |
| 402 |
|
"FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = " . $database . " AND TABLE_NAME = " . $table; |
| 403 |
|
} |
| 404 |
|
|
| 405 |
|
/** |
| 406 |
|
* {@inheritDoc} |