1
0
mirror of synced 2024-12-14 07:06:04 +03:00

added listTableConstraints

This commit is contained in:
runa 2006-11-03 20:16:19 +00:00
parent cdd49b76de
commit 36e69bebc5

View File

@ -308,7 +308,8 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict {
* @return array
*/
public function listTableConstraints($table) {
$sql = 'select KCU.COLUMN_NAME as referencingColumn, TC.CONSTRAINT_NAME as constraintName, KCU.REFERENCED_TABLE_SCHEMA as referencedTableSchema, KCU.REFERENCED_TABLE_NAME as referencedTable, KCU.REFERENCED_COLUMN_NAME as referencedColumn from INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC inner JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU on TC.CONSTRAINT_NAME=KCU.CONSTRAINT_NAME and TC.TABLE_SCHEMA = KCU.TABLE_SCHEMA and TC.TABLE_NAME=KCU.TABLE_NAME WHERE TC.TABLE_SCHEMA=database() AND TC.TABLE_NAME="'.$table.'" AND CONSTRAINT_TYPE="FOREIGN KEY"';
return $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
}
/**
* lists table constraints