PMA\libraries\plugins\export\ExportSql::_exportRoutineSQL PHP Метод

_exportRoutineSQL() защищенный Метод

Generates SQL for routines export
protected _exportRoutineSQL ( string $db, array $aliases, string $type, string $name, array $routines, string $delimiter ) : string
$db string Database
$aliases array Aliases of db/table/columns
$type string Type of exported routine
$name string Verbose name of exported routine
$routines array List of routines to export
$delimiter string Delimiter to use in SQL
Результат string SQL query
    protected function _exportRoutineSQL($db, $aliases, $type, $name, $routines, $delimiter)
    {
        global $crlf;
        $text = $this->_exportComment() . $this->_exportComment($name) . $this->_exportComment();
        $used_alias = false;
        $proc_query = '';
        foreach ($routines as $routine) {
            if (!empty($GLOBALS['sql_drop_table'])) {
                $proc_query .= 'DROP ' . $type . ' IF EXISTS ' . Util::backquote($routine) . $delimiter . $crlf;
            }
            $create_query = $this->replaceWithAliases($GLOBALS['dbi']->getDefinition($db, $type, $routine), $aliases, $db, '', $flag);
            // One warning per database
            if ($flag) {
                $used_alias = true;
            }
            $proc_query .= $create_query . $delimiter . $crlf . $crlf;
        }
        if ($used_alias) {
            $text .= $this->_exportComment(__('It appears your database uses routines;')) . $this->_exportComment(__('alias export may not work reliably in all cases.')) . $this->_exportComment();
        }
        $text .= $proc_query;
        return $text;
    }