Name

DirectiveDatabase — specify database to read configuration directives from

SYNOPSIS

table_name [table_source_filename [table_source_type]]

DESCRIPTION

The DirectiveDatabase configuration directive makes it possible to read all configuration directives from a database, instead of from the usual catalog.cfg configuration file.

The database can (but does not have to) be previously defined with the Database directive. When it is, then just the table name is required and honored. When it is not, then the Database directive will be automatically invoked first to register the new table, possibly with custom text source file and table type.

table_source_filename defaults to table_name.txt, and table_source_type defaults to TAB. (The arguments are the same as for the Database directive itself, they are passed to it directly.)

DIRECTIVE TYPE AND DEFAULT VALUE

Catalog directive

EXAMPLES

Example: Defining DirectiveDatabase, single-step

DirectiveDatabase catalog catalog.txt TAB

Example: Defining DirectiveDatabase, two-step

Database catalog catalog.txt TAB
DirectiveDatabase catalog

NOTES

AVAILABILITY

DirectiveDatabase is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: lib/Vend/Config.pm
Line 617

['DirectiveDatabase', 'dbconfig',        ''],

Source: lib/Vend/Config.pm
Line 4769 (context shows lines 4769-4815)

sub parse_dbconfig {
my ($var, $value) = @_;

my ($file, $type);
return '' if ! $value;
local($Vend::Cfg) = $C;

my ($db, $table);
eval {
  ($db, $table) = get_configdb($var, $value);
};

return '' if ! $db;

my ($k, @f);  # key and fields
my @l;      # refs to locale repository
my @n;      # names of locales
my @h;      # names of locales

@n = $db->columns();
shift @n;
my $extra;
for(@n) {
  my $real = $CDname{lc $_};
  if (! ref $Vend::Cfg->{$real} or $Vend::Cfg->{$real} !~ /HASH/) {
    # ignore non-existent directive, but put in hash
    my $ref = {};
    push @l, $ref;
    push @h, [$real, $ref];
    next;
  }
  push @l, $Vend::Cfg->{$real};
}
my $i;
while( ($k, undef, @f ) = $db->each_record) {
#::logDebug("Got key=$k f=@f");
  for ($i = 0; $i < @f; $i++) {
    next unless length($f[$i]);
    $l[$i]->{$k} = $f[$i];
  }
}
for(@h) {
  $Vend::Cfg->{Hash}{$_->[0]} = $_->[1];
}
$db->close_table();
return $table;
}

AUTHORS

Interchange Development Group

SEE ALSO

Database(7ic), FileDatabase(7ic)

DocBook! Interchange!