namespace \webfiori\database\mssql
class MSSQLTable
Class Methods Summary
Class Methods Details
Parameters:
- string $name The name of the table. If empty string is given, the value 'new_table' will be used as default.
Parameters:
- array $colsArr An associative array. The keys will act as column key in the table. The value of the key can be an object of type 'MSSQLColumn' or be an associative array of column options. The available options are:
- name: The name of the column in the database. If not provided, the name of the key will be used but with every '-' replaced by '_'.
- datatype: The datatype of the column. If not provided, 'varchar' will be used. Note that the value 'type' can be used as an alias to this index.
- size: Size of the column (if datatype does support size). If not provided, 1 will be used.
- default: A default value for the column if its value is not present in case of insert.
- is-null: A boolean. If the column allows null values, this should be set to true. Default is false.
- is-primary: A boolean. It must be set to true if the column represents a primary key. Note that the column will be set as unique once its set as a primary.
- is-unique: A boolean. If set to true, a unique index will be created for the column.
- auto-update: A boolean. If the column datatype is 'datetime' or similar type and this parameter is set to true, the time of update will change automatically without having to change it manually.
- scale: Number of numbers to the left of the decimal point. Only supported for decimal datatype.
Parameters:
- string $name The name of the unique constraint. Must be non-empty string.