PMA\libraries\DatabaseInterface::getEvents PHP Метод

getEvents() публичный Метод

returns details about the EVENTs for a specific database
public getEvents ( string $db, string $name = '' ) : array
$db string db name
$name string event name
Результат array information about EVENTs
    public function getEvents($db, $name = '')
    {
        if (!$GLOBALS['cfg']['Server']['DisableIS']) {
            $query = "SELECT" . " `EVENT_SCHEMA` AS `Db`," . " `EVENT_NAME` AS `Name`," . " `DEFINER` AS `Definer`," . " `TIME_ZONE` AS `Time zone`," . " `EVENT_TYPE` AS `Type`," . " `EXECUTE_AT` AS `Execute at`," . " `INTERVAL_VALUE` AS `Interval value`," . " `INTERVAL_FIELD` AS `Interval field`," . " `STARTS` AS `Starts`," . " `ENDS` AS `Ends`," . " `STATUS` AS `Status`," . " `ORIGINATOR` AS `Originator`," . " `CHARACTER_SET_CLIENT` AS `character_set_client`," . " `COLLATION_CONNECTION` AS `collation_connection`, " . "`DATABASE_COLLATION` AS `Database Collation`" . " FROM `information_schema`.`EVENTS`" . " WHERE `EVENT_SCHEMA` " . Util::getCollateForIS() . " = '" . $GLOBALS['dbi']->escapeString($db) . "'";
            if (!empty($name)) {
                $query .= " AND `EVENT_NAME`" . " = '" . $GLOBALS['dbi']->escapeString($name) . "'";
            }
        } else {
            $query = "SHOW EVENTS FROM " . Util::backquote($db);
            if (!empty($name)) {
                $query .= " AND `Name` = '" . $GLOBALS['dbi']->escapeString($name) . "'";
            }
        }
        $result = array();
        if ($events = $this->fetchResult($query)) {
            foreach ($events as $event) {
                $one_result = array();
                $one_result['name'] = $event['Name'];
                $one_result['type'] = $event['Type'];
                $one_result['status'] = $event['Status'];
                $result[] = $one_result;
            }
        }
        // Sort results by name
        $name = array();
        foreach ($result as $value) {
            $name[] = $value['name'];
        }
        array_multisort($name, SORT_ASC, $result);
        return $result;
    }