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

5.6.6.4 Version Tokens Reference

The following discussion serves as a reference to these Version Tokens components:

Version Tokens Functions

The Version Tokens plugin library includes several user-defined functions. One set of UDFs permits the server's list of version tokens to be manipulated and inspected. Another set of UDFs permits version tokens to be locked and unlocked. The VERSION_TOKEN_ADMIN or SUPER privilege is required to invoke any Version Tokens UDF.

The following UDFs permit the server's list of version tokens to be created, changed, removed, and inspected. Interpretation of name_list and token_list arguments (including whitespace handling) occurs as described in Section 5.6.6.3, “Using Version Tokens”, which provides details about the syntax for specifying tokens, as well as additional examples.

  • version_tokens_delete(name_list)

    Deletes tokens from the server's list of version tokens using the name_list argument and returns a binary string that indicates the outcome of the operation. name_list is a semicolon-separated list of version token names to delete.

    1. mysql> SELECT version_tokens_delete('tok1;tok3');
    2. +------------------------------------+
    3. | version_tokens_delete('tok1;tok3') |
    4. +------------------------------------+
    5. | 2 version tokens deleted.          |
    6. +------------------------------------+

    An argument of NULL is treated as an empty string, which has no effect on the token list.

    version_tokens_delete() deletes the tokens named in its argument, if they exist. (It is not an error to delete nonexisting tokens.) To clear the token list entirely without knowing which tokens are in the list, pass NULL or a string containing no tokens to version_tokens_set():

    1. mysql> SELECT version_tokens_set(NULL);
    2. +------------------------------+
    3. | version_tokens_set(NULL)     |
    4. +------------------------------+
    5. | Version tokens list cleared. |
    6. +------------------------------+
    7. mysql> SELECT version_tokens_set('');
    8. +------------------------------+
    9. | version_tokens_set('')       |
    10. +------------------------------+
    11. | Version tokens list cleared. |
    12. +------------------------------+
  • version_tokens_edit(token_list)

    Modifies the server's list of version tokens using the token_list argument and returns a binary string that indicates the outcome of the operation. token_list is a semicolon-separated list of name=value pairs specifying the name of each token to be defined and its value. If a token exists, its value is updated with the given value. If a token does not exist, it is created with the given value. If the argument is NULL or a string containing no tokens, the token list remains unchanged.

    1. mysql> SELECT version_tokens_set('tok1=value1;tok2=value2');
    2. +-----------------------------------------------+
    3. | version_tokens_set('tok1=value1;tok2=value2') |
    4. +-----------------------------------------------+
    5. | 2 version tokens set.                         |
    6. +-----------------------------------------------+
    7. mysql> SELECT version_tokens_edit('tok2=new_value2;tok3=new_value3');
    8. +--------------------------------------------------------+
    9. | version_tokens_edit('tok2=new_value2;tok3=new_value3') |
    10. +--------------------------------------------------------+
    11. | 2 version tokens updated.                              |
    12. +--------------------------------------------------------+
  • version_tokens_set(token_list)

    Replaces the server's list of version tokens with the tokens defined in the token_list argument and returns a binary string that indicates the outcome of the operation. token_list is a semicolon-separated list of name=value pairs specifying the name of each token to be defined and its value. If the argument is NULL or a string containing no tokens, the token list is cleared.

    1. mysql> SELECT version_tokens_set('tok1=value1;tok2=value2');
    2. +-----------------------------------------------+
    3. | version_tokens_set('tok1=value1;tok2=value2') |
    4. +-----------------------------------------------+
    5. | 2 version tokens set.                         |
    6. +-----------------------------------------------+
  • version_tokens_show()

    Returns the server's list of version tokens as a binary string containing a semicolon-separated list of name=value pairs.

    1. mysql> SELECT version_tokens_show();
    2. +--------------------------+
    3. | version_tokens_show()    |
    4. +--------------------------+
    5. | tok2=value2;tok1=value1; |
    6. +--------------------------+

The following UDFs permit version tokens to be locked and unlocked:

  • version_tokens_lock_exclusive(token_name[, token_name] ..., timeout)

    Acquires exclusive locks on one or more version tokens, specified by name as strings, timing out with an error if the locks are not acquired within the given timeout value.

    1. mysql> SELECT version_tokens_lock_exclusive('lock1', 'lock2', 10);
    2. +-----------------------------------------------------+
    3. | version_tokens_lock_exclusive('lock1', 'lock2', 10) |
    4. +-----------------------------------------------------+
    5. |                                                   1 |
    6. +-----------------------------------------------------+
  • version_tokens_lock_shared(token_name[, token_name] ..., timeout)

    Acquires shared locks on one or more version tokens, specified by name as strings, timing out with an error if the locks are not acquired within the given timeout value.

    1. mysql> SELECT version_tokens_lock_shared('lock1', 'lock2', 10);
    2. +--------------------------------------------------+
    3. | version_tokens_lock_shared('lock1', 'lock2', 10) |
    4. +--------------------------------------------------+
    5. |                                                1 |
    6. +--------------------------------------------------+
  • version_tokens_unlock()

    Releases all locks that were acquired within the current session using version_tokens_lock_exclusive() and version_tokens_lock_shared().

    1. mysql> SELECT version_tokens_unlock();
    2. +-------------------------+
    3. | version_tokens_unlock() |
    4. +-------------------------+
    5. |                       1 |
    6. +-------------------------+

