Solar_Sql_Adapter::createTable()

public string Solar_Sql_Adapter::createTable ( string $table , array $cols )

Creates a portable table.

Parameters

  • (string) $table: The name of the table to create.

  • (array) $cols: Array of columns to create.

Returns

  • (string) An SQL string.

Description

Creates a portable table.

The $cols parameter should be in this format ...

<?php
$cols = array(
  'col_1' => array(
    'type'    => (string) bool, char, int, ...
    'size'    => (int) total length for char|varchar|numeric
    'scope'   => (int) decimal places for numeric
    'default' => (bool) the default value, if any
    'require' => (bool) is the value required to be NOT NULL?
    'primary' => (bool) is this a primary key column?
    'autoinc' => (bool) is this an auto-increment column?
  ),
  'col_2' => array(...)
);

For available field types, see Solar_Sql_Adapter::$_native.



Local