framework/db/schema/pgsql/CPgsqlSchema.php
protected function findForeignKey($table,$src)
	{
		$matches=array();
		$brackets='\(([^\)]+)\)';
		$pattern="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
		if(preg_match($pattern,str_replace('"','',$src),$matches))
		{
			$keys=preg_split('/,\s+/', $matches[1]);
			$tableName=$matches[2];
			$fkeys=preg_split('/,\s+/', $matches[3]);
			foreach($keys as $i=>$key)
			{
				$table->foreignKeys[$key]=array($tableName,$fkeys[$i]);
				if(isset($table->columns[$key]))
					$table->columns[$key]->isForeignKey=true;
			}
		}
	}
protected function findForeignKey($table,$src)
	{
		$matches=array();
		$brackets='\(([^\)]+)\)';
		$pattern="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
		if(preg_match($pattern,str_replace('"','',$src),$matches))
		{
			$keys=preg_split('/,\s+/', $matches[1]);
			$tableName=$matches[2];
			$fkeys=preg_split('/,\s+/', $matches[3]);
			foreach($keys as $i=>$key)
			{
				$table->foreignKeys[$key]=array($tableName,$fkeys[$i]);
				if(isset($table->columns[$key]))
					$table->columns[$key]->isForeignKey=true;
			}
		}
	}
protected function findForeignKey ( $ table , $ src ) { $ matches = array ( ) ; $ brackets = '\(([^\)]+)\)' ; $ pattern = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i" ; if ( preg_match ( $ pattern , str_replace ( '"' , '' , $ src ) , $ matches ) ) { $ keys = preg_split ( '/,\s+/' , $ matches [ 1 ] ) ; $ tableName = $ matches [ 2 ] ; $ fkeys = preg_split ( '/,\s+/' , $ matches [ 3 ] ) ; foreach ( $ keys as $ i => $ key ) { $ table -> foreignKeys [ $ key ] = array ( $ tableName , $ fkeys [ $ i ] ) ; if ( isset ( $ table -> columns [ $ key ] ) ) $ table -> columns [ $ key ] -> isForeignKey = true ; } } }
Collects foreign key information.
@param CPgsqlTableSchema $table the table metadata
@param string $src pgsql foreign key definition
Collects foreign key information .