Jelix 1.7.18

sqlite3DbTable extends jDbTable
in package

Tags
subpackage

db_driver

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()

$indexes

protected array<string|int, jDbIndex> $indexes

list of indexes. null means "indexes are not loaded"

$primaryKey

protected jDbPrimaryKey $primaryKey

the primary key. null means "primary key is not loaded". false means : no primary key

$references

protected array<string|int, jDbReference> $references

list of references. null means "references are not loaded"

Methods

__construct()

public __construct(string $name, jDbSchema $schema) : mixed
Parameters
$name : string

the table name

$schema : jDbSchema
Return values
mixed

addColumn()

add a column.

public addColumn(jDbColumn $column) : bool
Parameters
$column : jDbColumn
Return values
bool

true if the column is added, false if not (already there)

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

Return values
bool

true if changed/created

dropColumn()

public dropColumn(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

dropIndex()

public dropIndex(mixed $indexName) : mixed
Parameters
$indexName : mixed
Return values
mixed

dropPrimaryKey()

public dropPrimaryKey() : mixed
Return values
mixed

dropReference()

public dropReference(mixed $refName) : mixed
Parameters
$refName : mixed
Return values
mixed

dropUniqueKey()

public dropUniqueKey(mixed $indexName) : mixed
Parameters
$indexName : mixed
Return values
mixed

getColumn()

public getColumn(string $name[, bool $forChange = false ]) : null|jDbColumn
Parameters
$name : string
$forChange : bool = false
Return values
null|jDbColumn

_getSqlColumnsList()

protected _getSqlColumnsList(jDbConnection $conn, array<string|int, mixed> &$columns) : mixed
Parameters
$conn : jDbConnection
$columns : array<string|int, mixed>
Return values
mixed

_loadIndexesAndKeys()

protected _loadIndexesAndKeys() : mixed
Return values
mixed

_loadReferences()

protected _loadReferences() : mixed
Return values
mixed

_loadTableDefinition()

protected _loadTableDefinition() : mixed
Return values
mixed

_splitColumnsName()

protected _splitColumnsName(mixed $sqlList) : mixed
Parameters
$sqlList : mixed
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
Return values
mixed

Search results