| @@ 431-463 (lines=33) @@ | ||
| 428 | * @license New BSD License |
|
| 429 | * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaOracleReader.html |
|
| 430 | */ |
|
| 431 | public function getListTableIndexesSQL($table, $currentDatabase = null) |
|
| 432 | { |
|
| 433 | $table = $this->normalizeIdentifier($table); |
|
| 434 | $table = $this->quoteStringLiteral($table->getName()); |
|
| 435 | ||
| 436 | return "SELECT uind_col.index_name AS name, |
|
| 437 | ( |
|
| 438 | SELECT uind.index_type |
|
| 439 | FROM user_indexes uind |
|
| 440 | WHERE uind.index_name = uind_col.index_name |
|
| 441 | ) AS type, |
|
| 442 | decode( |
|
| 443 | ( |
|
| 444 | SELECT uind.uniqueness |
|
| 445 | FROM user_indexes uind |
|
| 446 | WHERE uind.index_name = uind_col.index_name |
|
| 447 | ), |
|
| 448 | 'NONUNIQUE', |
|
| 449 | 0, |
|
| 450 | 'UNIQUE', |
|
| 451 | 1 |
|
| 452 | ) AS is_unique, |
|
| 453 | uind_col.column_name AS column_name, |
|
| 454 | uind_col.column_position AS column_pos, |
|
| 455 | ( |
|
| 456 | SELECT ucon.constraint_type |
|
| 457 | FROM user_constraints ucon |
|
| 458 | WHERE ucon.index_name = uind_col.index_name |
|
| 459 | ) AS is_primary |
|
| 460 | FROM user_ind_columns uind_col |
|
| 461 | WHERE uind_col.table_name = " . $table . " |
|
| 462 | ORDER BY uind_col.column_position ASC"; |
|
| 463 | } |
|
| 464 | ||
| 465 | /** |
|
| 466 | * {@inheritDoc} |
|
| @@ 623-650 (lines=28) @@ | ||
| 620 | /** |
|
| 621 | * {@inheritDoc} |
|
| 622 | */ |
|
| 623 | public function getListTableForeignKeysSQL($table) |
|
| 624 | { |
|
| 625 | $table = $this->normalizeIdentifier($table); |
|
| 626 | $table = $this->quoteStringLiteral($table->getName()); |
|
| 627 | ||
| 628 | return "SELECT alc.constraint_name, |
|
| 629 | alc.DELETE_RULE, |
|
| 630 | cols.column_name \"local_column\", |
|
| 631 | cols.position, |
|
| 632 | ( |
|
| 633 | SELECT r_cols.table_name |
|
| 634 | FROM user_cons_columns r_cols |
|
| 635 | WHERE alc.r_constraint_name = r_cols.constraint_name |
|
| 636 | AND r_cols.position = cols.position |
|
| 637 | ) AS \"references_table\", |
|
| 638 | ( |
|
| 639 | SELECT r_cols.column_name |
|
| 640 | FROM user_cons_columns r_cols |
|
| 641 | WHERE alc.r_constraint_name = r_cols.constraint_name |
|
| 642 | AND r_cols.position = cols.position |
|
| 643 | ) AS \"foreign_column\" |
|
| 644 | FROM user_cons_columns cols |
|
| 645 | JOIN user_constraints alc |
|
| 646 | ON alc.constraint_name = cols.constraint_name |
|
| 647 | AND alc.constraint_type = 'R' |
|
| 648 | AND alc.table_name = " . $table . " |
|
| 649 | ORDER BY cols.constraint_name ASC, cols.position ASC"; |
|
| 650 | } |
|
| 651 | ||
| 652 | /** |
|
| 653 | * {@inheritDoc} |
|