class Sql

Set of functions for the SQL executor

Methods

__construct()

Constructor

mixed
parseAndAnalyze(string $sql_query, string $db = null)

Parses and analyzes the given SQL query.

string
getHtmlForBookmark(array $displayParts, array $cfgBookmark, string $sql_query, string $db, string $table, string|null $complete_query, string $bkm_user)

Function to get html for bookmark support if bookmarks are enabled. Else will return null

bool
isJustBrowsing(array $analyzed_sql_results, bool|null $find_real_end)

Function to check whether this query is for just browsing

boolean
hasNoRightsToDropDatabase(array $analyzed_sql_results, boolean $allowUserDropDatabase, boolean $is_superuser)

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

void
setColumnOrderOrVisibility(string $table, string $db)

Function to check the request for setting the column order or visibility

void
addBookmark(string $goto)

Function to add a bookmark

mixed
findRealEndOfRows(string $db, string $table)

Function to find the real end of rows

void
getRelationalValues(string $db, string $table)

Function to get values for the relational columns

void
getEnumOrSetValues(string $db, string $table, string $columnType)

Function to get values for Enum or Set Columns

string
getDefaultSqlQueryForBrowse(string $db, string $table)

Function to get the default sql query for browsing page

void
storeTheQueryAsBookmark(string $db, string $bkm_user, string $sql_query_for_bookmark, string $bkm_label, bool|null $bkm_replace)

Function to store the query as a bookmark

void
executeQueryAndSendQueryResponse(array $analyzed_sql_results, bool $is_gotofile, string $db, string $table, bool|null $find_real_end, string $sql_query_for_bookmark, array|null $extra_data, string $message_to_show, string $message, array|null $sql_data, string $goto, string $pmaThemeImage, string $disp_query, Message|string $disp_message, string $query_type, string $sql_query, array|null $selectedTables, string $complete_query)

Function to execute the query and send the response

string
executeQueryAndGetQueryResponse(array $analyzed_sql_results, bool $is_gotofile, string|null $db, string|null $table, bool|null $find_real_end, string|null $sql_query_for_bookmark, array|null $extra_data, string|null $message_to_show, Message|string|null $message, array|null $sql_data, string $goto, string $pmaThemeImage, string|null $disp_query, Message|string|null $disp_message, string|null $query_type, string $sql_query, array|null $selectedTables, string|null $complete_query)

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

at line 66
__construct()

Constructor

at line 85
mixed parseAndAnalyze(string $sql_query, string $db = null)

Parses and analyzes the given SQL query.

Parameters

string $sql_query SQL query
string $db DB name

Return Value

mixed

at line 484
string getHtmlForBookmark(array $displayParts, array $cfgBookmark, string $sql_query, string $db, string $table, string|null $complete_query, string $bkm_user)

Function to get html for bookmark support if bookmarks are enabled. Else will return null

Parameters

array $displayParts the parts to display
array $cfgBookmark configuration setting for bookmarking
string $sql_query sql query
string $db current database
string $table current table
string|null $complete_query complete query
string $bkm_user bookmarking user

Return Value

string

at line 568
bool isJustBrowsing(array $analyzed_sql_results, bool|null $find_real_end)

Function to check whether this query is for just browsing

Parameters

array $analyzed_sql_results the analyzed query and other variables set after analyzing the query
bool|null $find_real_end whether the real end should be found

Return Value

bool

at line 611
boolean hasNoRightsToDropDatabase(array $analyzed_sql_results, boolean $allowUserDropDatabase, boolean $is_superuser)

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

Parameters

array $analyzed_sql_results the analyzed query and other variables set after analyzing the query
boolean $allowUserDropDatabase whether the user is allowed to drop db
boolean $is_superuser whether this user is a superuser

Return Value

boolean

at line 666
void setColumnOrderOrVisibility(string $table, string $db)

Function to check the request for setting the column order or visibility

Parameters

string $table the current table
string $db the current database

Return Value

void

at line 693
void addBookmark(string $goto)

Function to add a bookmark

Parameters

string $goto goto page URL

Return Value

void

at line 736
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

at line 752
void getRelationalValues(string $db, string $table)

Function to get values for the relational columns

Parameters

string $db the current database
string $table the current table

Return Value

void

at line 783
void getEnumOrSetValues(string $db, string $table, string $columnType)

Function to get values for Enum or Set Columns

Parameters

string $db the current database
string $table the current table
string $columnType whether enum or set

Return Value

void

at line 816
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

at line 903
void storeTheQueryAsBookmark(string $db, string $bkm_user, string $sql_query_for_bookmark, string $bkm_label, bool|null $bkm_replace)

Function to store the query as a bookmark

Parameters

string $db the current database
string $bkm_user the bookmarking user
string $sql_query_for_bookmark the query to be stored in bookmark
string $bkm_label bookmark label
bool|null $bkm_replace whether to replace existing bookmarks

Return Value

void

at line 2062
void executeQueryAndSendQueryResponse(array $analyzed_sql_results, bool $is_gotofile, string $db, string $table, bool|null $find_real_end, string $sql_query_for_bookmark, array|null $extra_data, string $message_to_show, string $message, array|null $sql_data, string $goto, string $pmaThemeImage, string $disp_query, Message|string $disp_message, string $query_type, string $sql_query, array|null $selectedTables, string $complete_query)

Function to execute the query and send the response

Parameters

array $analyzed_sql_results analysed sql results
bool $is_gotofile whether goto file or not
string $db current database
string $table current table
bool|null $find_real_end whether to find real end or not
string $sql_query_for_bookmark the sql query to be stored as bookmark
array|null $extra_data extra data
string $message_to_show message to show
string $message message
array|null $sql_data sql data
string $goto goto page url
string $pmaThemeImage uri of the PMA theme image
string $disp_query display query
Message|string $disp_message display message
string $query_type query type
string $sql_query sql query
array|null $selectedTables array of table names selected from the database structure page, for an action like check table, optimize table, analyze table or repair table
string $complete_query complete query

Return Value

void

at line 2149
string executeQueryAndGetQueryResponse(array $analyzed_sql_results, bool $is_gotofile, string|null $db, string|null $table, bool|null $find_real_end, string|null $sql_query_for_bookmark, array|null $extra_data, string|null $message_to_show, Message|string|null $message, array|null $sql_data, string $goto, string $pmaThemeImage, string|null $disp_query, Message|string|null $disp_message, string|null $query_type, string $sql_query, array|null $selectedTables, string|null $complete_query)

Function to execute the query and send the response

Parameters

array $analyzed_sql_results analysed sql results
bool $is_gotofile whether goto file or not
string|null $db current database
string|null $table current table
bool|null $find_real_end whether to find real end or not
string|null $sql_query_for_bookmark the sql query to be stored as bookmark
array|null $extra_data extra data
string|null $message_to_show message to show
Message|string|null $message message
array|null $sql_data sql data
string $goto goto page url
string $pmaThemeImage uri of the PMA theme image
string|null $disp_query display query
Message|string|null $disp_message display message
string|null $query_type query type
string $sql_query sql query
array|null $selectedTables array of table names selected from the database structure page, for an action like check table, optimize table, analyze table or repair table
string|null $complete_query complete query

Return Value

string html

at line 2311
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