Add discoverExportedForeignKeys

This commit is contained in:
Raymond Feng 2013-06-02 23:00:11 -07:00
parent a2da90867f
commit 567efc5698
1 changed files with 35 additions and 0 deletions

View File

@ -426,6 +426,41 @@ DataSource.prototype.discoverForeignKeysSync= function(owner, table) {
return null; return null;
} }
/**
* Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).
* They are ordered by fkTableOwner, fkTableName, and keySeq.
*
* fkOwner String => foreign key table schema (may be null)
* fkName String => foreign key name (may be null)
* fkTableName String => foreign key table name
* fkColumnName String => foreign key column name
* keySeq short => sequence number within a foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
* pkOwner String => primary key table schema being imported (may be null)
* pkName String => primary key name (may be null)
* pkTableName String => primary key table name being imported
* pkColumnName String => primary key column name being imported
*
* @param owner
* @param table
* @param cb
*/
DataSource.prototype.discoverExportedForeignKeys= function(owner, table, cb) {
this.freeze();
if (this.adapter.discoverExportedForeignKeys) {
this.adapter.discoverExportedForeignKeys(owner, table, cb);
} else if (cb) {
cb();
}
}
DataSource.prototype.discoverExportedForeignKeysSync= function(owner, table) {
this.freeze();
if (this.adapter.discoverExportedForeignKeysSync) {
return this.adapter.discoverExportedForeignKeysSync(owner, table);
}
return null;
}
function capitalize(str) { function capitalize(str) {
if (!str) { if (!str) {
return str; return str;