Open ptica opened 10 years ago
the describe now can be hinted to use a dbLink and inspect the synonym source table:
class MyModel extends AppModel {
// hints for Oracle::describe
public $oracleDbLink = 'DB_LINK_NAME';
public $oracleSrcTable = 'SRC_TABLE_FOR_SYNONYM';
the listSources
problem could be solved by an app specific db driver with overloaded Oracle::listSources
method with custom crafted sql
(I did so as I needed to solve a timing issue as my production has had thousands of unrelated tables as well)
App::uses('Oracle', 'Oracle.Model/Datasource');
App::uses('DboSource', 'Model/Datasource');
class AppOracle extends Oracle {
function listSources($data = null) {
...
$sql = 'SELECT synonym_name AS name FROM all_synonyms where owner=... UNION SELECT table_name AS name FROM all_tables where owner=...
SELECT synonym_name AS name FROM all_synonyms UNION [all_views] UNION [all_tables]
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION FROM all_tab_columns@db_link WHERE table_name = '$table_hidden_under_synonym'