| @@ 469-480 (lines=12) @@ | ||
| 466 | * @param string $tableName Table Name | |
| 467 | * @return array | |
| 468 | */ | |
| 469 | protected function getIndexes($tableName) | |
| 470 |     { | |
| 471 | $indexes = []; | |
| 472 |         $rows = $this->fetchAll(sprintf('SHOW INDEXES FROM %s', $this->quoteTableName($tableName))); | |
| 473 |         foreach ($rows as $row) { | |
| 474 |             if (!isset($indexes[$row['Key_name']])) { | |
| 475 | $indexes[$row['Key_name']] = ['columns' => []]; | |
| 476 | } | |
| 477 | $indexes[$row['Key_name']]['columns'][] = strtolower($row['Column_name']); | |
| 478 | } | |
| 479 | ||
| 480 | return $indexes; | |
| 481 | } | |
| 482 | ||
| 483 | /** | |
| @@ 530-559 (lines=30) @@ | ||
| 527 | * @param string $tableName Table Name | |
| 528 | * @return array | |
| 529 | */ | |
| 530 | protected function getIndexes($tableName) | |
| 531 |     { | |
| 532 | $indexes = []; | |
| 533 | $sql = "SELECT | |
| 534 | i.relname AS index_name, | |
| 535 | a.attname AS column_name | |
| 536 | FROM | |
| 537 | pg_class t, | |
| 538 | pg_class i, | |
| 539 | pg_index ix, | |
| 540 | pg_attribute a | |
| 541 | WHERE | |
| 542 | t.oid = ix.indrelid | |
| 543 | AND i.oid = ix.indexrelid | |
| 544 | AND a.attrelid = t.oid | |
| 545 | AND a.attnum = ANY(ix.indkey) | |
| 546 | AND t.relkind = 'r' | |
| 547 | AND t.relname = '$tableName' | |
| 548 | ORDER BY | |
| 549 | t.relname, | |
| 550 | i.relname;"; | |
| 551 | $rows = $this->fetchAll($sql); | |
| 552 |         foreach ($rows as $row) { | |
| 553 |             if (!isset($indexes[$row['index_name']])) { | |
| 554 | $indexes[$row['index_name']] = ['columns' => []]; | |
| 555 | } | |
| 556 | $indexes[$row['index_name']]['columns'][] = strtolower($row['column_name']); | |
| 557 | } | |
| 558 | ||
| 559 | return $indexes; | |
| 560 | } | |
| 561 | ||
| 562 | /** | |