Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
tutoriel:sql:langage:start [2021/10/19 13:51] – [Commentaires] admin | tutoriel:sql:langage:start [2022/08/13 21:57] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 18: | Ligne 18: | ||
MySQL Server prend en charge trois styles de commentaires : | MySQL Server prend en charge trois styles de commentaires : | ||
- | ~~ol: | + | <WRAP list-deep> |
- | - **Depuis un caractère # jusqu' | + | - **Depuis un caractère # jusqu' |
- | - **Depuis un double tiret ('' | + | - **Depuis un double tiret (%%--%%) jusqu' |
- | - **Depuis une séquence /* jusqu' | + | - **Depuis une séquence /* jusqu' |
+ | Commentaire | ||
+ | sur plusieurs lignes | ||
+ | */</ | ||
+ | </ | ||
- | L' | + | <WRAP center round info 60%> |
+ | Évitez | ||
+ | </ | ||
- | <code sql >mysql> SELECT 1+1; # | + | <WRAP center round info 60%> |
- | mysql> SELECT | + | **Variantes** |
- | mysql> SELECT 1 /* ceci est un commentaire en ligne */ + 1; | + | <WRAP list-deep> |
- | mysql> SELECT | + | - <code sql >/*! MySQL-specific code */</code> |
- | /* | + | |
- | ceci est un | + | |
- | commentaire sur plusieurs lignes | + | </ |
- | */ | + | </WRAP> |
- | 1; | + | |
- | </ | + | |
- | Les commentaires imbriqués ne sont pas pris en charge et sont obsolètes ; les utilisateurs doivent les éviter. | ||
- | |||
- | Le serveur MySQL prend en charge certaines variantes de commentaires de style C. Ceux-ci vous permettent d' | ||
- | |||
- | The comment syntax just described applies to how the mysqld server parses SQL statements. The mysql client program also performs some parsing of statements before sending them to the server. (It does this to determine statement boundaries within a multiple-statement input line.) For information about differences between the server and mysql client parsers, see Section 4.5.1.6, “mysql Client Tips”. | ||
- | |||
- | Comments in /*!12345 ... */ format are not stored on the server. If this format is used to comment stored programs, the comments are not retained in the program body. | ||
- | |||
- | Another variant of C-style comment syntax is used to specify optimizer hints. Hint comments include a + character following the /* comment opening sequence. Example: | ||
- | |||
- | SELECT /*+ BKA(t1) */ FROM ... ; | ||
- | |||
- | For more information, | ||
- | |||
- | The use of short-form mysql commands such as \C within multiple-line /* ... */ comments is not supported. Short-form commands do work within single-line /*! ... */ version comments, as do /*+ ... */ optimizer-hint comments, which are stored in object definitions. If there is a concern that optimizer-hint comments may be stored in object definitions so that dump files when reloaded with mysql would result in execution of such commands, either invoke mysql with the --binary-mode option or use a reload client other than mysql. | ||
===== Voir aussi ===== | ===== Voir aussi ===== | ||