class Routines (View source)

Functions for routine management.

Methods

__construct(DatabaseInterface $dbi, Template $template, ResponseRenderer $response)

No description

void
handleEditor()

Handles editor requests for adding or editing an item

array
handleRequestCreateOrEdit(array $errors, string $db)

Handle request to create or edit a routine

array
backupPrivileges()

Backup the privileges

array
create(string $routine_query, string $create_routine, array $privilegesBackup)

Create the routine

flushPrivileges(bool $flushPrivileges)

Flush privileges and get message

array
getDataFromRequest()

This function will generate the values that are required to complete the editor form. It is especially necessary to handle the 'Add another parameter', 'Remove last parameter' and 'Change routine type' functionalities when JS is disabled.

array|null
getDataFromName(string $name, string $type, bool $all = true)

This function will generate the values that are required to complete the "Edit routine" form given the name of a routine.

string
getParameterRow(array $routine = [], mixed $index = null, string $class = '')

Creates one row for the parameter table used in the routine editor.

string
getEditorForm(string $mode, string $operation, array $routine)

Displays a form used to add/edit a routine

string
getQueryFromRequest()

Composes the query necessary to create a routine from an HTTP request.

void
handleExecute()

Handles requests for executing a routine

string
getExecuteForm(array $routine)

Creates the HTML code that shows the routine execution dialog.

string
getRow(array $routine, string $rowClass = '')

Creates the contents for a row in the list of routines

void
export()

No description

Details

__construct(DatabaseInterface $dbi, Template $template, ResponseRenderer $response)

No description

Parameters

DatabaseInterface $dbi

DatabaseInterface instance.

Template $template

Template instance.

ResponseRenderer $response

Response instance.

void handleEditor()

Handles editor requests for adding or editing an item

Return Value

void

array handleRequestCreateOrEdit(array $errors, string $db)

Handle request to create or edit a routine

Parameters

array $errors Errors
string $db

DB name

Return Value

array

array backupPrivileges()

Backup the privileges

Return Value

array

array create(string $routine_query, string $create_routine, array $privilegesBackup)

Create the routine

Parameters

string $routine_query

Query to create routine

string $create_routine

Query to restore routine

array $privilegesBackup

Privileges backup

Return Value

array

Message flushPrivileges(bool $flushPrivileges)

Flush privileges and get message

Parameters

bool $flushPrivileges

Flush privileges

Return Value

Message

array getDataFromRequest()

This function will generate the values that are required to complete the editor form. It is especially necessary to handle the 'Add another parameter', 'Remove last parameter' and 'Change routine type' functionalities when JS is disabled.

Return Value

array

Data necessary to create the routine editor.

array|null getDataFromName(string $name, string $type, bool $all = true)

This function will generate the values that are required to complete the "Edit routine" form given the name of a routine.

Parameters

string $name

The name of the routine.

string $type

Type of routine (ROUTINE|PROCEDURE)

bool $all

Whether to return all data or just the info about parameters.

Return Value

array|null

Data necessary to create the routine editor.

string getParameterRow(array $routine = [], mixed $index = null, string $class = '')

Creates one row for the parameter table used in the routine editor.

Parameters

array $routine

Data for the routine returned by getDataFromRequest() or getDataFromName()

mixed $index

Either a numeric index of the row being processed or NULL to create a template row for AJAX request

string $class

Class used to hide the direction column, if the row is for a stored function.

Return Value

string

HTML code of one row of parameter table for the editor.

string getEditorForm(string $mode, string $operation, array $routine)

Displays a form used to add/edit a routine

Parameters

string $mode

If the editor will be used to edit a routine or add a new one: 'edit' or 'add'.

string $operation

If the editor was previously invoked with JS turned off, this will hold the name of the current operation

array $routine

Data for the routine returned by getDataFromRequest() or getDataFromName()

Return Value

string

HTML code for the editor.

string getQueryFromRequest()

Composes the query necessary to create a routine from an HTTP request.

Return Value

string

The CREATE [ROUTINE | PROCEDURE] query.

void handleExecute()

Handles requests for executing a routine

Return Value

void

string getExecuteForm(array $routine)

Creates the HTML code that shows the routine execution dialog.

Parameters

array $routine

Data for the routine returned by getDataFromName()

Return Value

string

HTML code for the routine execution dialog.

string getRow(array $routine, string $rowClass = '')

Creates the contents for a row in the list of routines

Parameters

array $routine

An array of routine data

string $rowClass

Additional class

Return Value

string

HTML code of a row for the list of routines

void export()

No description

Return Value

void