void altertable ( array ('table' => $table, 'action' => $action, 'name' => $column, 'values' => $values [, 'after' => $afterColumn [, 'db' => $db]]) )
This function will alter a txtSQL-
$table's column defintions. It will only work with the specified column, which is
$column. The
$action can be either
insert- Inserts a new column, $column, and if specified, after the column $afterColumn
modify- Modifies an existing $column
drop- Drops an existing $column
rename col- Renames a $column. Expects array('name' => $newcolname) in the $values
rename table- Renames a $table. Expects array('name' => $newTableName) in the $values
addkey- Sets $column as the primary key ( must be integer and auto_increment ). Expects array('name' => $colName) in the $values
dropkey- Does opposite of 'addkey'
|
The
$values element is an array containing information about the column, it must be in the following format
array( [$colType => $value]... ) unless otherwise noted above
Important- To achieve the same results as this function before txtSQL 2.2.2 RC2, use the
execute() function
Note- For more information on data types, see the
data types section, or for more information the column types,
see the
column types section
Note- If
$tablename does not already exists, txtSQL will issue an error
Note- If no
$db is specified and no database is already selected, txtSQL will issue an error