| @@ 419-451 (lines=33) @@ | ||
| 416 | * @license New BSD License |
|
| 417 | * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaOracleReader.html |
|
| 418 | */ |
|
| 419 | public function getListTableIndexesSQL($table, $currentDatabase = null) |
|
| 420 | { |
|
| 421 | $table = $this->normalizeIdentifier($table); |
|
| 422 | $table = $this->quoteStringLiteral($table->getName()); |
|
| 423 | ||
| 424 | return "SELECT uind_col.index_name AS name, |
|
| 425 | ( |
|
| 426 | SELECT uind.index_type |
|
| 427 | FROM user_indexes uind |
|
| 428 | WHERE uind.index_name = uind_col.index_name |
|
| 429 | ) AS type, |
|
| 430 | decode( |
|
| 431 | ( |
|
| 432 | SELECT uind.uniqueness |
|
| 433 | FROM user_indexes uind |
|
| 434 | WHERE uind.index_name = uind_col.index_name |
|
| 435 | ), |
|
| 436 | 'NONUNIQUE', |
|
| 437 | 0, |
|
| 438 | 'UNIQUE', |
|
| 439 | 1 |
|
| 440 | ) AS is_unique, |
|
| 441 | uind_col.column_name AS column_name, |
|
| 442 | uind_col.column_position AS column_pos, |
|
| 443 | ( |
|
| 444 | SELECT ucon.constraint_type |
|
| 445 | FROM user_constraints ucon |
|
| 446 | WHERE ucon.index_name = uind_col.index_name |
|
| 447 | ) AS is_primary |
|
| 448 | FROM user_ind_columns uind_col |
|
| 449 | WHERE uind_col.table_name = " . $table . " |
|
| 450 | ORDER BY uind_col.column_position ASC"; |
|
| 451 | } |
|
| 452 | ||
| 453 | /** |
|
| 454 | * {@inheritDoc} |
|
| @@ 611-638 (lines=28) @@ | ||
| 608 | /** |
|
| 609 | * {@inheritDoc} |
|
| 610 | */ |
|
| 611 | public function getListTableForeignKeysSQL($table) |
|
| 612 | { |
|
| 613 | $table = $this->normalizeIdentifier($table); |
|
| 614 | $table = $this->quoteStringLiteral($table->getName()); |
|
| 615 | ||
| 616 | return "SELECT alc.constraint_name, |
|
| 617 | alc.DELETE_RULE, |
|
| 618 | cols.column_name \"local_column\", |
|
| 619 | cols.position, |
|
| 620 | ( |
|
| 621 | SELECT r_cols.table_name |
|
| 622 | FROM user_cons_columns r_cols |
|
| 623 | WHERE alc.r_constraint_name = r_cols.constraint_name |
|
| 624 | AND r_cols.position = cols.position |
|
| 625 | ) AS \"references_table\", |
|
| 626 | ( |
|
| 627 | SELECT r_cols.column_name |
|
| 628 | FROM user_cons_columns r_cols |
|
| 629 | WHERE alc.r_constraint_name = r_cols.constraint_name |
|
| 630 | AND r_cols.position = cols.position |
|
| 631 | ) AS \"foreign_column\" |
|
| 632 | FROM user_cons_columns cols |
|
| 633 | JOIN user_constraints alc |
|
| 634 | ON alc.constraint_name = cols.constraint_name |
|
| 635 | AND alc.constraint_type = 'R' |
|
| 636 | AND alc.table_name = " . $table . " |
|
| 637 | ORDER BY cols.constraint_name ASC, cols.position ASC"; |
|
| 638 | } |
|
| 639 | ||
| 640 | /** |
|
| 641 | * {@inheritDoc} |
|