Geen cache-versie.


Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code DEF204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

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.

Inhoudsopgave 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);

Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-sys-sys-get-config.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut