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


PHP PMA_Util::getCollateForIS方法代码示例

本文整理汇总了PHP中PMA_Util::getCollateForIS方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::getCollateForIS方法的具体用法?PHP PMA_Util::getCollateForIS怎么用?PHP PMA_Util::getCollateForIS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA_Util的用法示例。


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

示例1: PMA_RTN_getDataFromName

/**
 * This function will generate the values that are required to complete
 * the "Edit routine" form given the name of a routine.
 *
 * @param string $name The name of the routine.
 * @param string $type Type of routine (ROUTINE|PROCEDURE)
 * @param bool   $all  Whether to return all data or just
 *                     the info about parameters.
 *
 * @return array    Data necessary to create the routine editor.
 */
function PMA_RTN_getDataFromName($name, $type, $all = true)
{
    global $db;
    $retval = array();
    // Build and execute the query
    $fields = "SPECIFIC_NAME, ROUTINE_TYPE, DTD_IDENTIFIER, " . "ROUTINE_DEFINITION, IS_DETERMINISTIC, SQL_DATA_ACCESS, " . "ROUTINE_COMMENT, SECURITY_TYPE";
    $where = "ROUTINE_SCHEMA " . PMA_Util::getCollateForIS() . "=" . "'" . PMA_Util::sqlAddSlashes($db) . "' " . "AND SPECIFIC_NAME='" . PMA_Util::sqlAddSlashes($name) . "'" . "AND ROUTINE_TYPE='" . PMA_Util::sqlAddSlashes($type) . "'";
    $query = "SELECT {$fields} FROM INFORMATION_SCHEMA.ROUTINES WHERE {$where};";
    $routine = $GLOBALS['dbi']->fetchSingleRow($query);
    if (!$routine) {
        return false;
    }
    // Get required data
    $retval['item_name'] = $routine['SPECIFIC_NAME'];
    $retval['item_type'] = $routine['ROUTINE_TYPE'];
    $parsed_query = PMA_SQP_parse($GLOBALS['dbi']->getDefinition($db, $routine['ROUTINE_TYPE'], $routine['SPECIFIC_NAME']));
    $params = PMA_RTN_parseAllParameters($parsed_query, $routine['ROUTINE_TYPE']);
    $retval['item_num_params'] = $params['num'];
    $retval['item_param_dir'] = $params['dir'];
    $retval['item_param_name'] = $params['name'];
    $retval['item_param_type'] = $params['type'];
    $retval['item_param_length'] = $params['length'];
    $retval['item_param_opts_num'] = $params['opts'];
    $retval['item_param_opts_text'] = $params['opts'];
    // Get extra data
    if (!$all) {
        return $retval;
    }
    if ($retval['item_type'] == 'FUNCTION') {
        $retval['item_type_toggle'] = 'PROCEDURE';
    } else {
        $retval['item_type_toggle'] = 'FUNCTION';
    }
    $retval['item_returntype'] = '';
    $retval['item_returnlength'] = '';
    $retval['item_returnopts_num'] = '';
    $retval['item_returnopts_text'] = '';
    if (!empty($routine['DTD_IDENTIFIER'])) {
        if (mb_strlen($routine['DTD_IDENTIFIER']) > 63) {
            // If the DTD_IDENTIFIER string from INFORMATION_SCHEMA is
            // at least 64 characters, then it may actually have been
            // chopped because that column is a varchar(64), so we will
            // parse the output of SHOW CREATE query to get accurate
            // information about the return variable.
            $dtd = '';
            $fetching = false;
            for ($i = 0; $i < $parsed_query['len']; $i++) {
                if ($parsed_query[$i]['type'] == 'alpha_reservedWord' && mb_strtoupper($parsed_query[$i]['data']) == 'RETURNS') {
                    $fetching = true;
                } else {
                    if ($fetching == true && $parsed_query[$i]['type'] == 'alpha_reservedWord') {
                        // We will not be looking for options such as UNSIGNED
                        // or ZEROFILL because there is no way that a numeric
                        // field's DTD_IDENTIFIER can be longer than 64
                        // characters. We can safely assume that the return
                        // datatype is either ENUM or SET, so we only look
                        // for CHARSET.
                        $word = mb_strtoupper($parsed_query[$i]['data']);
                        if ($word == 'CHARSET' && ($parsed_query[$i + 1]['type'] == 'alpha_charset' || $parsed_query[$i + 1]['type'] == 'alpha_identifier')) {
                            $dtd .= $word . ' ' . $parsed_query[$i + 1]['data'];
                        }
                        break;
                    } else {
                        if ($fetching == true) {
                            $dtd .= $parsed_query[$i]['data'] . ' ';
                        }
                    }
                }
            }
            $routine['DTD_IDENTIFIER'] = $dtd;
        }
        $returnparam = PMA_RTN_parseOneParameter($routine['DTD_IDENTIFIER']);
        $retval['item_returntype'] = $returnparam[2];
        $retval['item_returnlength'] = $returnparam[3];
        $retval['item_returnopts_num'] = $returnparam[4];
        $retval['item_returnopts_text'] = $returnparam[4];
    }
    $retval['item_definer'] = PMA_RTN_parseRoutineDefiner($parsed_query);
    $retval['item_definition'] = $routine['ROUTINE_DEFINITION'];
    $retval['item_isdeterministic'] = '';
    if ($routine['IS_DETERMINISTIC'] == 'YES') {
        $retval['item_isdeterministic'] = " checked='checked'";
    }
    $retval['item_securitytype_definer'] = '';
    $retval['item_securitytype_invoker'] = '';
    if ($routine['SECURITY_TYPE'] == 'DEFINER') {
        $retval['item_securitytype_definer'] = " selected='selected'";
    } else {
        if ($routine['SECURITY_TYPE'] == 'INVOKER') {
//.........这里部分代码省略.........
开发者ID:shorifulislam00,项目名称:phpmyadmin,代码行数:101,代码来源:rte_routines.lib.php

示例2: getTriggers

 /**
  * returns details about the TRIGGERs for a specific table or database
  *
  * @param string $db        db name
  * @param string $table     table name
  * @param string $delimiter the delimiter to use (may be empty)
  *
  * @return array information about triggers (may be empty)
  */
 public function getTriggers($db, $table = '', $delimiter = '//')
 {
     if (PMA_DRIZZLE) {
         // Drizzle doesn't support triggers
         return array();
     }
     $result = array();
     if (!$GLOBALS['cfg']['Server']['DisableIS']) {
         $query = 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION' . ', EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT' . ', EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER' . ' FROM information_schema.TRIGGERS' . ' WHERE EVENT_OBJECT_SCHEMA ' . PMA_Util::getCollateForIS() . '=' . ' \'' . PMA_Util::sqlAddSlashes($db) . '\'';
         if (!empty($table)) {
             $query .= " AND EVENT_OBJECT_TABLE " . PMA_Util::getCollateForIS() . " = '" . PMA_Util::sqlAddSlashes($table) . "';";
         }
     } else {
         $query = "SHOW TRIGGERS FROM " . PMA_Util::backquote($db);
         if (!empty($table)) {
             $query .= " LIKE '" . PMA_Util::sqlAddSlashes($table, true) . "';";
         }
     }
     if ($triggers = $this->fetchResult($query)) {
         foreach ($triggers as $trigger) {
             if ($GLOBALS['cfg']['Server']['DisableIS']) {
                 $trigger['TRIGGER_NAME'] = $trigger['Trigger'];
                 $trigger['ACTION_TIMING'] = $trigger['Timing'];
                 $trigger['EVENT_MANIPULATION'] = $trigger['Event'];
                 $trigger['EVENT_OBJECT_TABLE'] = $trigger['Table'];
                 $trigger['ACTION_STATEMENT'] = $trigger['Statement'];
                 $trigger['DEFINER'] = $trigger['Definer'];
             }
             $one_result = array();
             $one_result['name'] = $trigger['TRIGGER_NAME'];
             $one_result['table'] = $trigger['EVENT_OBJECT_TABLE'];
             $one_result['action_timing'] = $trigger['ACTION_TIMING'];
             $one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION'];
             $one_result['definition'] = $trigger['ACTION_STATEMENT'];
             $one_result['definer'] = $trigger['DEFINER'];
             // do not prepend the schema name; this way, importing the
             // definition into another schema will work
             $one_result['full_trigger_name'] = PMA_Util::backquote($trigger['TRIGGER_NAME']);
             $one_result['drop'] = 'DROP TRIGGER IF EXISTS ' . $one_result['full_trigger_name'];
             $one_result['create'] = 'CREATE TRIGGER ' . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING'] . ' ' . $trigger['EVENT_MANIPULATION'] . ' ON ' . PMA_Util::backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n";
             $result[] = $one_result;
         }
     }
     // Sort results by name
     $name = array();
     foreach ($result as $value) {
         $name[] = $value['name'];
     }
     array_multisort($name, SORT_ASC, $result);
     return $result;
 }
开发者ID:FuhrerMalkovich,项目名称:Blogpost,代码行数:60,代码来源:DatabaseInterface.class.php

示例3: getData

 /**
  * Returns the names of children of type $type present inside this container
  * This method is overridden by the Node_Database and Node_Table classes
  *
  * @param string $type         The type of item we are looking for
  *                             ('tables', 'views', etc)
  * @param int    $pos          The offset of the list within the results
  * @param string $searchClause A string used to filter the results of the query
  *
  * @return array
  */
 public function getData($type, $pos, $searchClause = '')
 {
     $maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
     $retval = array();
     $db = $this->realParent()->real_name;
     $table = $this->real_name;
     switch ($type) {
         case 'columns':
             if (!$GLOBALS['cfg']['Server']['DisableIS']) {
                 $db = PMA_Util::sqlAddSlashes($db);
                 $table = PMA_Util::sqlAddSlashes($table);
                 $query = "SELECT `COLUMN_NAME` AS `name` ";
                 $query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
                 $query .= "WHERE `TABLE_NAME`='{$table}' ";
                 $query .= "AND `TABLE_SCHEMA`='{$db}' ";
                 $query .= "ORDER BY `COLUMN_NAME` ASC ";
                 $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
                 $retval = $GLOBALS['dbi']->fetchResult($query);
                 break;
             }
             $db = PMA_Util::backquote($db);
             $table = PMA_Util::backquote($table);
             $query = "SHOW COLUMNS FROM {$table} FROM {$db}";
             $handle = $GLOBALS['dbi']->tryQuery($query);
             if ($handle === false) {
                 break;
             }
             $count = 0;
             if ($GLOBALS['dbi']->dataSeek($handle, $pos)) {
                 while ($arr = $GLOBALS['dbi']->fetchArray($handle)) {
                     if ($count < $maxItems) {
                         $retval[] = $arr['Field'];
                         $count++;
                     } else {
                         break;
                     }
                 }
             }
             break;
         case 'indexes':
             $db = PMA_Util::backquote($db);
             $table = PMA_Util::backquote($table);
             $query = "SHOW INDEXES FROM {$table} FROM {$db}";
             $handle = $GLOBALS['dbi']->tryQuery($query);
             if ($handle === false) {
                 break;
             }
             $count = 0;
             while ($arr = $GLOBALS['dbi']->fetchArray($handle)) {
                 if (in_array($arr['Key_name'], $retval)) {
                     continue;
                 }
                 if ($pos <= 0 && $count < $maxItems) {
                     $retval[] = $arr['Key_name'];
                     $count++;
                 }
                 $pos--;
             }
             break;
         case 'triggers':
             if (!$GLOBALS['cfg']['Server']['DisableIS']) {
                 $db = PMA_Util::sqlAddSlashes($db);
                 $table = PMA_Util::sqlAddSlashes($table);
                 $query = "SELECT `TRIGGER_NAME` AS `name` ";
                 $query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
                 $query .= "WHERE `EVENT_OBJECT_SCHEMA` " . PMA_Util::getCollateForIS() . "='{$db}' ";
                 $query .= "AND `EVENT_OBJECT_TABLE` " . PMA_Util::getCollateForIS() . "='{$table}' ";
                 $query .= "ORDER BY `TRIGGER_NAME` ASC ";
                 $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
                 $retval = $GLOBALS['dbi']->fetchResult($query);
                 break;
             }
             $db = PMA_Util::backquote($db);
             $table = PMA_Util::sqlAddSlashes($table);
             $query = "SHOW TRIGGERS FROM {$db} WHERE `Table` = '{$table}'";
             $handle = $GLOBALS['dbi']->tryQuery($query);
             if ($handle === false) {
                 break;
             }
             $count = 0;
             if ($GLOBALS['dbi']->dataSeek($handle, $pos)) {
                 while ($arr = $GLOBALS['dbi']->fetchArray($handle)) {
                     if ($count < $maxItems) {
                         $retval[] = $arr['Trigger'];
                         $count++;
                     } else {
                         break;
                     }
                 }
//.........这里部分代码省略.........
开发者ID:saisai,项目名称:phpmyadmin,代码行数:101,代码来源:Node_Table.class.php

示例4: PMA_RTN_getDataFromName

/**
 * This function will generate the values that are required to complete
 * the "Edit routine" form given the name of a routine.
 *
 * @param string $name The name of the routine.
 * @param string $type Type of routine (ROUTINE|PROCEDURE)
 * @param bool   $all  Whether to return all data or just
 *                     the info about parameters.
 *
 * @return array    Data necessary to create the routine editor.
 */
function PMA_RTN_getDataFromName($name, $type, $all = true)
{
    global $db;
    $retval = array();
    // Build and execute the query
    $fields = "SPECIFIC_NAME, ROUTINE_TYPE, DTD_IDENTIFIER, " . "ROUTINE_DEFINITION, IS_DETERMINISTIC, SQL_DATA_ACCESS, " . "ROUTINE_COMMENT, SECURITY_TYPE";
    $where = "ROUTINE_SCHEMA " . PMA_Util::getCollateForIS() . "=" . "'" . PMA_Util::sqlAddSlashes($db) . "' " . "AND SPECIFIC_NAME='" . PMA_Util::sqlAddSlashes($name) . "'" . "AND ROUTINE_TYPE='" . PMA_Util::sqlAddSlashes($type) . "'";
    $query = "SELECT {$fields} FROM INFORMATION_SCHEMA.ROUTINES WHERE {$where};";
    $routine = $GLOBALS['dbi']->fetchSingleRow($query);
    if (!$routine) {
        return false;
    }
    // Get required data
    $retval['item_name'] = $routine['SPECIFIC_NAME'];
    $retval['item_type'] = $routine['ROUTINE_TYPE'];
    $parser = new SqlParser\Parser($GLOBALS['dbi']->getDefinition($db, $routine['ROUTINE_TYPE'], $routine['SPECIFIC_NAME']));
    /**
     * @var CreateStatement $stmt
     */
    $stmt = $parser->statements[0];
    $params = SqlParser\Utils\Routine::getParameters($stmt);
    $retval['item_num_params'] = $params['num'];
    $retval['item_param_dir'] = $params['dir'];
    $retval['item_param_name'] = $params['name'];
    $retval['item_param_type'] = $params['type'];
    $retval['item_param_length'] = $params['length'];
    $retval['item_param_length_arr'] = $params['length_arr'];
    $retval['item_param_opts_num'] = $params['opts'];
    $retval['item_param_opts_text'] = $params['opts'];
    // Get extra data
    if (!$all) {
        return $retval;
    }
    if ($retval['item_type'] == 'FUNCTION') {
        $retval['item_type_toggle'] = 'PROCEDURE';
    } else {
        $retval['item_type_toggle'] = 'FUNCTION';
    }
    $retval['item_returntype'] = '';
    $retval['item_returnlength'] = '';
    $retval['item_returnopts_num'] = '';
    $retval['item_returnopts_text'] = '';
    if (!empty($routine['DTD_IDENTIFIER'])) {
        $options = array();
        foreach ($stmt->return->options->options as $opt) {
            $options[] = is_string($opt) ? $opt : $opt['value'];
        }
        $retval['item_returntype'] = $stmt->return->name;
        $retval['item_returnlength'] = implode(',', $stmt->return->size);
        $retval['item_returnopts_num'] = implode(' ', $options);
        $retval['item_returnopts_text'] = implode(' ', $options);
    }
    $retval['item_definer'] = $stmt->options->has('DEFINER');
    $retval['item_definition'] = $routine['ROUTINE_DEFINITION'];
    $retval['item_isdeterministic'] = '';
    if ($routine['IS_DETERMINISTIC'] == 'YES') {
        $retval['item_isdeterministic'] = " checked='checked'";
    }
    $retval['item_securitytype_definer'] = '';
    $retval['item_securitytype_invoker'] = '';
    if ($routine['SECURITY_TYPE'] == 'DEFINER') {
        $retval['item_securitytype_definer'] = " selected='selected'";
    } else {
        if ($routine['SECURITY_TYPE'] == 'INVOKER') {
            $retval['item_securitytype_invoker'] = " selected='selected'";
        }
    }
    $retval['item_sqldataaccess'] = $routine['SQL_DATA_ACCESS'];
    $retval['item_comment'] = $routine['ROUTINE_COMMENT'];
    return $retval;
}
开发者ID:BrunoChauvet,项目名称:phpmyadmin,代码行数:82,代码来源:rte_routines.lib.php

示例5: _getEvents

 /**
  * Returns the list of events inside this database
  *
  * @param int    $pos          The offset of the list within the results
  * @param string $searchClause A string used to filter the results of the query
  *
  * @return array
  */
 private function _getEvents($pos, $searchClause)
 {
     $maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
     $retval = array();
     $db = $this->real_name;
     if (!$GLOBALS['cfg']['Server']['DisableIS']) {
         $escdDb = PMA_Util::sqlAddSlashes($db);
         $query = "SELECT `EVENT_NAME` AS `name` ";
         $query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
         $query .= "WHERE `EVENT_SCHEMA` " . PMA_Util::getCollateForIS() . "='{$escdDb}' ";
         if (!empty($searchClause)) {
             $query .= "AND `EVENT_NAME` LIKE '%";
             $query .= PMA_Util::sqlAddSlashes($searchClause, true);
             $query .= "%'";
         }
         $query .= "ORDER BY `EVENT_NAME` ASC ";
         $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
         $retval = $GLOBALS['dbi']->fetchResult($query);
     } else {
         $escdDb = PMA_Util::backquote($db);
         $query = "SHOW EVENTS FROM {$escdDb} ";
         if (!empty($searchClause)) {
             $query .= "WHERE `Name` LIKE '%";
             $query .= PMA_Util::sqlAddSlashes($searchClause, true);
             $query .= "%'";
         }
         $handle = $GLOBALS['dbi']->tryQuery($query);
         if ($handle !== false) {
             $count = 0;
             while ($arr = $GLOBALS['dbi']->fetchArray($handle)) {
                 if ($pos <= 0 && $count < $maxItems) {
                     $retval[] = $arr['Name'];
                     $count++;
                 }
                 $pos--;
             }
         }
     }
     return $retval;
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:48,代码来源:Node_Database.class.php

示例6: PMA_EVN_getDataFromName

/**
 * This function will generate the values that are required to complete
 * the "Edit event" form given the name of a event.
 *
 * @param string $name The name of the event.
 *
 * @return array Data necessary to create the editor.
 */
function PMA_EVN_getDataFromName($name)
{
    global $db;
    $retval = array();
    $columns = "`EVENT_NAME`, `STATUS`, `EVENT_TYPE`, `EXECUTE_AT`, " . "`INTERVAL_VALUE`, `INTERVAL_FIELD`, `STARTS`, `ENDS`, " . "`EVENT_DEFINITION`, `ON_COMPLETION`, `DEFINER`, `EVENT_COMMENT`";
    $where = "EVENT_SCHEMA " . PMA_Util::getCollateForIS() . "=" . "'" . PMA_Util::sqlAddSlashes($db) . "' " . "AND EVENT_NAME='" . PMA_Util::sqlAddSlashes($name) . "'";
    $query = "SELECT {$columns} FROM `INFORMATION_SCHEMA`.`EVENTS` WHERE {$where};";
    $item = $GLOBALS['dbi']->fetchSingleRow($query);
    if (!$item) {
        return false;
    }
    $retval['item_name'] = $item['EVENT_NAME'];
    $retval['item_status'] = $item['STATUS'];
    $retval['item_type'] = $item['EVENT_TYPE'];
    if ($retval['item_type'] == 'RECURRING') {
        $retval['item_type_toggle'] = 'ONE TIME';
    } else {
        $retval['item_type_toggle'] = 'RECURRING';
    }
    $retval['item_execute_at'] = $item['EXECUTE_AT'];
    $retval['item_interval_value'] = $item['INTERVAL_VALUE'];
    $retval['item_interval_field'] = $item['INTERVAL_FIELD'];
    $retval['item_starts'] = $item['STARTS'];
    $retval['item_ends'] = $item['ENDS'];
    $retval['item_preserve'] = '';
    if ($item['ON_COMPLETION'] == 'PRESERVE') {
        $retval['item_preserve'] = " checked='checked'";
    }
    $retval['item_definition'] = $item['EVENT_DEFINITION'];
    $retval['item_definer'] = $item['DEFINER'];
    $retval['item_comment'] = $item['EVENT_COMMENT'];
    return $retval;
}
开发者ID:mercysmart,项目名称:naikelas,代码行数:41,代码来源:rte_events.lib.php

示例7: getTriggers

 /**
  * returns details about the TRIGGERs for a specific table or database
  *
  * @param string $db        db name
  * @param string $table     table name
  * @param string $delimiter the delimiter to use (may be empty)
  *
  * @return array information about triggers (may be empty)
  */
 public function getTriggers($db, $table = '', $delimiter = '//')
 {
     if (PMA_DRIZZLE) {
         // Drizzle doesn't support triggers
         return array();
     }
     $result = array();
     // Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
     // their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
     // instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
     $query = 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION' . ', EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT' . ', EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER' . ' FROM information_schema.TRIGGERS' . ' WHERE TRIGGER_SCHEMA ' . PMA_Util::getCollateForIS() . '=' . ' \'' . PMA_Util::sqlAddSlashes($db) . '\'';
     if (!empty($table)) {
         $query .= " AND EVENT_OBJECT_TABLE = '" . PMA_Util::sqlAddSlashes($table) . "';";
     }
     if ($triggers = $this->fetchResult($query)) {
         foreach ($triggers as $trigger) {
             $one_result = array();
             $one_result['name'] = $trigger['TRIGGER_NAME'];
             $one_result['table'] = $trigger['EVENT_OBJECT_TABLE'];
             $one_result['action_timing'] = $trigger['ACTION_TIMING'];
             $one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION'];
             $one_result['definition'] = $trigger['ACTION_STATEMENT'];
             $one_result['definer'] = $trigger['DEFINER'];
             // do not prepend the schema name; this way, importing the
             // definition into another schema will work
             $one_result['full_trigger_name'] = PMA_Util::backquote($trigger['TRIGGER_NAME']);
             $one_result['drop'] = 'DROP TRIGGER IF EXISTS ' . $one_result['full_trigger_name'];
             $one_result['create'] = 'CREATE TRIGGER ' . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING'] . ' ' . $trigger['EVENT_MANIPULATION'] . ' ON ' . PMA_Util::backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n";
             $result[] = $one_result;
         }
     }
     // Sort results by name
     $name = array();
     foreach ($result as $value) {
         $name[] = $value['name'];
     }
     array_multisort($name, SORT_ASC, $result);
     return $result;
 }
开发者ID:JaRomero95,项目名称:dwes,代码行数:48,代码来源:DatabaseInterface.class.php

示例8: getData

 /**
  * Returns the names of children of type $type present inside this container
  * This method is overridden by the Node_Database and Node_Table classes
  *
  * @param string $type         The type of item we are looking for
  *                             ('tables', 'views', etc)
  * @param int    $pos          The offset of the list within the results
  * @param string $searchClause A string used to filter the results of the query
  *
  * @return array
  */
 public function getData($type, $pos, $searchClause = '')
 {
     $maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
     $retval = array();
     $db = $this->real_name;
     switch ($type) {
         case 'tables':
             $escdDb = PMA_Util::sqlAddSlashes($db);
             $query = "SELECT `TABLE_NAME` AS `name` ";
             $query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
             $query .= "WHERE `TABLE_SCHEMA`='{$escdDb}' ";
             if (PMA_DRIZZLE) {
                 $query .= "AND `TABLE_TYPE`='BASE' ";
             } else {
                 $query .= "AND `TABLE_TYPE`='BASE TABLE' ";
             }
             if (!empty($searchClause)) {
                 $query .= "AND `TABLE_NAME` LIKE '%";
                 $query .= PMA_Util::sqlAddSlashes($searchClause, true);
                 $query .= "%'";
             }
             $query .= "ORDER BY `TABLE_NAME` ASC ";
             $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
             $retval = $GLOBALS['dbi']->fetchResult($query);
             break;
         case 'views':
             $escdDb = PMA_Util::sqlAddSlashes($db);
             $query = "SELECT `TABLE_NAME` AS `name` ";
             $query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
             $query .= "WHERE `TABLE_SCHEMA`='{$escdDb}' ";
             if (PMA_DRIZZLE) {
                 $query .= "AND `TABLE_TYPE`!='BASE' ";
             } else {
                 $query .= "AND `TABLE_TYPE`!='BASE TABLE' ";
             }
             if (!empty($searchClause)) {
                 $query .= "AND `TABLE_NAME` LIKE '%";
                 $query .= PMA_Util::sqlAddSlashes($searchClause, true);
                 $query .= "%'";
             }
             $query .= "ORDER BY `TABLE_NAME` ASC ";
             $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
             $retval = $GLOBALS['dbi']->fetchResult($query);
             break;
         case 'procedures':
             $escdDb = PMA_Util::sqlAddSlashes($db);
             $query = "SELECT `ROUTINE_NAME` AS `name` ";
             $query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
             $query .= "WHERE `ROUTINE_SCHEMA` " . PMA_Util::getCollateForIS() . "='{$escdDb}'";
             $query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
             if (!empty($searchClause)) {
                 $query .= "AND `ROUTINE_NAME` LIKE '%";
                 $query .= PMA_Util::sqlAddSlashes($searchClause, true);
                 $query .= "%'";
             }
             $query .= "ORDER BY `ROUTINE_NAME` ASC ";
             $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
             $retval = $GLOBALS['dbi']->fetchResult($query);
             break;
         case 'functions':
             $escdDb = PMA_Util::sqlAddSlashes($db);
             $query = "SELECT `ROUTINE_NAME` AS `name` ";
             $query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
             $query .= "WHERE `ROUTINE_SCHEMA` " . PMA_Util::getCollateForIS() . "='{$escdDb}' ";
             $query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
             if (!empty($searchClause)) {
                 $query .= "AND `ROUTINE_NAME` LIKE '%";
                 $query .= PMA_Util::sqlAddSlashes($searchClause, true);
                 $query .= "%'";
             }
             $query .= "ORDER BY `ROUTINE_NAME` ASC ";
             $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
             $retval = $GLOBALS['dbi']->fetchResult($query);
             break;
         case 'events':
             $escdDb = PMA_Util::sqlAddSlashes($db);
             $query = "SELECT `EVENT_NAME` AS `name` ";
             $query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
             $query .= "WHERE `EVENT_SCHEMA` " . PMA_Util::getCollateForIS() . "='{$escdDb}' ";
             if (!empty($searchClause)) {
                 $query .= "AND `EVENT_NAME` LIKE '%";
                 $query .= PMA_Util::sqlAddSlashes($searchClause, true);
                 $query .= "%'";
             }
             $query .= "ORDER BY `EVENT_NAME` ASC ";
             $query .= "LIMIT " . intval($pos) . ", {$maxItems}";
             $retval = $GLOBALS['dbi']->fetchResult($query);
             break;
         default:
//.........这里部分代码省略.........
开发者ID:JaRomero95,项目名称:dwes,代码行数:101,代码来源:Node_Database.class.php


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