Name

DatabaseDefault — specify default settings for Database directives

SYNOPSIS

key value...

DESCRIPTION

The directive defines default parameters for a database.

For a list of possible parameters (keys), see the Database directive.

DatabaseDefault accepts scalar keys, which actually means all from the list above except:

  • ALTERNATE_*

  • BINARY

  • COLUMN_DEF

  • DEFAULT

  • FIELD_ALIAS

  • FILTER_*

  • NAME

  • NUMERIC

  • POSTCREATE

  • WRITE_CATALOG

DIRECTIVE TYPE AND DEFAULT VALUE

Catalog directive

EXAMPLES

Example: Specify default SQL connection username and password

Most Interchange applications use only one SQL database. In that case, it is handy to specify the default SQL username and password once, instead of repeating it for each table separately. Here's a possible catalog.cfg setting:

DatabaseDefault USER interchange
DatabaseDefault PASS nevairbe

Example: Specifying WRITE_CONTROL and WRITE_TAGGED defaults

DatabaseDefault      WRITE_CONTROL   1
DatabaseDefault      WRITE_TAGGED    1

Example: Specifying defaults in here-document style

DatabaseDefault <<EOD
  WRITE_CONTROL   1
  WRITE_TAGGED    1
  HIDE_AUTO_FILES 1
EOD

Example: Clearing default values

Replace DatabaseDefault

Example: Prevent display of database errors on the storefront

DatabaseDefault LOG_ERROR_SESSION 0

NOTES

Those default settings are made when the table is initially defined, so explicit settings for the database itself override the defaults, of course.

To have the intended effect, this directive must be set before the appropriate databases are defined with the Database directive.

For a way to clear definitions, use the Replace directive.

AVAILABILITY

DatabaseDefault is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: lib/Vend/Config.pm
Line 587

['DatabaseDefault',  'hash',          ''],

Source: lib/Vend/Config.pm
Line 3181 (context shows lines 3181-3198)

sub parse_hash {
my($item,$settings) = @_;
if (! $settings) {
  return $HashDefaultBlank{$item} ? '' : {};
}

my $c;

if(defined $C) {
  $c = $C->{$item} || {};
}
else {
  no strict 'refs';
  $c = ${"Global::$item"} || {};
}

return hash_string($settings,$c);
}

AUTHORS

Interchange Development Group

SEE ALSO

Replace(7ic), Database(7ic), DatabaseAuto(7ic)

DocBook! Interchange!