Go to the first, previous, next, last section, table of contents.


SQL editor configuration file

Used by the sqledit package (sqledit.pm). This module implements an HTML interface to an SQL database. The instructions of this configuration file modifies the behavior of the interface.

`context_allow (optional, default *)'
The list of allowed values for the context cgi-bin parameter. The complete list of available context values is listed in the table of content. Each value is described in a section and the name of the section ends with the value of the context parameter, See section Catalog CGI. Alternatively, context_allow may be set to star (*, the default) to allow every operations. If the user is denied a specific operation, the following error message will be displayed:
"%s context is not allowed"
See section Messages translation. Assuming that you want to give read-only access to your catalog, use the following:
context_allow = cbrowse
`functions (optional, nested)'
Defines functions that may be used as values for the normalize and match instructions in the check nested instruction. The keyword is the name of the function and the value is the body of the function. The body of the function must be a piece of Perl code that returns a function pointer when evaluated. Most of the time it is a simple lambda (sub { ... }). No parameters are passed to the function, however the $_ variable contains the current value of the field for which the function was called. See the description of the match and check instructions for a description of the return values expected from these functions. Since the available libraries are not documented you can only rely on the standard Perl libraries here.
functions
        normalize_lc = sub { $_ = lc; return 1; }
        check_alnum = sub { /[a-z0-9]+/ || "alphanumerical" }
end
`check (optional, nested)'
Defines the checking that must be done on each field of each table of the current database (the current database is defined in the mysql.conf file). The structure of this instruction is as follow:
check
        table1
                field1
                        normalize = <function>
                        match = <function>
                        mandatory = yes
                end
                field2
                        ...
                end
                ...
        end
        ...
end
We will define bellow the instructions that may be associated with each field.
`normalize (optional, default returns 1)'
The <function> may be either a valid Perl function or a function defined in the function section of this configuration file. The $_ variable contains the value of the field for the current record. The normalize function is called when the value of the field is updated or a new value is inserted. The return value of the function must be
  • 1 if the normalization of the value was a success.
  • 0 if the value cannot be normalized.
If the return value is 1, the $_ variable is expected to contain the normalized value when the function returns. If the return value is 0, the following error message will be issued to the end user:
table %s : field %s : value %s normalize failed %s
See section Messages translation.
`match (optional, default returns 1)'
The <function> may be either a valid Perl function or a function defined in the function section of this configuration file. The $_ variable contains the value of the field for the current record. The match function is called when the value of the field is updated or a new value is inserted. The return value of the function must be
  • 1 if the value matches the constraint.
  • a string if the value does not match the constraint.
If the return value is a string, the following error message will be issued to the end user:
table %s : field %s : value %s match failed %s
See section Messages translation. where the last %s is replaced by the string returned by the function, thus providing precise error messages.
`mandatory (optional)'
If present, the associated field must always contain a value that is not empty. The mandatory check is done when the value of the field is updated or a new value is inserted. If the new value is null (only contains white space), the following error message will be issued to the end user:
table %s : field %s must be set
See section Messages translation.
`dictionaries (optional, nested)'
Parameters that apply to the dictionaries as defined by the relational specifications, See section Relational constraints. Keep in mind that dictionaries are handled as if they were native enum or set types of MySQL. This instruction allows to control the display of such dictionaries.
dictionary
        tablename1
                where = <where clause1>
                order = <order clause1>
        end
        tablename2
                where = <where clause2>
                order = <order clause2>
        end
        ...
end
`where (optional)'
The <where clause> may be any expression valid in a SQL where clause. The beginning of the SQL order is something like select * from tablename. The values displayed to the user will only be those matching the where clause, for more information on how to display a dictionary See section Template files introduction.
`order (optional)'
The <where clause> may be any expression valid in a SQL order clause. The beginning of the SQL order is something like select * from tablename. The menu generated for this dictionary will show the values listed according to this clause. If not provided, no specific order can be expected.
`display (optional, nested)'
Controls the generation of HTML code for menus and lists of checkboxes associated to dictionaries. Basically it is a matter of choosing how many columns you want, what kind of separator should be displayed etc. The structure of this instruction is as follow:
display
        select
                general
                        multiple = <number of lines>
                        labelnull = <HTML text>
                end
                tablename1
                        field1
                                multiple = <number of lines>
                                labelnull = <HTML text>
                        end
                        ...
                end
                ...
        end
        table
                general
                        columns = <number of columns>
                        font = <font ...>
                end
                tablename1
                        field1
                                columns = <number of columns>
                                font = <font ...>
                        end
                        ...
                end
                ...
        end
end
In both select and table, there is a special table name, general, that provides the default for all the table names not specifically listed.
`select'
Provides instructions for customizing a select HTML tag.
`multiple (optional, default 4)'
The value of the multiple parameter in the select tag.
`labelnull (optional, default ---------)'
When the list of values of the dictionaries is generated, the empty value is prepended and the text visible to the user is the value of this attribute.
`table'
Provides instructions for customizing the display of a set of radio buttons or checkboxes within a table.
`columns (optional, default 4)'
The number of columns used for the table containing the radio buttons or the checkboxes.
`font (optional)'
An HTML font change specification that will be duplicated in every cell of the table.
`nph (optional, default no)'
Set it to yes if your script is nph (non parsed header). This changes the header sent by Catalog. For more information on nph cgi-bin see the Apache documentation and the CGI.pm documentation.


Go to the first, previous, next, last section, table of contents.