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


PHP Util::printableBitValue方法代码示例

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


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

示例1: getDataRowAction

 /**
  * Get data row action
  *
  * @return void
  */
 public function getDataRowAction()
 {
     $extra_data = array();
     $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`' . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause'];
     $result = $this->dbi->query($row_info_query . ";", null, DatabaseInterface::QUERY_STORE);
     $fields_meta = $this->dbi->getFieldsMeta($result);
     while ($row = $this->dbi->fetchAssoc($result)) {
         // for bit fields we need to convert them to printable form
         $i = 0;
         foreach ($row as $col => $val) {
             if ($fields_meta[$i]->type == 'bit') {
                 $row[$col] = Util::printableBitValue($val, $fields_meta[$i]->length);
             }
             $i++;
         }
         $extra_data['row_info'] = $row;
     }
     $this->response->addJSON($extra_data);
 }
开发者ID:rclakmal,项目名称:phpmyadmin,代码行数:24,代码来源:TableSearchController.php

示例2: _getDataCellForNonNumericColumns

 /**
  * Get data cell for non numeric type fields
  *
  * @param string        $column                the relevant column in data row
  * @param string        $class                 the html class for column
  * @param object        $meta                  the meta-information about
  *                                             the field
  * @param array         $map                   the list of relations
  * @param array         $_url_params           the parameters for generate
  *                                             url
  * @param boolean       $condition_field       the column should highlighted
  *                                             or not
  * @param object|string $transformation_plugin the name of transformation
  *                                             function
  * @param string        $default_function      the default transformation
  *                                             function
  * @param string        $transform_options     the transformation parameters
  * @param boolean       $is_field_truncated    is data truncated due to
  *                                             LimitChars
  * @param array         $analyzed_sql_results  the analyzed query
  * @param integer       &$dt_result            the link id associated to
  *                                             the query which results
  *                                             have to be displayed
  * @param integer       $col_index             the column index
  *
  * @return  string  $cell the prepared data cell, html content
  *
  * @access  private
  *
  * @see     _getTableBody()
  */
 private function _getDataCellForNonNumericColumns($column, $class, $meta, $map, $_url_params, $condition_field, $transformation_plugin, $default_function, $transform_options, $is_field_truncated, $analyzed_sql_results, &$dt_result, $col_index)
 {
     $original_length = 0;
     $is_analyse = $this->__get('is_analyse');
     $field_flags = $GLOBALS['dbi']->fieldFlags($dt_result, $col_index);
     $bIsText = gettype($transformation_plugin) === 'object' && strpos($transformation_plugin->getMIMEtype(), 'Text') === false;
     // disable inline grid editing
     // if binary fields are protected
     // or transformation plugin is of non text type
     // such as image
     if (stristr($field_flags, self::BINARY_FIELD) && ($GLOBALS['cfg']['ProtectBinary'] === 'all' || $GLOBALS['cfg']['ProtectBinary'] === 'noblob' && !stristr($meta->type, self::BLOB_FIELD) || $GLOBALS['cfg']['ProtectBinary'] === 'blob' && stristr($meta->type, self::BLOB_FIELD)) || $bIsText) {
         $class = str_replace('grid_edit', '', $class);
     }
     if (!isset($column) || is_null($column)) {
         $cell = $this->_buildNullDisplay($class, $condition_field, $meta);
         return $cell;
     }
     if ($column == '') {
         $cell = $this->_buildEmptyDisplay($class, $condition_field, $meta);
         return $cell;
     }
     // Cut all fields to $GLOBALS['cfg']['LimitChars']
     // (unless it's a link-type transformation or binary)
     if (!(gettype($transformation_plugin) === "object" && strpos($transformation_plugin->getName(), 'Link') !== false) && !stristr($field_flags, self::BINARY_FIELD)) {
         list($is_field_truncated, $column, $original_length) = $this->_getPartialText($column);
     }
     $formatted = false;
     if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
         $column = Util::printableBitValue($column, $meta->length);
         // some results of PROCEDURE ANALYSE() are reported as
         // being BINARY but they are quite readable,
         // so don't treat them as BINARY
     } elseif (stristr($field_flags, self::BINARY_FIELD) && !(isset($is_analyse) && $is_analyse)) {
         // we show the BINARY or BLOB message and field's size
         // (or maybe use a transformation)
         $binary_or_blob = self::BLOB_FIELD;
         if ($meta->type === self::STRING_FIELD) {
             $binary_or_blob = self::BINARY_FIELD;
         }
         $column = $this->_handleNonPrintableContents($binary_or_blob, $column, $transformation_plugin, $transform_options, $default_function, $meta, $_url_params, $is_field_truncated);
         $class = $this->_addClass($class, $condition_field, $meta, '', $is_field_truncated, $transformation_plugin, $default_function);
         $result = strip_tags($column);
         // disable inline grid editing
         // if binary or blob data is not shown
         if (stristr($result, $binary_or_blob)) {
             $class = str_replace('grid_edit', '', $class);
         }
         $formatted = true;
     }
     if ($formatted) {
         $cell = $this->_buildValueDisplay($class, $condition_field, $column);
         return $cell;
     }
     // transform functions may enable no-wrapping:
     $function_nowrap = 'applyTransformationNoWrap';
     $bool_nowrap = $default_function != $transformation_plugin && function_exists($transformation_plugin->{$function_nowrap}()) ? $transformation_plugin->{$function_nowrap}($transform_options) : false;
     // do not wrap if date field type
     $nowrap = preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap ? ' nowrap' : '';
     $where_comparison = ' = \'' . Util::sqlAddSlashes($column) . '\'';
     $cell = $this->_getRowData($class, $condition_field, $analyzed_sql_results, $meta, $map, $column, $transformation_plugin, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated, $original_length);
     return $cell;
 }
开发者ID:rugbyprof,项目名称:phpmyadmin,代码行数:93,代码来源:DisplayResults.php

示例3: exportData


//.........这里部分代码省略.........
         // We need to SET IDENTITY_INSERT ON for MSSQL
         if (isset($GLOBALS['sql_compatibility']) && $GLOBALS['sql_compatibility'] == 'MSSQL' && $current_row == 0) {
             if (!PMA_exportOutputHandler('SET IDENTITY_INSERT ' . Util::backquoteCompat($table_alias, $compat, $sql_backquotes) . ' ON ;' . $crlf)) {
                 return false;
             }
         }
         $current_row++;
         $values = array();
         for ($j = 0; $j < $fields_cnt; $j++) {
             // NULL
             if (!isset($row[$j]) || is_null($row[$j])) {
                 $values[] = 'NULL';
             } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && !$fields_meta[$j]->blob) {
                 // a number
                 // timestamp is numeric on some MySQL 4.1, BLOBs are
                 // sometimes numeric
                 $values[] = $row[$j];
             } elseif (stristr($field_flags[$j], 'BINARY') !== false && isset($GLOBALS['sql_hex_for_binary'])) {
                 // a true BLOB
                 // - mysqldump only generates hex data when the --hex-blob
                 //   option is used, for fields having the binary attribute
                 //   no hex is generated
                 // - a TEXT field returns type blob but a real blob
                 //   returns also the 'binary' flag
                 // empty blobs need to be different, but '0' is also empty
                 // :-(
                 if (empty($row[$j]) && $row[$j] != '0') {
                     $values[] = '\'\'';
                 } else {
                     $values[] = '0x' . bin2hex($row[$j]);
                 }
             } elseif ($fields_meta[$j]->type == 'bit') {
                 // detection of 'bit' works only on mysqli extension
                 $values[] = "b'" . Util::sqlAddSlashes(Util::printableBitValue($row[$j], $fields_meta[$j]->length)) . "'";
             } elseif (!empty($GLOBALS['exporting_metadata']) && $row[$j] == '@LAST_PAGE') {
                 $values[] = '@LAST_PAGE';
             } else {
                 // something else -> treat as a string
                 $values[] = '\'' . str_replace($search, $replace, Util::sqlAddSlashes($row[$j])) . '\'';
             }
             // end if
         }
         // end for
         // should we make update?
         if (isset($GLOBALS['sql_type']) && $GLOBALS['sql_type'] == 'UPDATE') {
             $insert_line = $schema_insert;
             for ($i = 0; $i < $fields_cnt; $i++) {
                 if (0 == $i) {
                     $insert_line .= ' ';
                 }
                 if ($i > 0) {
                     // avoid EOL blank
                     $insert_line .= ',';
                 }
                 $insert_line .= $field_set[$i] . ' = ' . $values[$i];
             }
             list($tmp_unique_condition, $tmp_clause_is_unique) = Util::getUniqueCondition($result, $fields_cnt, $fields_meta, $row, false, false, null);
             $insert_line .= ' WHERE ' . $tmp_unique_condition;
             unset($tmp_unique_condition, $tmp_clause_is_unique);
         } else {
             // Extended inserts case
             if ($GLOBALS['sql_insert_syntax'] == 'extended' || $GLOBALS['sql_insert_syntax'] == 'both') {
                 if ($current_row == 1) {
                     $insert_line = $schema_insert . '(' . implode(', ', $values) . ')';
                 } else {
                     $insert_line = '(' . implode(', ', $values) . ')';
开发者ID:ryanfmurphy,项目名称:phpmyadmin,代码行数:67,代码来源:ExportSql.php


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