class Sql (View source)

Set of functions for the SQL executor

Methods

__construct(DatabaseInterface $dbi, Relation $relation, RelationCleanup $relationCleanup, Transformations $transformations, Template $template, BookmarkRepository $bookmarkRepository, Config $config)

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 $columnName)

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

static bool
isJustBrowsing(StatementInfo $statementInfo, bool $findRealEnd = false)

Function to check whether this query is for just browsing

bool
hasNoRightsToDropDatabase(StatementInfo $statementInfo, bool $allowUserDropDatabase, bool $isSuperUser)

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

string
getDefaultSqlQueryForBrowse(string $db, string $table)

Function to get the default sql query for browsing page

void
storeTheQueryAsBookmark(BookmarkFeature|null $bookmarkFeature, string $db, string $bookmarkUser, string $sqlQueryForBookmark, string $bookmarkLabel, bool $bookmarkReplace)

Function to store the query as a bookmark

string
executeQueryAndSendQueryResponse(StatementInfo|null $statementInfo, bool $isGotoFile, string $db, string|null $table, string|null $sqlQueryForBookmark, 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(StatementInfo $statementInfo, bool $isGotoFile, string $db, string|null $table, string|null $sqlQueryForBookmark, 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, Transformations $transformations, Template $template, BookmarkRepository $bookmarkRepository, Config $config)

No description

Parameters

DatabaseInterface $dbi
Relation $relation
RelationCleanup $relationCleanup
Transformations $transformations
Template $template
BookmarkRepository $bookmarkRepository
Config $config

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 $columnName)

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

Parameters

string $db

current database

string $table

current table

string $columnName

current column

Return Value

array|null

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

static bool isJustBrowsing(StatementInfo $statementInfo, bool $findRealEnd = false)

Function to check whether this query is for just browsing

Parameters

StatementInfo $statementInfo
bool $findRealEnd

Return Value

bool

bool hasNoRightsToDropDatabase(StatementInfo $statementInfo, bool $allowUserDropDatabase, bool $isSuperUser)

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

Parameters

StatementInfo $statementInfo
bool $allowUserDropDatabase

whether the user is allowed to drop db

bool $isSuperUser

whether this user is a superuser

Return Value

bool

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(BookmarkFeature|null $bookmarkFeature, string $db, string $bookmarkUser, string $sqlQueryForBookmark, string $bookmarkLabel, bool $bookmarkReplace)

Function to store the query as a bookmark

Parameters

BookmarkFeature|null $bookmarkFeature
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(StatementInfo|null $statementInfo, bool $isGotoFile, string $db, string|null $table, string|null $sqlQueryForBookmark, 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

StatementInfo|null $statementInfo
bool $isGotoFile

whether goto file or not

string $db

current database

string|null $table

current table

string|null $sqlQueryForBookmark

the sql query to be stored as bookmark

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(StatementInfo $statementInfo, bool $isGotoFile, string $db, string|null $table, string|null $sqlQueryForBookmark, 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

StatementInfo $statementInfo
bool $isGotoFile

whether goto file or not

string $db

current database

string|null $table

current table

string|null $sqlQueryForBookmark

the sql query to be stored as bookmark

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