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


PHP Util::unQuote方法代码示例

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


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

示例1: _getSortedColumnMessage

 /**
  * Prepare sorted column message
  *
  * @param integer &$dt_result                  the link id associated to the
  *                                              query which results have to
  *                                              be displayed
  * @param string  $sort_expression_nodirection sort expression without direction
  *
  * @return  string                              html content
  *          null                                if not found sorted column
  *
  * @access  private
  *
  * @see     getTable()
  */
 private function _getSortedColumnMessage(&$dt_result, $sort_expression_nodirection)
 {
     $fields_meta = $this->__get('fields_meta');
     // To use array indexes
     if (empty($sort_expression_nodirection)) {
         return null;
     }
     if (mb_strpos($sort_expression_nodirection, '.') === false) {
         $sort_table = $this->__get('table');
         $sort_column = $sort_expression_nodirection;
     } else {
         list($sort_table, $sort_column) = explode('.', $sort_expression_nodirection);
     }
     $sort_table = Util::unQuote($sort_table);
     $sort_column = Util::unQuote($sort_column);
     // find the sorted column index in row result
     // (this might be a multi-table query)
     $sorted_column_index = false;
     foreach ($fields_meta as $key => $meta) {
         if ($meta->table == $sort_table && $meta->name == $sort_column) {
             $sorted_column_index = $key;
             break;
         }
     }
     if ($sorted_column_index === false) {
         return null;
     }
     // fetch first row of the result set
     $row = $GLOBALS['dbi']->fetchRow($dt_result);
     // initializing default arguments
     $default_function = 'PMA_mimeDefaultFunction';
     $transformation_plugin = $default_function;
     $transform_options = array();
     // check for non printable sorted row data
     $meta = $fields_meta[$sorted_column_index];
     if (stristr($meta->type, self::BLOB_FIELD) || $meta->type == self::GEOMETRY_FIELD) {
         $column_for_first_row = $this->_handleNonPrintableContents($meta->type, $row[$sorted_column_index], $transformation_plugin, $transform_options, $default_function, $meta);
     } else {
         $column_for_first_row = $row[$sorted_column_index];
     }
     $column_for_first_row = mb_strtoupper(mb_substr($column_for_first_row, 0, $GLOBALS['cfg']['LimitChars']) . '...');
     // fetch last row of the result set
     $GLOBALS['dbi']->dataSeek($dt_result, $this->__get('num_rows') - 1);
     $row = $GLOBALS['dbi']->fetchRow($dt_result);
     // check for non printable sorted row data
     $meta = $fields_meta[$sorted_column_index];
     if (stristr($meta->type, self::BLOB_FIELD) || $meta->type == self::GEOMETRY_FIELD) {
         $column_for_last_row = $this->_handleNonPrintableContents($meta->type, $row[$sorted_column_index], $transformation_plugin, $transform_options, $default_function, $meta);
     } else {
         $column_for_last_row = $row[$sorted_column_index];
     }
     $column_for_last_row = mb_strtoupper(mb_substr($column_for_last_row, 0, $GLOBALS['cfg']['LimitChars']) . '...');
     // reset to first row for the loop in _getTableBody()
     $GLOBALS['dbi']->dataSeek($dt_result, 0);
     // we could also use here $sort_expression_nodirection
     return ' [' . htmlspecialchars($sort_column) . ': <strong>' . htmlspecialchars($column_for_first_row) . ' - ' . htmlspecialchars($column_for_last_row) . '</strong>]';
 }
开发者ID:rugbyprof,项目名称:phpmyadmin,代码行数:72,代码来源:DisplayResults.php

示例2: PMA_isTableTransactional

/**
 * Checks if a table is 'InnoDB' or not.
 *
 * @param string $table Table details
 *
 * @return bool
 */
function PMA_isTableTransactional($table)
{
    $table = explode('.', $table);
    if (count($table) == 2) {
        $db = PMA\libraries\Util::unQuote($table[0]);
        $table = PMA\libraries\Util::unQuote($table[1]);
    } else {
        $db = $GLOBALS['db'];
        $table = PMA\libraries\Util::unQuote($table[0]);
    }
    // Query to check if table exists.
    $check_table_query = 'SELECT * FROM ' . PMA\libraries\Util::backquote($db) . '.' . PMA\libraries\Util::backquote($table) . ' ' . 'LIMIT 1';
    $result = $GLOBALS['dbi']->tryQuery($check_table_query);
    if (!$result) {
        return false;
    }
    // List of Transactional Engines.
    $transactional_engines = array('INNODB', 'FALCON', 'NDB', 'INFINIDB', 'TOKUDB', 'XTRADB', 'SEQUENCE', 'BDB');
    // Query to check if table is 'Transactional'.
    $check_query = 'SELECT `ENGINE` FROM `information_schema`.`tables` ' . 'WHERE `table_name` = "' . $table . '" ' . 'AND `table_schema` = "' . $db . '" ' . 'AND UPPER(`engine`) IN ("' . implode('", "', $transactional_engines) . '")';
    $result = $GLOBALS['dbi']->tryQuery($check_query);
    if ($GLOBALS['dbi']->numRows($result) == 1) {
        return true;
    } else {
        return false;
    }
}
开发者ID:netroby,项目名称:phpmyadmin,代码行数:34,代码来源:import.lib.php


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