FacturaScripts

MysqlQueries
in package
implements DataBaseQueries

Class that gathers all the needed SQL sentences by the database engine

Tags
author

Carlos García Gómez [email protected]

author

Jose Antonio Cuello Principal [email protected]

Interfaces, Classes, Traits and Enums

DataBaseQueries
Interface to manage the SQL statements needed by the database

Table of Contents

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
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
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
sqlTableConstraints()  : string
Generates the needed SQL to establish the given constraints
fixPostgresql()  : string
Removes PostgreSQL's problematic code
getConstraints()  : string
Returns a string with the columns constraints
getTypeAndConstraints()  : string
Generates the SQL with the field type and the DEFAULT and null constraints

Methods

sql2Int()

Returns the needed SQL to convert a column to integer

public sql2Int(string $colName) : string
Parameters
$colName : string
Return values
string

sqlAddConstraint()

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
string

sqlAlterAddColumn()

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
string

sqlAlterColumnDefault()

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
string

sqlAlterColumnNull()

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
string

sqlAlterModifyColumn()

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
string

sqlColumns()

Returns the SQL needed to get the list of columns in a table

public sqlColumns(string $tableName) : string
Parameters
$tableName : string
Return values
string

sqlConstraints()

Returns the SQL needed to get the list of constraints in a table

public sqlConstraints(string $tableName) : string
Parameters
$tableName : string
Return values
string

sqlConstraintsExtended()

Returns the SQL needed to get the list of advanced constraints in a table

public sqlConstraintsExtended(string $tableName) : string
Parameters
$tableName : string
Return values
string

sqlCreateTable()

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) : string
Parameters
$tableName : string
$columns : array<string|int, mixed>
$constraints : array<string|int, mixed>
Return values
string

sqlDropConstraint()

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
string

sqlDropTable()

SQL statement to drop a given table

public sqlDropTable(string $tableName) : string
Parameters
$tableName : string
Return values
string

sqlIndexes()

Returns the SQL needed to get the list of indexes in a table

public sqlIndexes(string $tableName) : string
Parameters
$tableName : string
Return values
string

sqlLastValue()

Returns the SQL to get last ID assigned when performing an INSERT in the database

public sqlLastValue() : string
Return values
string

sqlTableConstraints()

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
string

fixPostgresql()

Removes PostgreSQL's problematic code

private fixPostgresql(string $sql) : string
Parameters
$sql : string
Return values
string

getConstraints()

Returns a string with the columns constraints

private getConstraints(array<string|int, mixed> $colData) : string
Parameters
$colData : array<string|int, mixed>
Return values
string

getTypeAndConstraints()

Generates the SQL with the field type and the DEFAULT and null constraints

private getTypeAndConstraints(array<string|int, mixed> $colData) : string
Parameters
$colData : array<string|int, mixed>
Return values
string

Search results