No cache version.


Caching disabled. Default setting for this page:enabled (code DEF204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher dans le manuel MySQL

27.4.5.5 The format_statement() Function

Given a string (normally representing an SQL statement), reduces it to the length given by the statement_truncate_len configuration option, and returns the result. No truncation occurs if the string is shorter than statement_truncate_len. Otherwise, the middle part of the string is replaced by an ellipsis (...).

This function is useful for formatting possibly lengthy statements retrieved from Performance Schema tables to a known fixed maximum length.

Parameters
  • statement LONGTEXT: The statement to format.

Contents Haut

Configuration Options

format_statement() operation can be modified using the following configuration options or their corresponding user-defined variables (see Section 27.4.2.1, “The sys_config Table”):

  • statement_truncate_len, @sys.statement_truncate_len

    The maximum length of statements returned by the format_statement() function. Longer statements are truncated to this length. The default is 64.

Contents Haut

Return Value

A LONGTEXT value.

Contents Haut

Example

By default, format_statement() truncates statements to be no more than 64 characters. Setting @sys.statement_truncate_len changes the truncation length for the current session:

  1. mysql> SET @stmt = 'SELECT variable, value, set_time, set_by FROM sys_config';
  2. mysql> SELECT sys.format_statement(@stmt);
  3. +----------------------------------------------------------+
  4. | sys.format_statement(@stmt)                              |
  5. +----------------------------------------------------------+
  6. | SELECT variable, value, set_time, set_by FROM sys_config |
  7. +----------------------------------------------------------+
  8. mysql> SET @sys.statement_truncate_len = 32;
  9. mysql> SELECT sys.format_statement(@stmt);
  10. +-----------------------------------+
  11. | sys.format_statement(@stmt)       |
  12. +-----------------------------------+
  13. | SELECT variabl ... ROM sys_config |
  14. +-----------------------------------+

Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-sys-format-statement.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut