public function getKeySQL($xmldb_table, $xmldb_key) {

        $key = '';

        switch ($xmldb_key->getType()) {
            case XMLDB_KEY_PRIMARY:
                if ($this->primary_keys) {
                    if ($this->primary_key_name !== null) {
                        $key = $this->getEncQuoted($this->primary_key_name);
                    } else {
                        $key = $this->getNameForObject($xmldb_table->getName(), implode(', ', $xmldb_key->getFields()), 'pk');
                    }
                    $key .= ' PRIMARY KEY (' . implode(', ', $this->getEncQuoted($xmldb_key->getFields())) . ')';
                }
                break;
            case XMLDB_KEY_UNIQUE:
                if ($this->unique_keys) {
                    $key = $this->getNameForObject($xmldb_table->getName(), implode(', ', $xmldb_key->getFields()), 'uk');
                    $key .= ' UNIQUE (' . implode(', ', $this->getEncQuoted($xmldb_key->getFields())) . ')';
                }
                break;
            case XMLDB_KEY_FOREIGN:
            case XMLDB_KEY_FOREIGN_UNIQUE:
                if ($this->foreign_keys) {
                    $key = $this->getNameForObject($xmldb_table->getName(), implode(', ', $xmldb_key->getFields()), 'fk');
                    $key .= ' FOREIGN KEY (' . implode(', ', $this->getEncQuoted($xmldb_key->getFields())) . ')';
                    $key .= ' REFERENCES ' . $this->getEncQuoted($this->prefix . $xmldb_key->getRefTable());
                    $key .= ' (' . implode(', ', $this->getEncQuoted($xmldb_key->getRefFields())) . ')';
                }
                break;
        }

        return $key;
    }
public function getKeySQL($xmldb_table, $xmldb_key) {

        $key = '';

        switch ($xmldb_key->getType()) {
            case XMLDB_KEY_PRIMARY:
                if ($this->primary_keys) {
                    if ($this->primary_key_name !== null) {
                        $key = $this->getEncQuoted($this->primary_key_name);
                    } else {
                        $key = $this->getNameForObject($xmldb_table->getName(), implode(', ', $xmldb_key->getFields()), 'pk');
                    }
                    $key .= ' PRIMARY KEY (' . implode(', ', $this->getEncQuoted($xmldb_key->getFields())) . ')';
                }
                break;
            case XMLDB_KEY_UNIQUE:
                if ($this->unique_keys) {
                    $key = $this->getNameForObject($xmldb_table->getName(), implode(', ', $xmldb_key->getFields()), 'uk');
                    $key .= ' UNIQUE (' . implode(', ', $this->getEncQuoted($xmldb_key->getFields())) . ')';
                }
                break;
            case XMLDB_KEY_FOREIGN:
            case XMLDB_KEY_FOREIGN_UNIQUE:
                if ($this->foreign_keys) {
                    $key = $this->getNameForObject($xmldb_table->getName(), implode(', ', $xmldb_key->getFields()), 'fk');
                    $key .= ' FOREIGN KEY (' . implode(', ', $this->getEncQuoted($xmldb_key->getFields())) . ')';
                    $key .= ' REFERENCES ' . $this->getEncQuoted($this->prefix . $xmldb_key->getRefTable());
                    $key .= ' (' . implode(', ', $this->getEncQuoted($xmldb_key->getRefFields())) . ')';
                }
                break;
        }

        return $key;
    }
public function getKeySQL ( $ xmldb_table , $ xmldb_key ) { $ key = '' ; switch ( $ xmldb_key -> getType ( ) ) { case XMLDB_KEY_PRIMARY : if ( $ this -> primary_keys ) { if ( $ this -> primary_key_name !== null ) { $ key = $ this -> getEncQuoted ( $ this -> primary_key_name ) ; } else { $ key = $ this -> getNameForObject ( $ xmldb_table -> getName ( ) , implode ( ', ' , $ xmldb_key -> getFields ( ) ) , 'pk' ) ; } $ key .= ' PRIMARY KEY (' . implode ( ', ' , $ this -> getEncQuoted ( $ xmldb_key -> getFields ( ) ) ) . ')' ; } break ; case XMLDB_KEY_UNIQUE : if ( $ this -> unique_keys ) { $ key = $ this -> getNameForObject ( $ xmldb_table -> getName ( ) , implode ( ', ' , $ xmldb_key -> getFields ( ) ) , 'uk' ) ; $ key .= ' UNIQUE (' . implode ( ', ' , $ this -> getEncQuoted ( $ xmldb_key -> getFields ( ) ) ) . ')' ; } break ; case XMLDB_KEY_FOREIGN : case XMLDB_KEY_FOREIGN_UNIQUE : if ( $ this -> foreign_keys ) { $ key = $ this -> getNameForObject ( $ xmldb_table -> getName ( ) , implode ( ', ' , $ xmldb_key -> getFields ( ) ) , 'fk' ) ; $ key .= ' FOREIGN KEY (' . implode ( ', ' , $ this -> getEncQuoted ( $ xmldb_key -> getFields ( ) ) ) . ')' ; $ key .= ' REFERENCES ' . $ this -> getEncQuoted ( $ this -> prefix . $ xmldb_key -> getRefTable ( ) ) ; $ key .= ' (' . implode ( ', ' , $ this -> getEncQuoted ( $ xmldb_key -> getRefFields ( ) ) ) . ')' ; } break ; } return $ key ; }
Given one correct xmldb_key, returns its specs.

@param xmldb_table $xmldb_table The table related to $xmldb_key.
@param xmldb_key $xmldb_key The xmldb_key's specifications requested.
@return string SQL statement about the xmldb_key.
Given one correct xmldb_key returns its specs .