system/classes/Db_MySQL.php
protected function foreignKeyStringFromArray($dataMember, $opening, $sep = ', ')
    {
        if (empty($this->$dataMember)) {
            return 0;
        }
        //$query = '';
        $count = count($this->$dataMember);
        for($i=0; $i<$count; $i++) {
            $item = $this->{$dataMember}[$i];
            
            $this->query .= ', CONSTRAINT '.'fk_'.$item[0].' FOREIGN KEY ('.$item[0].') REFERENCES '.$item[1].' ('.$item[2].')';
            if ($count-1 != $i) {
                $this->query .= $sep;
            }
        }
    }
protected function foreignKeyStringFromArray($dataMember, $opening, $sep = ', ')
    {
        if (empty($this->$dataMember)) {
            return 0;
        }
        //$query = '';
        $count = count($this->$dataMember);
        for($i=0; $i<$count; $i++) {
            $item = $this->{$dataMember}[$i];
            
            $this->query .= ', CONSTRAINT '.'fk_'.$item[0].' FOREIGN KEY ('.$item[0].') REFERENCES '.$item[1].' ('.$item[2].')';
            if ($count-1 != $i) {
                $this->query .= $sep;
            }
        }
    }
For outputting a string of the following form from the 'foreignKeys' array in Database.
CONSTRAINT fk_name FOREIGN KEY (name) REFERENCES users (name)