Adding a new Column
reimplementation of the default function as postgres does NOT allow to set the default in the same statement
array
AddColumnSQL
(string $tabname, string $flds)
-
string
$tabname: table-name
-
string
$flds: column-names and types for the changed columns
Change the definition of one column
Postgres can't do that on it's own, you need to supply the complete defintion of the new table, to allow, recreating the table and copying the content over to the new table
array
AlterColumnSQL
(string $tabname, string $flds, [string $tableflds = ''], [array/ $tableoptions = ''])
-
string
$tabname: table-name
-
string
$flds: column-name and type for the changed column
-
string
$tableflds: complete defintion of the new table, eg. for postgres, default ''
-
array/
$tableoptions: options for the new table see CreateTableSQL, default ''
Drop one column
Postgres < 7.3 can't do that on it's own, you need to supply the complete defintion of the new table, to allow, recreating the table and copying the content over to the new table
array
DropColumnSQL
(string $tabname, string $flds, [string $tableflds = ''], [array/ $tableoptions = ''])
-
string
$tabname: table-name
-
string
$flds: column-name and type for the changed column
-
string
$tableflds: complete defintion of the new table, eg. for postgres, default ''
-
array/
$tableoptions: options for the new table see CreateTableSQL, default ''
void
DropIndexSQL
( $idxname, [ $tabname = NULL])
void
DropTableSQL
( $tabname)
void
MetaType
( $t, [ $len = -1], [ $fieldobj = false])
void
RenameTableSQL
( $tabname, $newname)
void
_CreateSuffix
( $fname, &$ftype, $fnotnull, $fdefault, $fautoinc, $fconstraint)
-
$fname
-
&$ftype
-
$fnotnull
-
$fdefault
-
$fautoinc
-
$fconstraint
void
_DropAutoIncrement
( $tabname)
void
_GetSize
( $ftype, $ty, $fsize, $fprec)
void
_IndexSQL
( $idxname, $tabname, $flds, $idxoptions)
-
$idxname
-
$tabname
-
$flds
-
$idxoptions
Save the content into a temp. table, drop and recreate the original table and copy the content back in
We also take care to set the values of the sequenz and recreate the indexes. All this is done in a transaction, to not loose the content of the table, if something went wrong!
array
_recreate_copy_table
(string $tabname, string $dropflds, string $tableflds, [array/string $tableoptions = ''])
-
string
$tabname: table-name
-
string
$dropflds: column-names to drop
-
string
$tableflds: complete defintion of the new table, eg. for postgres
-
array/string
$tableoptions: options for the new table see CreateTableSQL, default ''