sqlite3DbTable
extends jDbTable
in package
Tags
Table of Contents
- $attributes : array<string|int, mixed>
- $columns : array<string|int, jDbColumn>
- $indexes : array<string|int, jDbIndex>
- $name : string
- $primaryKey : jDbPrimaryKey
- $references : array<string|int, jDbReference>
- $schema : jDbSchema
- $uniqueKeys : array<string|int, jDbUniqueKey>
- __construct() : mixed
- addColumn() : bool
- add a column.
- addIndex() : mixed
- addReference() : mixed
- addUniqueKey() : mixed
- alterColumn() : bool
- change a column definition. If the column does not exist, it is created.
- alterIndex() : mixed
- alterReference() : mixed
- alterUniqueKey() : mixed
- dropColumn() : mixed
- dropIndex() : mixed
- dropPrimaryKey() : mixed
- dropReference() : mixed
- dropUniqueKey() : mixed
- getColumn() : null|jDbColumn
- getColumns() : array<string|int, jDbColumn>
- getIndex() : null|jDbIndex
- getIndexes() : array<string|int, jDbIndex>
- getName() : mixed
- getPrimaryKey() : false|jDbPrimaryKey
- getReference() : null|jDbReference
- getReferences() : array<string|int, jDbReference>
- getUniqueKey() : null|jDbUniqueKey
- getUniqueKeys() : array<string|int, jDbUniqueKey>
- setPrimaryKey() : mixed
- _addColumn() : mixed
- _alterColumn() : mixed
- _createConstraint() : mixed
- _createIndex() : mixed
- _dropColumn() : mixed
- _dropConstraint() : mixed
- _dropIndex() : mixed
- _getSqlColumnsList() : mixed
- _loadColumns() : mixed
- _loadIndexesAndKeys() : mixed
- _loadReferences() : mixed
- _loadTableDefinition() : mixed
- _replaceConstraint() : mixed
- _splitColumnsName() : mixed
- _updateColumnInConstraintsAndIndexes() : mixed
- In order to apply some changes, we need to update constraints and indexes in order to create a new table with no wrong columns.
Properties
$attributes
public
array<string|int, mixed>
$attributes
= array()
Tags
$columns
protected
array<string|int, jDbColumn>
$columns
null means "columns are not loaded"
Tags
$indexes
protected
array<string|int, jDbIndex>
$indexes
list of indexes. null means "indexes are not loaded"
Tags
$name
protected
string
$name
the name of the table
Tags
$primaryKey
protected
jDbPrimaryKey
$primaryKey
the primary key. null means "primary key is not loaded". false means : no primary key
Tags
$references
protected
array<string|int, jDbReference>
$references
list of references. null means "references are not loaded"
Tags
$schema
protected
jDbSchema
$schema
the schema which holds the table
Tags
$uniqueKeys
protected
array<string|int, jDbUniqueKey>
$uniqueKeys
list unique keys. null means "unique key are not loaded"
Tags
Methods
__construct()
public
__construct(string $name, jDbSchema $schema) : mixed
Parameters
- $name : string
-
the table name
- $schema : jDbSchema
Tags
Return values
mixed —addColumn()
add a column.
public
addColumn(jDbColumn $column) : bool
Parameters
- $column : jDbColumn
Tags
Return values
bool —true if the column is added, false if not (already there)
addIndex()
public
addIndex(jDbIndex $index) : mixed
Parameters
- $index : jDbIndex
Tags
Return values
mixed —addReference()
public
addReference(jDbReference $reference) : mixed
Parameters
- $reference : jDbReference
Tags
Return values
mixed —addUniqueKey()
public
addUniqueKey(jDbUniqueKey $key) : mixed
Parameters
- $key : jDbUniqueKey
Tags
Return values
mixed —alterColumn()
change a column definition. If the column does not exist, it is created.
public
alterColumn(jDbColumn $column[, string $oldName = '' ][, bool $doNotCreate = false ]) : bool
Parameters
- $column : jDbColumn
-
the colum with its new properties
- $oldName : string = ''
-
the name of the column to change (if the name is changed)
- $doNotCreate : bool = false
-
true if the column shoul dnot be created when it does not exist
Tags
Return values
bool —true if changed/created
alterIndex()
public
alterIndex(jDbIndex $index) : mixed
Parameters
- $index : jDbIndex
Tags
Return values
mixed —alterReference()
public
alterReference(jDbReference $reference) : mixed
Parameters
- $reference : jDbReference
Tags
Return values
mixed —alterUniqueKey()
public
alterUniqueKey(jDbUniqueKey $key) : mixed
Parameters
- $key : jDbUniqueKey
Tags
Return values
mixed —dropColumn()
public
dropColumn(mixed $name) : mixed
Parameters
- $name : mixed
Tags
Return values
mixed —dropIndex()
public
dropIndex(mixed $indexName) : mixed
Parameters
- $indexName : mixed
Tags
Return values
mixed —dropPrimaryKey()
public
dropPrimaryKey() : mixed
Tags
Return values
mixed —dropReference()
public
dropReference(mixed $refName) : mixed
Parameters
- $refName : mixed
Tags
Return values
mixed —dropUniqueKey()
public
dropUniqueKey(mixed $indexName) : mixed
Parameters
- $indexName : mixed
Tags
Return values
mixed —getColumn()
public
getColumn(string $name[, bool $forChange = false ]) : null|jDbColumn
Parameters
- $name : string
- $forChange : bool = false
Tags
Return values
null|jDbColumn —getColumns()
public
getColumns() : array<string|int, jDbColumn>
Tags
Return values
array<string|int, jDbColumn> —getIndex()
public
getIndex(mixed $name) : null|jDbIndex
Parameters
- $name : mixed
Tags
Return values
null|jDbIndex —getIndexes()
public
getIndexes() : array<string|int, jDbIndex>
Tags
Return values
array<string|int, jDbIndex> —getName()
public
getName() : mixed
Tags
Return values
mixed —getPrimaryKey()
public
getPrimaryKey() : false|jDbPrimaryKey
Tags
Return values
false|jDbPrimaryKey —false if there is no primary key
getReference()
public
getReference(mixed $refName) : null|jDbReference
Parameters
- $refName : mixed
Tags
Return values
null|jDbReference —getReferences()
public
getReferences() : array<string|int, jDbReference>
Tags
Return values
array<string|int, jDbReference> —getUniqueKey()
public
getUniqueKey(mixed $name) : null|jDbUniqueKey
Parameters
- $name : mixed
Tags
Return values
null|jDbUniqueKey —getUniqueKeys()
public
getUniqueKeys() : array<string|int, jDbUniqueKey>
Tags
Return values
array<string|int, jDbUniqueKey> —setPrimaryKey()
public
setPrimaryKey(jDbPrimaryKey $key) : mixed
Parameters
- $key : jDbPrimaryKey
Tags
Return values
mixed —_addColumn()
protected
_addColumn(jDbColumn $new) : mixed
Parameters
- $new : jDbColumn
Tags
Return values
mixed —_alterColumn()
protected
_alterColumn(jDbColumn $oldCol, jDbColumn $newCol) : mixed
Parameters
Tags
Return values
mixed —_createConstraint()
protected
_createConstraint(jDbConstraint $constraint) : mixed
Parameters
- $constraint : jDbConstraint
Tags
Return values
mixed —_createIndex()
protected
_createIndex(jDbIndex $index) : mixed
Parameters
- $index : jDbIndex
Tags
Return values
mixed —_dropColumn()
protected
_dropColumn(jDbColumn $oldCol) : mixed
Parameters
- $oldCol : jDbColumn
Tags
Return values
mixed —_dropConstraint()
protected
_dropConstraint(jDbConstraint $constraint) : mixed
Parameters
- $constraint : jDbConstraint
Tags
Return values
mixed —_dropIndex()
protected
_dropIndex(jDbIndex $index) : mixed
Parameters
- $index : jDbIndex
Tags
Return values
mixed —_getSqlColumnsList()
protected
_getSqlColumnsList(jDbConnection $conn, array<string|int, mixed> &$columns) : mixed
Parameters
- $conn : jDbConnection
- $columns : array<string|int, mixed>
Tags
Return values
mixed —_loadColumns()
protected
_loadColumns() : mixed
Tags
Return values
mixed —_loadIndexesAndKeys()
protected
_loadIndexesAndKeys() : mixed
Tags
Return values
mixed —_loadReferences()
protected
_loadReferences() : mixed
Tags
Return values
mixed —_loadTableDefinition()
protected
_loadTableDefinition() : mixed
Tags
Return values
mixed —_replaceConstraint()
protected
_replaceConstraint(jDbConstraint $oldConstraint, jDbConstraint $newConstraint) : mixed
Parameters
- $oldConstraint : jDbConstraint
- $newConstraint : jDbConstraint
Tags
Return values
mixed —_splitColumnsName()
protected
_splitColumnsName(mixed $sqlList) : mixed
Parameters
- $sqlList : mixed
Tags
Return values
mixed —_updateColumnInConstraintsAndIndexes()
In order to apply some changes, we need to update constraints and indexes in order to create a new table with no wrong columns.
protected
_updateColumnInConstraintsAndIndexes( $colName, &$newIndexes, &$newReferences, &$newPrimaryKey, &$newUniqueKeys, int $mode[, null|mixed $newColName = null ]) : mixed
Parameters
- $colName :
- $newIndexes :
- $newReferences :
- $newPrimaryKey :
- $newUniqueKeys :
- $mode : int
-
1:rename, 2:drop
- $newColName : null|mixed = null