class Generator (View source)

Handles generating SQL queries

Methods

static string
getTableNameCondition(string $escapedTabletable, bool $tblIsGroup)

returns a segment of the SQL WHERE clause regarding table name

static string
getTableNameConditionForMultiple(array $escapedTables)

returns a segment of the SQL WHERE clause regarding table name

static string
getTableTypeCondition(string|null $tableType)

returns a segment of the SQL WHERE clause regarding table type

static string
getSqlForTablesFull(string $thisDatabases, string $sqlWhereTable)

returns the beginning of the SQL statement to fetch the list of tables

static string
getTableIndexesSql(string $database, string $table, string $where = '')

Returns SQL for fetching information on table indexes (SHOW INDEXES)

static string
getColumnsSql(string $database, string $table, string|null $quotedColumn = null, bool $full = false)

Returns SQL query for fetching columns for a table

static string
getInformationSchemaRoutinesRequest(string $quotedDbName, string|null $routineType, string|null $quotedRoutineName)

No description

static string
getInformationSchemaEventsRequest(string $escapedDb, string|null $escapedEventName)

No description

static string
getInformationSchemaTriggersRequest(string $escapedDb, string|null $escapedTable)

No description

static string
getCreateTrigger(Trigger $newTrigger, string $delimiter)

No description

static string
getInformationSchemaDataForCreateRequest(string $user, string $host)

No description

static string
getInformationSchemaDataForGranteeRequest(string $user, string $host)

No description

static string
getInformationSchemaForeignKeyConstraintsRequest(string $escapedDatabase, string $tablesListForQueryCsv)

No description

static string
getInformationSchemaDatabasesFullRequest(bool $forceStats, string $sqlWhereSchema, string $sortBy, string $sortOrder, string $limit)

No description

static string
getInformationSchemaColumnsFullRequest(string|null $escapedDatabase, string|null $escapedTable, string|null $escapedColumn)

No description

static array
getInformationSchemaColumns(string|null $database, string|null $table, string|null $column)

No description

static string
getSqlQueryForIndexRename(string $dbName, string $tableName, string $oldIndexName, string $newIndexName)

Function to get sql query for renaming the index using SQL RENAME INDEX Syntax

static string
getQueryForReorderingTable(string $table, string $orderField, string|null $order)

Function to get sql query to re-order the table

static string
getQueryForPartitioningTable(string $table, string $partitionOperation, array $partitionNames)

Function to get sql query to partition the table

static string
getAddIndexSql(string $indexType, string $table, array $selectedColumns)

No description

static string
getAddPrimaryKeyStatement(string $table, string $column, bool $hasDropPrimaryKey)

No description

static string
buildInsertSqlQuery(string $table, bool $isInsertIgnore, array $queryFields, array $valueSets)

Builds the SQL insert query

Details

static string getTableNameCondition(string $escapedTabletable, bool $tblIsGroup)

returns a segment of the SQL WHERE clause regarding table name

Parameters

string $escapedTabletable
bool $tblIsGroup

$table is a table group

Return Value

string

a segment of the WHERE clause

static string getTableNameConditionForMultiple(array $escapedTables)

returns a segment of the SQL WHERE clause regarding table name

Parameters

array $escapedTables tables

Return Value

string

a segment of the WHERE clause

static string getTableTypeCondition(string|null $tableType)

returns a segment of the SQL WHERE clause regarding table type

Parameters

string|null $tableType

whether table or view

Return Value

string

a segment of the WHERE clause

static string getSqlForTablesFull(string $thisDatabases, string $sqlWhereTable)

returns the beginning of the SQL statement to fetch the list of tables

Parameters

string $thisDatabases

databases to list

string $sqlWhereTable

additional condition

Return Value

string

the SQL statement

static string getTableIndexesSql(string $database, string $table, string $where = '')

Returns SQL for fetching information on table indexes (SHOW INDEXES)

Parameters

string $database

name of database

string $table

name of the table whose indexes are to be retrieved

string $where

additional conditions for WHERE

Return Value

string

SQL for getting indexes

static string getColumnsSql(string $database, string $table, string|null $quotedColumn = null, bool $full = false)

Returns SQL query for fetching columns for a table

Parameters

string $database

name of database

string $table

name of table to retrieve columns from

string|null $quotedColumn

name of column, null to show all columns

bool $full

whether to return full info or only column names

Return Value

string

static string getInformationSchemaRoutinesRequest(string $quotedDbName, string|null $routineType, string|null $quotedRoutineName)

No description

Parameters

string $quotedDbName
string|null $routineType
string|null $quotedRoutineName

Return Value

string

static string getInformationSchemaEventsRequest(string $escapedDb, string|null $escapedEventName)

No description

Parameters

string $escapedDb
string|null $escapedEventName

Return Value

string

static string getInformationSchemaTriggersRequest(string $escapedDb, string|null $escapedTable)

No description

Parameters

string $escapedDb
string|null $escapedTable

Return Value

string

static string getCreateTrigger(Trigger $newTrigger, string $delimiter)

No description

Parameters

Trigger $newTrigger
string $delimiter

Return Value

string

static string getInformationSchemaDataForCreateRequest(string $user, string $host)

No description

Parameters

string $user
string $host

Return Value

string

static string getInformationSchemaDataForGranteeRequest(string $user, string $host)

No description

Parameters

string $user
string $host

Return Value

string

static string getInformationSchemaForeignKeyConstraintsRequest(string $escapedDatabase, string $tablesListForQueryCsv)

No description

Parameters

string $escapedDatabase
string $tablesListForQueryCsv

Return Value

string

static string getInformationSchemaDatabasesFullRequest(bool $forceStats, string $sqlWhereSchema, string $sortBy, string $sortOrder, string $limit)

No description

Parameters

bool $forceStats
string $sqlWhereSchema
string $sortBy
string $sortOrder
string $limit

Return Value

string

static string getInformationSchemaColumnsFullRequest(string|null $escapedDatabase, string|null $escapedTable, string|null $escapedColumn)

No description

Parameters

string|null $escapedDatabase
string|null $escapedTable
string|null $escapedColumn

Return Value

string

static array getInformationSchemaColumns(string|null $database, string|null $table, string|null $column)

No description

Parameters

string|null $database
string|null $table
string|null $column

Return Value

array

static string getSqlQueryForIndexRename(string $dbName, string $tableName, string $oldIndexName, string $newIndexName)

Function to get sql query for renaming the index using SQL RENAME INDEX Syntax

Parameters

string $dbName
string $tableName
string $oldIndexName
string $newIndexName

Return Value

string

static string getQueryForReorderingTable(string $table, string $orderField, string|null $order)

Function to get sql query to re-order the table

Parameters

string $table
string $orderField
string|null $order

Return Value

string

static string getQueryForPartitioningTable(string $table, string $partitionOperation, array $partitionNames)

Function to get sql query to partition the table

Parameters

string $table
string $partitionOperation
array $partitionNames

Return Value

string

static string getAddIndexSql(string $indexType, string $table, array $selectedColumns)

No description

Parameters

string $indexType
string $table
array $selectedColumns

Return Value

string

static string getAddPrimaryKeyStatement(string $table, string $column, bool $hasDropPrimaryKey)

No description

Parameters

string $table
string $column
bool $hasDropPrimaryKey

Return Value

string

static string buildInsertSqlQuery(string $table, bool $isInsertIgnore, array $queryFields, array $valueSets)

Builds the SQL insert query

Parameters

string $table
bool $isInsertIgnore

$_POST['submit_type'] === 'insertignore'

array $queryFields

column names array

array $valueSets

array of query values

Return Value

string