class Sql (View source)

Set of functions for the SQL executor

Methods

__construct(DatabaseInterface $dbi, Relation $relation, RelationCleanup $relationCleanup, Operations $operations, Transformations $transformations, Template $template)

No description

string
getHtmlForRelationalColumnDropdown(string $db, string $table, string $column, string $currentValue)

Get the HTML for relational column dropdown During grid edit, if we have a relational field, returns the html for the dropdown

string
getFullValuesForSetColumn(string $db, string $table, string $column, string $whereClause)

Get value of a column for a specific row (marked by $whereClause)

array|null
getValuesForColumn(string $db, string $table, string $column)

Get all the values for a enum column or set column in a table

static bool
isJustBrowsing(array $analyzedSqlResults, bool|null $findRealEnd)

Function to check whether this query is for just browsing

bool
hasNoRightsToDropDatabase(array $analyzedSqlResults, bool $allowUserDropDatabase, bool $isSuperUser)

Function to check whether the user has rights to drop the database

bool|Message
setColumnProperty(Table $table, string $requestIndex)

Function to set a column property

mixed
findRealEndOfRows(string $db, string $table)

Function to find the real end of rows

string
getDefaultSqlQueryForBrowse(string $db, string $table)

Function to get the default sql query for browsing page

void
storeTheQueryAsBookmark(string $db, string $bookmarkUser, string $sqlQueryForBookmark, string $bookmarkLabel, bool $bookmarkReplace)

Function to store the query as a bookmark

string
executeQueryAndSendQueryResponse(array|null $analyzedSqlResults, bool $isGotoFile, string $db, string|null $table, bool|null $findRealEnd, string|null $sqlQueryForBookmark, array|null $extraData, string|null $messageToShow, array|null $sqlData, string $goto, string|null $dispQuery, Message|string|null $dispMessage, string $sqlQuery, string|null $completeQuery)

Function to execute the query and send the response

string
executeQueryAndGetQueryResponse(array $analyzedSqlResults, bool $isGotoFile, string $db, string|null $table, bool|null $findRealEnd, string|null $sqlQueryForBookmark, array|null $extraData, string|null $messageToShow, array|null $sqlData, string $goto, string|null $dispQuery, Message|string|null $dispMessage, string $sqlQuery, string|null $completeQuery)

Function to execute the query and send the response

int
calculatePosForLastPage(string $db, string $table, int|null $pos)

Function to calculate new pos if pos is higher than number of rows of displayed table

Details

__construct(DatabaseInterface $dbi, Relation $relation, RelationCleanup $relationCleanup, Operations $operations, Transformations $transformations, Template $template)

No description

Parameters

DatabaseInterface $dbi
Relation $relation
RelationCleanup $relationCleanup
Operations $operations
Transformations $transformations
Template $template

string getHtmlForRelationalColumnDropdown(string $db, string $table, string $column, string $currentValue)

Get the HTML for relational column dropdown During grid edit, if we have a relational field, returns the html for the dropdown

Parameters

string $db

current database

string $table

current table

string $column

current column

string $currentValue

current selected value

Return Value

string

html for the dropdown

string getFullValuesForSetColumn(string $db, string $table, string $column, string $whereClause)

Get value of a column for a specific row (marked by $whereClause)

Parameters

string $db
string $table
string $column
string $whereClause

Return Value

string

array|null getValuesForColumn(string $db, string $table, string $column)

Get all the values for a enum column or set column in a table

Parameters

string $db

current database

string $table

current table

string $column

current column

Return Value

array|null

array containing the value list for the column, null on failure

static bool isJustBrowsing(array $analyzedSqlResults, bool|null $findRealEnd)

Function to check whether this query is for just browsing

Parameters

array $analyzedSqlResults

the analyzed query and other variables set after analyzing the query

bool|null $findRealEnd

whether the real end should be found

Return Value

bool

bool hasNoRightsToDropDatabase(array $analyzedSqlResults, bool $allowUserDropDatabase, bool $isSuperUser)

Function to check whether the user has rights to drop the database

Parameters

array $analyzedSqlResults

the analyzed query and other variables set after analyzing the query

bool $allowUserDropDatabase

whether the user is allowed to drop db

bool $isSuperUser

whether this user is a superuser

Return Value

bool

bool|Message setColumnProperty(Table $table, string $requestIndex)

Function to set a column property

Parameters

Table $table

Table instance

string $requestIndex

col_order|col_visib

Return Value

bool|Message

mixed findRealEndOfRows(string $db, string $table)

Function to find the real end of rows

Parameters

string $db

the current database

string $table

the current table

Return Value

mixed

the number of rows if "retain" param is true, otherwise true

string getDefaultSqlQueryForBrowse(string $db, string $table)

Function to get the default sql query for browsing page

Parameters

string $db

the current database

string $table

the current table

Return Value

string

the default $sql_query for browse page

void storeTheQueryAsBookmark(string $db, string $bookmarkUser, string $sqlQueryForBookmark, string $bookmarkLabel, bool $bookmarkReplace)

Function to store the query as a bookmark

Parameters

string $db

the current database

string $bookmarkUser

the bookmarking user

string $sqlQueryForBookmark

the query to be stored in bookmark

string $bookmarkLabel

bookmark label

bool $bookmarkReplace

whether to replace existing bookmarks

Return Value

void

string executeQueryAndSendQueryResponse(array|null $analyzedSqlResults, bool $isGotoFile, string $db, string|null $table, bool|null $findRealEnd, string|null $sqlQueryForBookmark, array|null $extraData, string|null $messageToShow, array|null $sqlData, string $goto, string|null $dispQuery, Message|string|null $dispMessage, string $sqlQuery, string|null $completeQuery)

Function to execute the query and send the response

Parameters

array|null $analyzedSqlResults

analysed sql results

bool $isGotoFile

whether goto file or not

string $db

current database

string|null $table

current table

bool|null $findRealEnd

whether to find real end or not

string|null $sqlQueryForBookmark

the sql query to be stored as bookmark

array|null $extraData

extra data

string|null $messageToShow

message to show

array|null $sqlData

sql data

string $goto

goto page url

string|null $dispQuery

display query

Message|string|null $dispMessage

display message

string $sqlQuery

sql query

string|null $completeQuery

complete query

Return Value

string

string executeQueryAndGetQueryResponse(array $analyzedSqlResults, bool $isGotoFile, string $db, string|null $table, bool|null $findRealEnd, string|null $sqlQueryForBookmark, array|null $extraData, string|null $messageToShow, array|null $sqlData, string $goto, string|null $dispQuery, Message|string|null $dispMessage, string $sqlQuery, string|null $completeQuery)

Function to execute the query and send the response

Parameters

array $analyzedSqlResults

analysed sql results

bool $isGotoFile

whether goto file or not

string $db

current database

string|null $table

current table

bool|null $findRealEnd

whether to find real end or not

string|null $sqlQueryForBookmark

the sql query to be stored as bookmark

array|null $extraData

extra data

string|null $messageToShow

message to show

array|null $sqlData

sql data

string $goto

goto page url

string|null $dispQuery

display query

Message|string|null $dispMessage

display message

string $sqlQuery

sql query

string|null $completeQuery

complete query

Return Value

string

html

int calculatePosForLastPage(string $db, string $table, int|null $pos)

Function to calculate new pos if pos is higher than number of rows of displayed table

Parameters

string $db

Database name

string $table

Table name

int|null $pos

Initial position

Return Value

int

Number of pos to display last page