### Initializes a database following request from Database Manager.
###
sub database_initialize {
my ($init) = @_;
undef my $hashref;
foreach my $xz (split(/,/, $init)) {
$hashref->{$xz} = 1;
}
if ($GLOBAL_OPTIONS->{'database'} == 1) {
error_message("Initialization Error", "Cannot initialize table "passwd" when database is being used for authentication! Deselect this initialization or toggle off the database!", 0, 1) if $hashref->{passwd};
}
my ($dbh2, $error) = db_connect(2);
database_create_tables($dbh2, $hashref);
$dbh2->disconnect();
return 3;
}
###
### database_import
###
### Imports values from flat text files into database.
###
sub database_import {
my ($import_list, $FORMref, $result) = @_;
my %imp = map { $_, 1 } split(/,/, $import_list);
my $dbh = db_connect();
if ($imp{counters}) {
dreq("posting");
db_sql_query({ ID => 1, value => 100+get_number() }, "counters", "replace", undef, $dbh);
db_sql_query({ ID => 2, value => 100+get_postindex() }, "counters", "replace", undef, $dbh);