当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_DBI_get_triggers函数代码示例

本文整理汇总了PHP中PMA_DBI_get_triggers函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_DBI_get_triggers函数的具体用法?PHP PMA_DBI_get_triggers怎么用?PHP PMA_DBI_get_triggers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_DBI_get_triggers函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_TRI_handleExport

/**
 * If necessary, prepares trigger information and passes
 * it to PMA_RTE_handleExport() for the actual export.
 */
function PMA_TRI_handleExport()
{
    global $_GET, $db, $table;
    if (!empty($_GET['export_item']) && !empty($_GET['item_name'])) {
        $item_name = $_GET['item_name'];
        $triggers = PMA_DBI_get_triggers($db, $table, '');
        $export_data = false;
        foreach ($triggers as $trigger) {
            if ($trigger['name'] === $item_name) {
                $export_data = $trigger['create'];
                break;
            }
        }
        PMA_RTE_handleExport($item_name, $export_data);
    }
}
开发者ID:kirhgoph,项目名称:VMWare-Workstation-web-interface,代码行数:20,代码来源:rte_export.lib.php

示例2: exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param string $export_mode 'create_table','triggers','create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @param bool   $relation    whether to include relation comments
  * @param bool   $comments    whether to include the pmadb-style column
  *                            comments as comments in the structure; this is
  *                            deprecated but the parameter is left here
  *                            because export.php calls exportStructure()
  *                            also for other export types which use this
  *                            parameter
  * @param bool   $mime        whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  *
  * @return bool Whether it succeeded
  */
 public function exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $relation = false, $comments = false, $mime = false, $dates = false)
 {
     if (isset($GLOBALS['sql_compatibility'])) {
         $compat = $GLOBALS['sql_compatibility'];
     } else {
         $compat = 'NONE';
     }
     $formatted_table_name = isset($GLOBALS['sql_backquotes']) ? PMA_Util::backquoteCompat($table, $compat) : '\'' . $table . '\'';
     $dump = $this->_possibleCRLF() . $this->_exportComment(str_repeat('-', 56)) . $this->_possibleCRLF() . $this->_exportComment();
     switch ($export_mode) {
         case 'create_table':
             $dump .= $this->_exportComment(__('Table structure for table') . ' ' . $formatted_table_name);
             $dump .= $this->_exportComment();
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $dates);
             $dump .= $this->_getTableComments($db, $table, $crlf, $relation, $mime);
             break;
         case 'triggers':
             $dump = '';
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $dump .= $this->_possibleCRLF() . $this->_exportComment() . $this->_exportComment(__('Triggers') . ' ' . $formatted_table_name) . $this->_exportComment();
                 $delimiter = '//';
                 foreach ($triggers as $trigger) {
                     $dump .= $trigger['drop'] . ';' . $crlf;
                     $dump .= 'DELIMITER ' . $delimiter . $crlf;
                     $dump .= $trigger['create'];
                     $dump .= 'DELIMITER ;' . $crlf;
                 }
             }
             break;
         case 'create_view':
             $dump .= $this->_exportComment(__('Structure for view') . ' ' . $formatted_table_name) . $this->_exportComment();
             // delete the stand-in table previously created (if any)
             if ($export_type != 'table') {
                 $dump .= 'DROP TABLE IF EXISTS ' . PMA_Util::backquote($table) . ';' . $crlf;
             }
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $dates, true, true);
             break;
         case 'stand_in':
             $dump .= $this->_exportComment(__('Stand-in structure for view') . ' ' . $formatted_table_name) . $this->_exportComment();
             // export a stand-in definition to resolve view dependencies
             $dump .= $this->getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     // this one is built by getTableDef() to use in table copy/move
     // but not in the case of export
     unset($GLOBALS['sql_constraints_query']);
     return PMA_exportOutputHandler($dump);
 }
开发者ID:fanscky,项目名称:HTPMS,代码行数:71,代码来源:ExportSql.class.php

