PostgresqlQueries
in package
implements
DataBaseQueries
Class that gathers all the needed SQL sentences by the database engine
Table of Contents
Interfaces
- DataBaseQueries
- Interface to manage the SQL statements needed by the database
Methods
- sql2Int() : string
- Returns the needed SQL to convert a column to integer
- sqlAddConstraint() : string
- Returns the SQL needed to add a constraint to a table
- sqlAddIndex() : string
- Returns the SQL needed to add an index to a table
- sqlAlterAddColumn() : string
- Returns the SQL needed to add a column to a table
- sqlAlterColumnDefault() : string
- Returns the needed SQL to alter a column default constraint
- sqlAlterColumnNull() : string
- SQL statement to alter a null constraint in a table column
- sqlAlterModifyColumn() : string
- Returns the SQL needed to alter a column in a table
- sqlColumns() : string
- Returns the SQL needed to get the list of columns in a table
- sqlConstraints() : string
- Returns the SQL needed to get the list of constraints in a table
- sqlConstraintsExtended() : string
- Returns the SQL needed to get the list of advanced constraints in a table
- sqlCreateTable() : string
- Returns the SQL needed to create a table with the given structure
- sqlDropConstraint() : string
- Returns the SQL needed to remove a constraint from a table
- sqlDropIndex() : string
- sqlDropTable() : string
- SQL statement to drop a given table
- sqlIndexes() : string
- Returns the SQL needed to get the list of indexes in a table
- sqlLastValue() : string
- Returns the SQL to get last ID assigned when performing an INSERT in the database
- sqlRenameColumn() : string
- SQL statement to rename a column.
- sqlTableConstraints() : string
- Generates the needed SQL to establish the given constraints
- sqlTableIndexes() : string
- Generates the needed SQL to create the indexes in a table
Methods
sql2Int()
Returns the needed SQL to convert a column to integer
public
sql2Int(string $colName) : string
Parameters
- $colName : string
Return values
stringsqlAddConstraint()
Returns the SQL needed to add a constraint to a table
public
sqlAddConstraint(string $tableName, string $constraintName, string $sql) : string
Parameters
- $tableName : string
- $constraintName : string
- $sql : string
Return values
stringsqlAddIndex()
Returns the SQL needed to add an index to a table
public
sqlAddIndex(string $tableName, string $indexName, string $columns) : string
Parameters
- $tableName : string
- $indexName : string
- $columns : string
Return values
stringsqlAlterAddColumn()
Returns the SQL needed to add a column to a table
public
sqlAlterAddColumn(string $tableName, array<string|int, mixed> $colData) : string
Parameters
- $tableName : string
- $colData : array<string|int, mixed>
Return values
stringsqlAlterColumnDefault()
Returns the needed SQL to alter a column default constraint
public
sqlAlterColumnDefault(string $tableName, array<string|int, mixed> $colData) : string
Parameters
- $tableName : string
- $colData : array<string|int, mixed>
Return values
stringsqlAlterColumnNull()
SQL statement to alter a null constraint in a table column
public
sqlAlterColumnNull(string $tableName, array<string|int, mixed> $colData) : string
Parameters
- $tableName : string
- $colData : array<string|int, mixed>
Return values
stringsqlAlterModifyColumn()
Returns the SQL needed to alter a column in a table
public
sqlAlterModifyColumn(string $tableName, array<string|int, mixed> $colData) : string
Parameters
- $tableName : string
- $colData : array<string|int, mixed>
Return values
stringsqlColumns()
Returns the SQL needed to get the list of columns in a table
public
sqlColumns(string $tableName) : string
Parameters
- $tableName : string
Return values
stringsqlConstraints()
Returns the SQL needed to get the list of constraints in a table
public
sqlConstraints(string $tableName) : string
Parameters
- $tableName : string
Return values
stringsqlConstraintsExtended()
Returns the SQL needed to get the list of advanced constraints in a table
public
sqlConstraintsExtended(string $tableName) : string
Parameters
- $tableName : string
Return values
stringsqlCreateTable()
Returns the SQL needed to create a table with the given structure
public
sqlCreateTable(string $tableName, array<string|int, mixed> $columns, array<string|int, mixed> $constraints, array<string|int, mixed> $indexes) : string
Parameters
- $tableName : string
- $columns : array<string|int, mixed>
- $constraints : array<string|int, mixed>
- $indexes : array<string|int, mixed>
Return values
stringsqlDropConstraint()
Returns the SQL needed to remove a constraint from a table
public
sqlDropConstraint(string $tableName, array<string|int, mixed> $colData) : string
Parameters
- $tableName : string
- $colData : array<string|int, mixed>
Return values
stringsqlDropIndex()
public
sqlDropIndex(string $tableName, array<string|int, mixed> $colData) : string
Parameters
- $tableName : string
- $colData : array<string|int, mixed>
Return values
stringsqlDropTable()
SQL statement to drop a given table
public
sqlDropTable(string $tableName) : string
Parameters
- $tableName : string
Return values
stringsqlIndexes()
Returns the SQL needed to get the list of indexes in a table
public
sqlIndexes(string $tableName) : string
Parameters
- $tableName : string
Return values
stringsqlLastValue()
Returns the SQL to get last ID assigned when performing an INSERT in the database
public
sqlLastValue() : string
Return values
stringsqlRenameColumn()
SQL statement to rename a column.
public
sqlRenameColumn(string $tableName, string $old_column, string $new_column) : string
Parameters
- $tableName : string
- $old_column : string
- $new_column : string
Return values
stringsqlTableConstraints()
Generates the needed SQL to establish the given constraints
public
sqlTableConstraints(array<string|int, mixed> $xmlCons) : string
Parameters
- $xmlCons : array<string|int, mixed>
Return values
stringsqlTableIndexes()
Generates the needed SQL to create the indexes in a table
private
sqlTableIndexes(string $tableName, array<string|int, mixed> $xmlIndexes) : string
Parameters
- $tableName : string
- $xmlIndexes : array<string|int, mixed>