/**
  * get the foreign key object from a db result array
  *
  * @param   string[] dbresult array
  * @return  rdbms.DBForeignKeyConstraint
  */
 private function parseForeignKey($db_constraint)
 {
     $cstring = $db_constraint['definition'];
     $bracestrings = $this->subBracerString($cstring);
     $strings = explode(' ', $cstring);
     $attributes = array();
     foreach ($bracestrings as $bracestring) {
         $attributes[] = $this->extractParams($bracestring);
     }
     $constraint = new DBForeignKeyConstraint();
     $constraint->setSource($strings[5]);
     $constraint->setName($db_constraint['name']);
     $constraint->setKeys(array_combine($attributes[0], $attributes[1]));
     return $constraint;
 }
 /**
  * get the foreign key object from a string
  *
  * @param   string parsestring
  * @return  rdbms.DBForeignKeyConstraint
  */
 private function parseForeignKeyString($string)
 {
     $constraint = new DBForeignKeyConstraint();
     $quotstrings = array();
     $bracestrings = array();
     $attributes = array();
     $pos = 10;
     while (++$pos < strlen($string)) {
         switch ($string[$pos]) {
             case '`':
                 $quotstrings[] = $this->parseQuoteString($string, $pos, '`');
                 break;
             case '"':
                 $quotstrings[] = $this->parseQuoteString($string, $pos, '"');
                 break;
             case '(':
                 $bracestrings[] = $this->parseBracerString($string, $pos);
                 break;
         }
     }
     foreach ($bracestrings as $bracestring) {
         $params = $this->extractParams($bracestring);
         foreach ($params as $i => $param) {
             $params[$i] = substr($param, 1, -1);
         }
         $attributes[] = $params;
     }
     $constraint->setKeys(array_combine($attributes[0], $attributes[1]));
     $constraint->setName($quotstrings[0]);
     $constraint->setSource($quotstrings[1]);
     return $constraint;
 }