App-FTNDB
view release on metacpan or search on metacpan
bin/ftndb-admin view on Meta::CPAN
sub create_ftn_table {
# connect to database
$db_handle = FTN::Database::open_ftn_database(\%db_option);
# drop the old table, if it exists.
logging($log_file, $log_id, "Dropping existing table $table_name if it already exists.");
FTN::Database::drop_ftn_table($db_handle, $table_name);
# Create table
FTN::Database::create_ftn_table($db_handle, $table_name, $define_fields, $db_option{'Type'});
# disconnect from database
FTN::Database::close_ftn_database($db_handle);
logging($log_file, $log_id, "Table $table_name created.");
return();
}
########################################################################
# Drop an FTN database table
########################################################################
sub drop_ftn_table {
# connect to database server
$db_handle = FTN::Database::open_ftn_database(\%db_option);
# drop the old database table, if it exists.
logging($log_file, $log_id, "Dropping existing $table_name if it already exists.");
FTN::Database::drop_ftn_table($db_handle, $table_name);
# disconnect from database
FTN::Database::close_ftn_database($db_handle);
logging($log_file, $log_id, "Database table $table_name dropped.");
return();
}
########################################################################
# Display Version message
########################################################################
sub VERSION_MESSAGE {
my $fh = shift;
print {$fh} "ftndb-admin version $VERSION\n";
return();
}
########################################################################
=head1 CONFIGURATION
Configuration information not provided by the command line options are
obtained from a configuration file. That can be defined by setting the
"-c" option, which is the path and file name of the configuration file
to be used. If that is not defined, it looks for a file named ftndb.cfg
in the current directory. The file contains configuration items listed
outside of a named section as well as those listed within a named section,
and blank lines and lines starting with a "#" are ignored.
The first items in the file are those outside of a named section:
=over 4
=item LogFile
This is the rquired filename and path of a log file.
=back
The B<Database> section in the configuration file has the following
keywords:
=over 4
=item Type
Database type.
This needs to be a database type for which a DBD module exists, the type
being the name as used in the DBD module. The default type is SQLite.
=item Name
Database name.
For an SQLite database; this needs to be at least the filename and can
also include a path.
=item User
Database user.
For an SQLite database, this defaults to an empty string as it is not
needed for that type of a database.
=item Password
Database password.
For an SQLite database, this defaults to an empty string as it is not
needed for that type of a database.
=back
This is an example of the contents of an ftndb.cfg file:
# ftndb.cfg
LogFile=/opt/ftndb/ftndb.log
[Database]
Type=mysql
Name=ftndbtst
User=sysop
Password=ftndbtst
=head1 EXAMPLES
Given that $CFGFILE is a configuration file, the following command line can be
used to create an FTN Nodelist table in that database file:
( run in 1.142 second using v1.01-cache-2.11-cpan-39bf76dae61 )