本文整理汇总了PHP中PMA_Util::addMicroseconds方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::addMicroseconds方法的具体用法?PHP PMA_Util::addMicroseconds怎么用?PHP PMA_Util::addMicroseconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::addMicroseconds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_verifyWhetherValueCanBeTruncatedAndAppendExtraData
/**
* Check whether inline edited value can be truncated or not,
* and add additional parameters for extra_data array if needed
*
* @param string $db Database name
* @param string $table Table name
* @param string $column_name Column name
* @param array &$extra_data Extra data for ajax response
*
* @return void
*/
function PMA_verifyWhetherValueCanBeTruncatedAndAppendExtraData($db, $table, $column_name, &$extra_data)
{
$extra_data['isNeedToRecheck'] = false;
$sql_for_real_value = 'SELECT ' . PMA_Util::backquote($table) . '.' . PMA_Util::backquote($column_name) . ' FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . ' WHERE ' . $_REQUEST['where_clause'][0];
$result = $GLOBALS['dbi']->tryQuery($sql_for_real_value);
$fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
$meta = $fields_meta[0];
if ($row = $GLOBALS['dbi']->fetchRow($result)) {
$new_value = $row[0];
if (substr($meta->type, 0, 9) == 'timestamp' || $meta->type == 'datetime' || $meta->type == 'time') {
$new_value = PMA_Util::addMicroseconds($new_value);
}
$extra_data['isNeedToRecheck'] = true;
$extra_data['truncatableFieldValue'] = $new_value;
}
$GLOBALS['dbi']->freeResult($result);
}
示例2: _getDataCellForNonNumericAndNonBlobColumns
/**
* Get data cell for non numeric and non blob 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 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 the condition for blob data
* replacements
* @param array $analyzed_sql 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 _getDataCellForNonNumericAndNonBlobColumns($column, $class, $meta, $map, $_url_params, $condition_field, $transformation_plugin, $default_function, $transform_options, $is_field_truncated, $analyzed_sql, &$dt_result, $col_index)
{
$limitChars = $GLOBALS['cfg']['LimitChars'];
$is_analyse = $this->__get('is_analyse');
$field_flags = $GLOBALS['dbi']->fieldFlags($dt_result, $col_index);
if (stristr($field_flags, self::BINARY_FIELD) && ($GLOBALS['cfg']['ProtectBinary'] == 'all' || $GLOBALS['cfg']['ProtectBinary'] == 'noblob')) {
$class = str_replace('grid_edit', '', $class);
}
if (!isset($column) || is_null($column)) {
$cell = $this->_buildNullDisplay($class, $condition_field, $meta);
} elseif ($column != '') {
// Cut all fields to $GLOBALS['cfg']['LimitChars']
// (unless it's a link-type transformation)
if ($GLOBALS['PMA_String']->strlen($column) > $limitChars && $_SESSION['tmpval']['pftext'] == self::DISPLAY_PARTIAL_TEXT && !(gettype($transformation_plugin) == "object" && strpos($transformation_plugin->getName(), 'Link') !== false)) {
$column = $GLOBALS['PMA_String']->substr($column, 0, $GLOBALS['cfg']['LimitChars']) . '...';
$is_field_truncated = true;
}
$formatted = false;
if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
$column = PMA_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) && $meta->type == self::STRING_FIELD && !(isset($is_analyse) && $is_analyse)) {
if ($_SESSION['tmpval']['display_binary']) {
// user asked to see the real contents of BINARY
// fields
$column = $this->_displayBinaryAsPrintable($column, 'binary');
} else {
// we show the BINARY message and field's size
// (or maybe use a transformation)
$column = $this->_handleNonPrintableContents(self::BINARY_FIELD, $column, $transformation_plugin, $transform_options, $default_function, $meta, $_url_params);
$formatted = true;
}
} elseif ((substr($meta->type, 0, 9) == self::TIMESTAMP_FIELD || $meta->type == self::DATETIME_FIELD || $meta->type == self::TIME_FIELD || $meta->type == self::TIME_FIELD) && strpos($column, ".") === true) {
$column = PMA_Util::addMicroseconds($column);
}
if ($formatted) {
$cell = $this->_buildValueDisplay($class, $condition_field, $column);
} else {
// 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 = ' = \'' . PMA_Util::sqlAddSlashes($column) . '\'';
$cell = $this->_getRowData($class, $condition_field, $analyzed_sql, $meta, $map, $column, $transformation_plugin, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
}
} else {
$cell = $this->_buildEmptyDisplay($class, $condition_field, $meta);
}
return $cell;
}
示例3: _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 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, &$dt_result, $col_index)
{
$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)) {
$is_field_truncated = $this->_getPartialText($column);
}
$formatted = false;
if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
$column = PMA_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;
} elseif ((substr($meta->type, 0, 9) == self::TIMESTAMP_FIELD || $meta->type == self::DATETIME_FIELD || $meta->type == self::TIME_FIELD) && mb_strpos($column, ".") !== false) {
$column = PMA_Util::addMicroseconds($column);
}
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 = ' = \'' . PMA_Util::sqlAddSlashes($column) . '\'';
$cell = $this->_getRowData($class, $condition_field, $analyzed_sql, $meta, $map, $column, $transformation_plugin, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
return $cell;
}