Previous: MySQL Configuration, Up: mysql [Contents][Index]
MySQL query is defined using the following option:
Define MySQL query template.
The template may reference the following variables:
Variable | Meaning |
---|---|
map | Name of the map being queried |
key | Lookup key |
For example:
database alias mysql \ query="SELECT alias FROM aliases WHERE email='$key'"
If the database definition lacks the query
option,
it will attempt to use one from the module statement. If the module
statement lacked it as well, an error is reported.
Reply templates define the responses to be given. They are given by the following options:
Defines a reply to be sent if the query returned a non-empty set of tuples. In addition to the variables described above (see Table 6.1), the template may also refer to the MySQL result columns, by using their names from the ‘SELECT’ part of the query. For example:
database alias mysql \ query="SELECT alias FROM aliases WHERE email='$key'" \ positive-reply="OK $alias"
The default positive-reply
is ‘OK’.
Defines a reply to be sent if the query returned an empty set of tuples. The template may refer to the variables described in Table 6.1.
Default value is ‘NOTFOUND’.
Defines a reply to be sent if an error occurred when executing the query. The template may refer to the variables described in Table 6.1.
Default value is ‘NOTFOUND’.
Previous: MySQL Configuration, Up: mysql [Contents][Index]