示例3: rename

 /**
  * renames table
  *
  * @param string $new_name new table name
  * @param string $new_db   new database name
  *
  * @return bool success
  */
 function rename($new_name, $new_db = null)
 {
     if (null !== $new_db && $new_db !== $this->getDbName()) {
         // Ensure the target is valid
         if (!$GLOBALS['pma']->databases->exists($new_db)) {
             $this->errors[] = __('Invalid database') . ': ' . $new_db;
             return false;
         }
     } else {
         $new_db = $this->getDbName();
     }
     $new_table = new PMA_Table($new_name, $new_db);
     if ($this->getFullName() === $new_table->getFullName()) {
         return true;
     }
     if (!PMA_Table::isValidName($new_name)) {
         $this->errors[] = __('Invalid table name') . ': ' . $new_table->getFullName();
         return false;
     }
     // If the table is moved to a different database drop its triggers first
     $triggers = PMA_DBI_get_triggers($this->getDbName(), $this->getName(), '');
     $handle_triggers = $this->getDbName() != $new_db && $triggers;
     if ($handle_triggers) {
         foreach ($triggers as $trigger) {
             $sql = 'DROP TRIGGER IF EXISTS ' . PMA_Util::backquote($this->getDbName()) . '.' . PMA_Util::backquote($trigger['name']) . ';';
             PMA_DBI_query($sql);
         }
     }
     /*
      * tested also for a view, in MySQL 5.0.92, 5.1.55 and 5.5.13
      */
     $GLOBALS['sql_query'] = '
         RENAME TABLE ' . $this->getFullName(true) . '
               TO ' . $new_table->getFullName(true) . ';';
     // I don't think a specific error message for views is necessary
     if (!PMA_DBI_query($GLOBALS['sql_query'])) {
         // Restore triggers in the old database
         if ($handle_triggers) {
             PMA_DBI_select_db($this->getDbName());
             foreach ($triggers as $trigger) {
                 PMA_DBI_query($trigger['create']);
             }
         }
         $this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName());
         return false;
     }
     $old_name = $this->getName();
     $old_db = $this->getDbName();
     $this->setName($new_name);
     $this->setDbName($new_db);
     // Renable table in configuration storage
     PMA_REL_renameTable($old_db, $new_db, $old_name, $new_name);
     $this->messages[] = sprintf(__('Table %1$s has been renamed to %2$s.'), htmlspecialchars($old_name), htmlspecialchars($new_name));
     return true;
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:63,代码来源:Table.class.php

示例4: PMA_TRI_getDataFromName

/**
 * This function will generate the values that are required to complete
 * the "Edit trigger" form given the name of a trigger.
 *
 * @param string $name The name of the trigger.
 *
 * @return array Data necessary to create the editor.
 */
function PMA_TRI_getDataFromName($name)
{
    global $db, $table, $_REQUEST;
    $temp = array();
    $items = PMA_DBI_get_triggers($db, $table, '');
    foreach ($items as $value) {
        if ($value['name'] == $name) {
            $temp = $value;
        }
    }
    if (empty($temp)) {
        return false;
    } else {
        $retval = array();
        $retval['create'] = $temp['create'];
        $retval['drop'] = $temp['drop'];
        $retval['item_name'] = $temp['name'];
        $retval['item_table'] = $temp['table'];
        $retval['item_action_timing'] = $temp['action_timing'];
        $retval['item_event_manipulation'] = $temp['event_manipulation'];
        $retval['item_definition'] = $temp['definition'];
        $retval['item_definer'] = $temp['definer'];
        return $retval;
    }
}
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:33,代码来源:rte_triggers.lib.php