The locking functions share these characteristics:

  • The return value is nonzero for success. Otherwise, an error occurs.

  • Token names are strings.

  • In contrast to argument handling for the UDFs that manipulate the server token list, whitespace surrounding token name arguments is not ignored and = and ; characters are permitted.

  • It is possible to lock nonexisting token names. This does not create the tokens.

  • Timeout values are nonnegative integers representing the time in seconds to wait to acquire locks before timing out with an error. If the timeout is 0, there is no waiting and the function produces an error if locks cannot be acquired immediately.

  • Version Tokens locking functions are based on the locking service described at Section 29.3.1, “The Locking Service”.

Inhaltsverzeichnis Haut

Version Tokens System Variables

Version Tokens supports the following system variables. These variables are unavailable unless the Version Tokens plugin is installed (see Section 5.6.6.2, “Installing or Uninstalling Version Tokens”).

System variables:

  • version_tokens_session

    Property Value
    Command-Line Format --version-tokens-session=value
    System Variable version_tokens_session
    Scope Global, Session
    Dynamic Yes
    SET_VAR Hint Applies No
    Type String
    Default Value NULL

    The session value of this variable specifies the client version token list and indicates the tokens that the client session requires the server version token list to have.

    If the version_tokens_session variable is NULL (the default) or has an empty value, any server version token list matches. (In effect, an empty value disables matching requirements.)

    If the version_tokens_session variable has a nonempty value, any mismatch between its value and the server version token list results in an error for any statement the session sends to the server. A mismatch occurs under these conditions:

    It is not a mismatch for the server version token list to include a token not named in the version_tokens_session value.

    Suppose that a management application has set the server token list as follows:

    1. mysql> SELECT version_tokens_set('tok1=a;tok2=b;tok3=c');
    2. +--------------------------------------------+
    3. | version_tokens_set('tok1=a;tok2=b;tok3=c') |
    4. +--------------------------------------------+
    5. | 3 version tokens set.                      |
    6. +--------------------------------------------+

    A client registers the tokens it requires the server to match by setting its version_tokens_session value. Then, for each subsequent statement sent by the client, the server checks its token list against the client version_tokens_session value and produces an error if there is a mismatch:

    1. mysql> SET @@SESSION.version_tokens_session = 'tok1=a;tok2=b';
    2. mysql> SELECT 1;
    3. +---+
    4. | 1 |
    5. +---+
    6. | 1 |
    7. +---+
    8.  
    9. mysql> SET @@SESSION.version_tokens_session = 'tok1=b';
    10. mysql> SELECT 1;
    11. ERROR 3136 (42000): Version token mismatch for tok1. Correct value a

    The first SELECT succeeds because the client tokens tok1 and tok2 are present in the server token list and each token has the same value in the server list. The second SELECT fails because, although tok1 is present in the server token list, it has a different value than specified by the client.

    At this point, any statement sent by the client fails, unless the server token list changes such that it matches again. Suppose that the management application changes the server token list as follows:

    1. mysql> SELECT version_tokens_edit('tok1=b');
    2. +-------------------------------+
    3. | version_tokens_edit('tok1=b') |
    4. +-------------------------------+
    5. | 1 version tokens updated.     |
    6. +-------------------------------+
    7. mysql> SELECT version_tokens_show();
    8. +-----------------------+
    9. | version_tokens_show() |
    10. +-----------------------+
    11. | tok3=c;tok1=b;tok2=b; |
    12. +-----------------------+

    Now the client version_tokens_session value matches the server token list and the client can once again successfully execute statements:

    1. mysql> SELECT 1;
    2. +---+
    3. | 1 |
    4. +---+
    5. | 1 |
    6. +---+
  • version_tokens_session_number

    Property Value
    Command-Line Format --version-tokens-session-number=#
    System Variable version_tokens_session_number
    Scope Global, Session
    Dynamic No
    SET_VAR Hint Applies No
    Type Integer
    Default Value 0

    This variable is for internal use.


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-version-tokens-reference.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