Keine Cache-Version


Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code DEF204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.

Rechercher dans le manuel MySQL

27.4.5.19 The sys_get_config() Function

Given a configuration option name, returns the option value from the sys_config table, or the provided default value (which may be NULL) if the option does not exist in the table.

If sys_get_config() returns the default value and that value is NULL, it is expected that the caller is able to handle NULL for the given configuration option.

By convention, routines that call sys_get_config() first check whether the corresponding user-defined variable exists and is non-NULL. If so, the routine uses the variable value without reading the sys_config table. If the variable does not exist or is NULL, the routine reads the option value from the table and sets the user-defined variable to that value. For more information about the relationship between configuration options and their corresponding user-defined variables, see Section 27.4.2.1, “The sys_config Table”.

If you want to check whether the configuration option has already been set and, if not, use the return value of sys_get_config(), you can use IFNULL(...) (see example later). However, this should not be done inside a loop (for example, for each row in a result set) because for repeated calls where the assignment is needed only in the first iteration, using IFNULL(...) is expected to be significantly slower than using an IF (...) THEN ... END IF; block (see example later).

Parameters
  • in_variable_name VARCHAR(128): The name of the configuration option for which to return the value.

  • in_default_value VARCHAR(128): The default value to return if the configuration option is not found in the sys_config table.

Inhaltsverzeichnis Haut

Return Value

A VARCHAR(128) value.

Get a configuration value from the sys_config table, falling back to 128 as the default if the option is not present in the table:

  1. mysql> SELECT sys.sys_get_config('statement_truncate_len', 128) AS Value;
  2. +-------+
  3. | Value |
  4. +-------+
  5. | 64    |
  6. +-------+

One-liner example: Check whether the option is already set; if not, assign the IFNULL(...) result (using the value from the sys_config table):

  1. mysql> SET @sys.statement_truncate_len =
  2.        IFNULL(@sys.statement_truncate_len,
  3.               sys.sys_get_config('statement_truncate_len', 64));

IF (...) THEN ... END IF; block example: Check whether the option is already set; if not, assign the value from the sys_config table:

  1. IF (@sys.statement_truncate_len IS NULL) THEN
  2.   SET @sys.statement_truncate_len = sys.sys_get_config('statement_truncate_len', 64);

Suchen Sie im MySQL-Handbuch

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-sys-sys-get-config.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:en Manuel MySQL : https://dev.mysql.com/

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut