Inpsyde\MultilingualPress\Database\Table::keys_sql PHP Method

keys_sql() public method

Returns the SQL string for all (unique) keys.
Since: 3.0.0
public keys_sql ( ) : string
return string The SQL string for all (unique) keys.
    public function keys_sql();

Usage Example

 /**
  * Returns the according SQL string for the keys of the given table.
  *
  * @param Table $table Table object.
  *
  * @return string The SQL string for the keys of the given table.
  */
 private function get_keys(Table $table)
 {
     $keys = '';
     $primary_key = $table->primary_key();
     if ($primary_key) {
         // Due to dbDelta: two spaces after PRIMARY KEY!
         $keys .= ",\n\tPRIMARY KEY  ({$primary_key})";
     }
     $keys_sql = $table->keys_sql();
     if ($keys_sql) {
         $keys .= ",\n\t{$keys_sql}";
     }
     return "{$keys}\n";
 }