\n";
$retval .= "\n";
return $retval;
} // end PMA_RTE_getList()
/**
* Creates the contents for a row in the list of routines
*
* @param array $routine An array of routine data
* @param string $rowclass Empty or one of ['even'|'odd']
*
* @return string HTML code of a row for the list of routines
*/
function PMA_RTN_getRowForList($routine, $rowclass = '')
{
global $ajax_class, $url_query, $db, $titles;
$sql_drop = sprintf(
'DROP %s IF EXISTS %s',
$routine['type'],
PMA\libraries\Util::backquote($routine['name'])
);
$type_link = "item_type={$routine['type']}";
$retval = "
\n";
// Since editing a procedure involved dropping and recreating, check also for
// CREATE ROUTINE privilege to avoid lost procedures.
if (PMA\libraries\Util::currentUserHasPrivilege('CREATE ROUTINE', $db)) {
$retval .= ' ' . $titles['Edit'] . "\n";
} else {
$retval .= " {$titles['NoEdit']}\n";
}
$retval .= "
\n";
$retval .= "
\n";
// There is a problem with PMA\libraries\Util::currentUserHasPrivilege():
// it does not detect all kinds of privileges, for example
// a direct privilege on a specific routine. So, at this point,
// we show the Execute link, hoping that the user has the correct rights.
// Also, information_schema might be hiding the ROUTINE_DEFINITION
// but a routine with no input parameters can be nonetheless executed.
// Check if the routine has any input parameters. If it does,
// we will show a dialog to get values for these parameters,
// otherwise we can execute it directly.
$definition = $GLOBALS['dbi']->getDefinition(
$db, $routine['type'], $routine['name']
);
if ($definition !== false) {
$parser = new SqlParser\Parser($definition);
/**
* @var CreateStatement $stmt
*/
$stmt = $parser->statements[0];
$params = SqlParser\Utils\Routine::getParameters($stmt);
if (PMA\libraries\Util::currentUserHasPrivilege('EXECUTE', $db)) {
$execute_action = 'execute_routine';
for ($i = 0; $i < $params['num']; $i++) {
if ($routine['type'] == 'PROCEDURE'
&& $params['dir'][$i] == 'OUT'
) {
continue;
}
$execute_action = 'execute_dialog';
break;
}
$retval .= ' ' . $titles['Execute'] . "\n";
} else {
$retval .= " {$titles['NoExecute']}\n";
}
}
$retval .= "
\n";
return $retval;
} // end PMA_RTN_getRowForList()
/**
* Creates the contents for a row in the list of triggers
*
* @param array $trigger An array of routine data
* @param string $rowclass Empty or one of ['even'|'odd']
*
* @return string HTML code of a cell for the list of triggers
*/
function PMA_TRI_getRowForList($trigger, $rowclass = '')
{
global $ajax_class, $url_query, $db, $table, $titles;
$retval = "
\n";
return $retval;
} // end PMA_TRI_getRowForList()
/**
* Creates the contents for a row in the list of events
*
* @param array $event An array of routine data
* @param string $rowclass Empty or one of ['even'|'odd']
*
* @return string HTML code of a cell for the list of events
*/
function PMA_EVN_getRowForList($event, $rowclass = '')
{
global $ajax_class, $url_query, $db, $titles;
$sql_drop = sprintf(
'DROP EVENT IF EXISTS %s',
PMA\libraries\Util::backquote($event['name'])
);
$retval = "