示例5: PMA_DBI_get_triggers

 $this_what = $what;
 // do not copy the data from a Merge table
 // note: on the calling FORM, 'data' means 'structure and data'
 if ($tables_full[$each_table]['Engine'] == 'MRG_MyISAM') {
     if ($this_what == 'data') {
         $this_what = 'structure';
     }
     if ($this_what == 'dataonly') {
         $this_what = 'nocopy';
     }
 }
 if ($this_what != 'nocopy') {
     // keep the triggers from the original db+table
     // (third param is empty because delimiters are only intended
     //  for importing via the mysql client or our Import feature)
     $triggers = PMA_DBI_get_triggers($db, $each_table, '');
     if (!PMA_Table::moveCopy($db, $each_table, $newname, $each_table, isset($this_what) ? $this_what : 'data', $move, 'db_copy')) {
         $_error = true;
         // $sql_query is filled by PMA_Table::moveCopy()
         $sql_query = $back . $sql_query;
         break;
     }
     // apply the triggers to the destination db+table
     if ($triggers) {
         PMA_DBI_select_db($newname);
         foreach ($triggers as $trigger) {
             PMA_DBI_query($trigger['create']);
         }
         unset($trigger);
     }
     unset($triggers);
开发者ID:kolbermoorer,项目名称:edugame,代码行数:31,代码来源:db_operations.php

示例6: exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param string $export_mode 'create_table', 'triggers', 'create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  *                                export types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  *
  * @return bool Whether it succeeded
  */
 public function exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false)
 {
     $dump = '';
     switch ($export_mode) {
         case 'create_table':
             $dump .= '<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
             break;
         case 'triggers':
             $dump = '';
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $dump .= '<h2>' . __('Triggers') . ' ' . htmlspecialchars($table) . '</h2>';
                 $dump .= $this->getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $dump .= '<h2>' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
             break;
         case 'stand_in':
             $dump .= '<h2>' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             // export a stand-in definition to resolve view dependencies
             $dump .= $this->getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     return PMA_exportOutputHandler($dump);
 }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:50,代码来源:ExportHtmlword.class.php

示例7: exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param string $export_mode 'create_table', 'triggers', 'create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  *
  * @return bool Whether it succeeded
  */
 public function exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false)
 {
     switch ($export_mode) {
         case 'create_table':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</text:h>';
             $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
             break;
         case 'triggers':
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Triggers') . ' ' . htmlspecialchars($table) . '</text:h>';
                 $this->getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</text:h>';
             $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
             break;
         case 'stand_in':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</text:h>';
             // export a stand-in definition to resolve view dependencies
             $this->getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     return true;
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:47,代码来源:ExportOdt.class.php

示例8: PMA_exportHeader

 /**
  * Outputs export header
  *
  * @return  bool        Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportHeader()
 {
     global $crlf;
     global $cfg;
     global $what;
     global $db;
     global $table;
     global $tables;
     $export_struct = isset($GLOBALS[$what . '_export_struc']) ? true : false;
     $export_data = isset($GLOBALS[$what . '_export_contents']) ? true : false;
     if ($GLOBALS['output_charset_conversion']) {
         $charset = $GLOBALS['charset_of_file'];
     } else {
         $charset = $GLOBALS['charset'];
     }
     $head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf . '<!--' . $crlf . '- phpMyAdmin XML Dump' . $crlf . '- version ' . PMA_VERSION . $crlf . '- http://www.phpmyadmin.net' . $crlf . '-' . $crlf . '- ' . $GLOBALS['strHost'] . ': ' . $cfg['Server']['host'];
     if (!empty($cfg['Server']['port'])) {
         $head .= ':' . $cfg['Server']['port'];
     }
     $head .= $crlf . '- ' . $GLOBALS['strGenTime'] . ': ' . PMA_localisedDate() . $crlf . '- ' . $GLOBALS['strServerVersion'] . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf . '- ' . $GLOBALS['strPHPVersion'] . ': ' . phpversion() . $crlf . '-->' . $crlf . $crlf;
     $head .= '<pma_xml_export version="1.0"' . ($export_struct ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
     if ($export_struct) {
         $result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` = \'' . $db . '\' LIMIT 1');
         $db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
         $db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
         $head .= '    <!--' . $crlf;
         $head .= '    - Structure schemas' . $crlf;
         $head .= '    -->' . $crlf;
         $head .= '    <pma:structure_schemas>' . $crlf;
         $head .= '        <pma:database name="' . $db . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
         if (count($tables) == 0) {
             $tables[] = $table;
         }
         foreach ($tables as $table) {
             // Export tables and views
             $result = PMA_DBI_fetch_result('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0);
             $tbl = $result[$table][1];
             $is_view = PMA_isView($db, $table);
             if ($is_view) {
                 $type = 'view';
             } else {
                 $type = 'table';
             }
             if ($is_view && !isset($GLOBALS[$what . '_export_views'])) {
                 continue;
             }
             if (!$is_view && !isset($GLOBALS[$what . '_export_tables'])) {
                 continue;
             }
             $head .= '            <pma:' . $type . ' name="' . $table . '">' . $crlf;
             $tbl = "                " . $tbl;
             $tbl = str_replace("\n", "\n                ", $tbl);
             $head .= $tbl . ';' . $crlf;
             $head .= '            </pma:' . $type . '>' . $crlf;
             if (isset($GLOBALS[$what . '_export_triggers']) && $GLOBALS[$what . '_export_triggers']) {
                 // Export triggers
                 $triggers = PMA_DBI_get_triggers($db, $table);
                 if ($triggers) {
                     foreach ($triggers as $trigger) {
                         $code = $trigger['create'];
                         $head .= '            <pma:trigger name="' . $trigger['name'] . '">' . $crlf;
                         // Do some formatting
                         $code = substr(rtrim($code), 0, -3);
                         $code = "                " . $code;
                         $code = str_replace("\n", "\n                ", $code);
                         $head .= $code . $crlf;
                         $head .= '            </pma:trigger>' . $crlf;
                     }
                     unset($trigger);
                     unset($triggers);
                 }
             }
         }
         if (isset($GLOBALS[$what . '_export_functions']) && $GLOBALS[$what . '_export_functions']) {
             // Export functions
             $functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
             if ($functions) {
                 foreach ($functions as $function) {
                     $head .= '            <pma:function name="' . $function . '">' . $crlf;
                     // Do some formatting
                     $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
                     $sql = rtrim($sql);
                     $sql = "                " . $sql;
                     $sql = str_replace("\n", "\n                ", $sql);
                     $head .= $sql . $crlf;
                     $head .= '            </pma:function>' . $crlf;
                 }
                 unset($create_func);
                 unset($function);
                 unset($functions);
             }
         }
         if (isset($GLOBALS[$what . '_export_procedures']) && $GLOBALS[$what . '_export_procedures']) {
//.........这里部分代码省略.........
开发者ID:kolbermoorer,项目名称:edugame,代码行数:101,代码来源:xml.php

示例9: exportHeader

 /**
  * Outputs export header. It is the first method to be called, so all
  * the required variables are initialized here.
  *
  * @return bool Whether it succeeded
  */
 public function exportHeader()
 {
     $this->initSpecificVariables();
     global $crlf, $cfg, $db;
     $table = $this->_getTable();
     $tables = $this->_getTables();
     $export_struct = isset($GLOBALS['xml_export_functions']) || isset($GLOBALS['xml_export_procedures']) || isset($GLOBALS['xml_export_tables']) || isset($GLOBALS['xml_export_triggers']) || isset($GLOBALS['xml_export_views']);
     $export_data = isset($GLOBALS['xml_export_contents']) ? true : false;
     if ($GLOBALS['output_charset_conversion']) {
         $charset = $GLOBALS['charset_of_file'];
     } else {
         $charset = 'utf-8';
     }
     $head = '<?xml version="1.0" encoding="' . $charset . '"?>' . $crlf . '<!--' . $crlf . '- phpMyAdmin XML Dump' . $crlf . '- version ' . PMA_VERSION . $crlf . '- http://www.phpmyadmin.net' . $crlf . '-' . $crlf . '- ' . __('Host') . ': ' . $cfg['Server']['host'];
     if (!empty($cfg['Server']['port'])) {
         $head .= ':' . $cfg['Server']['port'];
     }
     $head .= $crlf . '- ' . __('Generation Time') . ': ' . PMA_Util::localisedDate() . $crlf . '- ' . __('Server version') . ': ' . PMA_MYSQL_STR_VERSION . $crlf . '- ' . __('PHP Version') . ': ' . phpversion() . $crlf . '-->' . $crlf . $crlf;
     $head .= '<pma_xml_export version="1.0"' . ($export_struct ? ' xmlns:pma="http://www.phpmyadmin.net/some_doc_url/"' : '') . '>' . $crlf;
     if ($export_struct) {
         if (PMA_DRIZZLE) {
             $result = PMA_DBI_fetch_result("SELECT\n                        'utf8' AS DEFAULT_CHARACTER_SET_NAME,\n                        DEFAULT_COLLATION_NAME\n                    FROM data_dictionary.SCHEMAS\n                    WHERE SCHEMA_NAME = '" . PMA_Util::sqlAddSlashes($db) . "'");
         } else {
             $result = PMA_DBI_fetch_result('SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`' . ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`' . ' = \'' . PMA_Util::sqlAddSlashes($db) . '\' LIMIT 1');
         }
         $db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
         $db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];
         $head .= '    <!--' . $crlf;
         $head .= '    - Structure schemas' . $crlf;
         $head .= '    -->' . $crlf;
         $head .= '    <pma:structure_schemas>' . $crlf;
         $head .= '        <pma:database name="' . htmlspecialchars($db) . '" collation="' . $db_collation . '" charset="' . $db_charset . '">' . $crlf;
         if (count($tables) == 0) {
             $tables[] = $table;
         }
         foreach ($tables as $table) {
             // Export tables and views
             $result = PMA_DBI_fetch_result('SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table), 0);
             $tbl = $result[$table][1];
             $is_view = PMA_Table::isView($db, $table);
             if ($is_view) {
                 $type = 'view';
             } else {
                 $type = 'table';
             }
             if ($is_view && !isset($GLOBALS['xml_export_views'])) {
                 continue;
             }
             if (!$is_view && !isset($GLOBALS['xml_export_tables'])) {
                 continue;
             }
             $head .= '            <pma:' . $type . ' name="' . $table . '">' . $crlf;
             $tbl = "                " . htmlspecialchars($tbl);
             $tbl = str_replace("\n", "\n                ", $tbl);
             $head .= $tbl . ';' . $crlf;
             $head .= '            </pma:' . $type . '>' . $crlf;
             if (isset($GLOBALS['xml_export_triggers']) && $GLOBALS['xml_export_triggers']) {
                 // Export triggers
                 $triggers = PMA_DBI_get_triggers($db, $table);
                 if ($triggers) {
                     foreach ($triggers as $trigger) {
                         $code = $trigger['create'];
                         $head .= '            <pma:trigger name="' . $trigger['name'] . '">' . $crlf;
                         // Do some formatting
                         $code = substr(rtrim($code), 0, -3);
                         $code = "                " . htmlspecialchars($code);
                         $code = str_replace("\n", "\n                ", $code);
                         $head .= $code . $crlf;
                         $head .= '            </pma:trigger>' . $crlf;
                     }
                     unset($trigger);
                     unset($triggers);
                 }
             }
         }
         if (isset($GLOBALS['xml_export_functions']) && $GLOBALS['xml_export_functions']) {
             // Export functions
             $functions = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION');
             if ($functions) {
                 foreach ($functions as $function) {
                     $head .= '            <pma:function name="' . $function . '">' . $crlf;
                     // Do some formatting
                     $sql = PMA_DBI_get_definition($db, 'FUNCTION', $function);
                     $sql = rtrim($sql);
                     $sql = "                " . htmlspecialchars($sql);
                     $sql = str_replace("\n", "\n                ", $sql);
                     $head .= $sql . $crlf;
                     $head .= '            </pma:function>' . $crlf;
                 }
                 unset($function);
                 unset($functions);
             }
         }
         if (isset($GLOBALS['xml_export_procedures']) && $GLOBALS['xml_export_procedures']) {
//.........这里部分代码省略.........
开发者ID:yxwzaxns,项目名称:sakura,代码行数:101,代码来源:ExportXml.class.php

示例10: PMA_DBI_get_triggers

<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 *
 * @version $Id: tbl_triggers.lib.php 11994 2008-11-24 11:22:44Z nijel $
 * @package phpMyAdmin
 */
if (!defined('PHPMYADMIN')) {
    exit;
}
$url_query .= '&amp;goto=tbl_structure.php';
$triggers = PMA_DBI_get_triggers($db, $table);
if ($triggers) {
    echo '<div id="tabletriggers">' . "\n";
    echo '<table class="data">' . "\n";
    echo ' <caption class="tblHeaders">' . $strTriggers . '</caption>' . "\n";
    echo sprintf('<tr>
                          <th>%s</th>
                          <th>&nbsp;</th>
                          <th>&nbsp;</th>
                          <th>%s</th>
                          <th>%s</th>
                    </tr>', $strName, $strTime, $strEvent);
    $ct = 0;
    $delimiter = '//';
    foreach ($triggers as $trigger) {
        $drop_and_create = $trigger['drop'] . $delimiter . "\n" . $trigger['create'] . "\n";
        echo sprintf('<tr class="%s">
                              <td><strong>%s</strong></td>
                              <td>%s</td>
开发者ID:alexhava,项目名称:elixirjuice,代码行数:31,代码来源:tbl_triggers.lib.php

示例11: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param   string   the database name
  * @param   string   the table name
  * @param   string   the end of line sequence
  * @param   string   the url to go back in case of error
  * @param   boolean  whether to include relation comments
  * @param   boolean  whether to include column comments
  * @param   boolean  whether to include mime comments
  * @param   string   'stand_in', 'create_table', 'create_view'
  * @param   string   'server', 'database', 'table' 
  *
  * @return  bool     Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE, $export_mode, $export_type)
 {
     $formatted_table_name = isset($GLOBALS['sql_backquotes']) ? PMA_backquote($table) : '\'' . $table . '\'';
     $dump = $crlf . PMA_exportComment(str_repeat('-', 56)) . $crlf . PMA_exportComment();
     switch ($export_mode) {
         case 'create_table':
             $dump .= PMA_exportComment($GLOBALS['strTableStructure'] . ' ' . $formatted_table_name) . PMA_exportComment();
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates) . ';' . $crlf;
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $dump .= $crlf . PMA_exportComment() . PMA_exportComment($GLOBALS['strTriggers'] . ' ' . $formatted_table_name) . PMA_exportComment();
                 $delimiter = '//';
                 foreach ($triggers as $trigger) {
                     $dump .= $trigger['drop'] . ';' . $crlf;
                     $dump .= 'DELIMITER ' . $delimiter . $crlf;
                     $dump .= $trigger['create'];
                     $dump .= 'DELIMITER ;' . $crlf;
                 }
             }
             break;
         case 'create_view':
             $dump .= PMA_exportComment($GLOBALS['strStructureForView'] . ' ' . $formatted_table_name) . PMA_exportComment();
             // delete the stand-in table previously created (if any)
             if ($export_type != 'table') {
                 $dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
             }
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates) . ';' . $crlf;
             break;
         case 'stand_in':
             $dump .= PMA_exportComment($GLOBALS['strStandInStructureForView'] . ' ' . $formatted_table_name) . PMA_exportComment();
             // export a stand-in definition to resolve view dependencies
             $dump .= PMA_getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     $dump .= PMA_getTableComments($db, $table, $crlf, $relation, $comments, $mime);
     // this one is built by PMA_getTableDef() to use in table copy/move
     // but not in the case of export
     unset($GLOBALS['sql_constraints_query']);
     return PMA_exportOutputHandler($dump);
 }
开发者ID:findlakes,项目名称:XSS-Platform,代码行数:57,代码来源:sql.php

示例12: PMA_getSqlQueryForCopyTable

/**
 * Get sql query for copy/rename table and boolean for whether copy/rename or not
 *
 * @param array   $tables_full array of all tables in given db or dbs
 * @param string  $sql_query   sql query for all operations
 * @param boolean $move        whether databse name is empty or not
 * @param string  $db          database name
 *
 * @return array ($sql_query, $error)
 */
function PMA_getSqlQueryForCopyTable($tables_full, $sql_query, $move, $db)
{
    $error = false;
    foreach ($tables_full as $each_table => $tmp) {
        // skip the views; we have creted stand-in definitions
        if (PMA_Table::isView($db, $each_table)) {
            continue;
        }
        $back = $sql_query;
        $sql_query = '';
        // value of $what for this table only
        $this_what = $_REQUEST['what'];
        // do not copy the data from a Merge table
        // note: on the calling FORM, 'data' means 'structure and data'
        if (PMA_Table::isMerge($db, $each_table)) {
            if ($this_what == 'data') {
                $this_what = 'structure';
            }
            if ($this_what == 'dataonly') {
                $this_what = 'nocopy';
            }
        }
        if ($this_what != 'nocopy') {
            // keep the triggers from the original db+table
            // (third param is empty because delimiters are only intended
            //  for importing via the mysql client or our Import feature)
            $triggers = PMA_DBI_get_triggers($db, $each_table, '');
            if (!PMA_Table::moveCopy($db, $each_table, $_REQUEST['newname'], $each_table, isset($this_what) ? $this_what : 'data', $move, 'db_copy')) {
                $error = true;
                // $sql_query is filled by PMA_Table::moveCopy()
                $sql_query = $back . $sql_query;
                break;
            }
            // apply the triggers to the destination db+table
            if ($triggers) {
                PMA_DBI_select_db($_REQUEST['newname']);
                foreach ($triggers as $trigger) {
                    PMA_DBI_query($trigger['create']);
                    $GLOBALS['sql_query'] .= "\n" . $trigger['create'] . ';';
                }
            }
            // this does not apply to a rename operation
            if (isset($_REQUEST['add_constraints']) && !empty($GLOBALS['sql_constraints_query'])) {
                $GLOBALS['sql_constraints_query_full_db'][] = $GLOBALS['sql_constraints_query'];
                unset($GLOBALS['sql_constraints_query']);
            }
        }
        // $sql_query is filled by PMA_Table::moveCopy()
        $sql_query = $back . $sql_query;
    }
    return array($sql_query, $error);
}
开发者ID:fanscky,项目名称:HTPMS,代码行数:62,代码来源:operations.lib.php


注:本文中的PMA_DBI_get_triggers函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。