![]() |
Dico |
GNU Dictionary Server |
Sergey Poznyakoff |
4.3.12 Databases
Dictionary databases are defined using the database
block
statement.
- Configuration: database { statements }
Defines a dictionary database. At least two sub-statements must be defined for each database:
name
andhandler
.
- Database: visible bool
Defines whether this database is visible or not. By default, all databases are visible. You will need this statement if you want to temporary hide the database without removing it from the configuration. Another common use case is to hide a database that is used as a member of a virtual database, so that its contents is available only by querying the parent database (see Virtual Databases).
- Database: name string
Sets the name of this database (a single word). This name will be used to identify this database in DICT commands.
- Database: handler string
Specifies the handler name for this database and any arguments for it. This handler must be previously defined using the
load-module
statement (see Handlers).
For example, the following fragment defines a database named
‘en-de’, which is handled by ‘dictord’ handler. The handler
is passed one argument, database=en-de
:
database { name "en-de"; handler "dictorg database=en-de"; }
More directives are available to fine-tune the database.
- Database: description string
Supplies a short description, to be shown in reply to
SHOW DB
command. The string may not contain new-lines.Use this statement if the database itself does not supply a description, or if its description is malformed.
In any case, if the
description
directive is specified, its value takes precedence over the description string retrieved from the database itself.See SHOW DB, for a description of
SHOW DB
command.
- Database: info string
Supplies a full description of the database. This description is shown in reply to
SHOW INFO
(see SHOW INFO) command. The string is usually a multi-line text, so it is common to use here-document syntax (see here-document), e.g.:info <<- EOT This is a foo-bar dictionary. Copyright (C) 2008 foo-bar dict group. Distributed under the terms of GNU Free Documentation license. EOT;
Use this statement if the database itself does not supply a full description, or if its full description is malformed.
As with
description
, the value ofinfo
takes precedence over info strings retrieved from the database.
The following two directives control the content type and transfer
encoding used when formatting replies from this database if
OPTION MIME
(see OPTION MIME) is in effect:
- Database: mime-headers multiline-string
Defines the headers to be sent with the replies from this database. Argument is a here-document (see here-document), containing the headers to be sent with each dictionary entry, if the client sent the ‘OPTION MIME’ command. By default
dicod
uses MIME headers defined in the database itself. Use this statement if these are not defined, or if you want to override them. In this case you would want to include at least the ‘Content-Type’ and ‘Content-Transfer-Encoding’ headers, as shown in the example below:directory { name "foo"; handler "dictorg"; mime-headers <<- EOT Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit EOT; ... }
Valid values for the ‘Content-Transfer-Encoding’ header are:
- 8bit
The content will be transferred as is.
- quoted-printable
Non-printable characters will be encoded using the ‘quoted-printable’ encoding.
- base64
Non-printable characters will be encoded using the ‘base64’ encoding.
This document was generated on September 4, 2020 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.