schema() public méthode

Returns the table schema.
Since: 3.0.0
public schema ( ) : string[]
Résultat string[] An array with fields as keys and the according SQL definitions as values.
 /**
  * Returns an array with column names as keys and the individual printf conversion specification as value.
  *
  * There are a lot more conversion specifications, but we don't need more than telling a string from an int.
  *
  * @param Table $table Table object.
  *
  * @return string[] The array with column names as keys and the individual printf conversion specification as value.
  */
 private function extract_field_specifications_from_table(Table $table)
 {
     $numeric_types = implode('|', ['BIT', 'DECIMAL', 'DOUBLE', 'FLOAT', 'INT', 'NUMERIC', 'REAL']);
     $schema = $table->schema();
     return array_combine(array_keys($schema), array_map(function ($definition) use($numeric_types) {
         return preg_match('/^\\s*[A-Z]*(' . $numeric_types . ')/', $definition) ? '%d' : '%s';
     }, $schema));
 }
 /**
  * Inserts the according default content into the given table.
  *
  * @param Table $table Table object.
  *
  * @return void
  */
 private function insert_default_content(Table $table)
 {
     $table_name = $table->name();
     // Bail if the table is not empty.
     if ($this->db->query("SELECT 1 FROM {$table_name} LIMIT 1")) {
         return;
     }
     $default_content = $table->default_content_sql();
     if (empty($default_content)) {
         return;
     }
     $columns = array_keys($table->schema());
     $columns = array_diff($columns, $table->columns_without_default_content());
     $columns = implode(',', $columns);
     $this->db->query("INSERT INTO {$table_name} ({$columns}) VALUES {$default_content}");
 }