namespace \webfiori\database\mysql
class MySQLColumn
Class Methods Summary
Class Methods Details
Parameters:
- string $name The name of the column as it appears in the database. It must be a string and its not empty. Default value is 'col'.
- string $datatype The type of column data. Default value is 'varchar'.
- int $size The size of the column. Used only in case of 'varachar', 'int' or decimal. If the given size is invalid, 1 will be used as default value.
Parameters:
- mixed $val The value that will be cleaned.
Parameters:
- array $options An associative array of options. The available options are:
- name: Required. The name of the column in the database. If not provided, no object will be created.
- datatype: The datatype of the column. If not provided, 'varchar' will be used. Equal option: 'type'.
- 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. Equal option: primary.
- auto-inc: A boolean. Only applicable if the column is a primary key. Set to true to auto-increment column value by 1 for every insert.
- 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 'timestamp' or 'datetime' 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.
- comment: A comment which can be used to describe the column.
- validator: A PHP function which can be used to validate user values before submitting the query to database.
Parameters:
- boolean $bool If true is passed, then the value of the column will be updated in case an update query is constructed.
Parameters:
- string $type A string that represents the datatype of the column.
Parameters:
- mixed $default The default value which will be set.
Sets the value of the property $isAutoInc. This attribute can be set only if the column is primary key and the datatype of the column is set to 'int'.
Parameters:
- boolean $bool true or false.
Parameters:
- boolean $bool true if the column is primary key. false if not.
Parameters:
- string $vNum MySQL version number (such as '5.5').
Parameters:
- MySQLTable|null $table The owner of the column. If null is given, The owner will be unset.
Parameters:
- int $val Number of numbers after the decimal point. It must be a positive number.
- Datatype of the column is not decimal, float or double.
- Size of the column is 0.
- Given scale value is greater than the size of the column.
Parameters:
- int $size The size to set.