FTN::Database - FTN SQL Database related operations for Fidonet/FTN related processing.
Version 0.34
FTN::Database are Perl modules containing common database related operations and definitions for Fidonet/FTN related SQL Database processing. The SQL database engine is one for which a DBD module exists, defaulting to SQLite.
The following functions are available in this module: create_ftn_database, open_ftn_database, close_ftn_database, drop_ftn_database, drop_ftn_table, create_ftn_index, and drop_ftn_index.
Syntax: create_ftn_database($db_handle, $database_name);
Create an SQL database for use for Fidonet/FTN processing, where $db_handle is an existing open database handle and $database_name is the name of the database being created.
Syntax: $db_handle = open_ftn_database(\%db_options);
Open a database for Fidonet/FTN processing, where $db_handle is the database handle being returned to the calling program and the referenced hash contains the following items:
The 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 to be used is SQLite.
The name of the database to be opened. If the Type is SQLite, this is a filename and path to the database file.
The database user, which should already have the neccesary priviledges.
The database password for the database user.
Syntax: close_ftn_database($db_handle);
Closing an FTN database, where $db_handle is an existing open database handle.
Syntax: drop_ftn_database($db_handle, $database_name);
Drop an SQL database being used for Fidonet/FTN processing if it exists, where $db_handle is an existing open database handle and $database_name is the name of the database being dropped.
Syntax: create_ftn_table($db_handle, $table_name, $define_fields, $db_type);
Create a table in an SQL database to be used for Fidonet/FTN processing, where $db_handle is an existing open database handle, $table_name is the name of the table to be created, $define_fields is the sql to define the fields to be used for table except for an id field, and $db_type is the type of database.
Syntax: drop_ftn_table($db_handle, $table_name);
Drop an FTN table from an SQL database being used for Fidonet/FTN processing if it exists, where $db_handle is an existing open database handle and $table_name is the name of the table to be dropped.
Syntax: create_ftn_index($db_handle, $table_name, $index_name, $indexed_fields);
Create an index named $index_name on table $table_name in an SQL database being used for Fidonet/FTN processing; where $db_handle is an existing open database handle, the $table_name is the name of the table that is being indexed, and $index_name is the name of the index itself. The index is created on the fields listed in $indexed_fields, with the field names separated by commas.
Syntax: drop_ftn_index($db_handle,$index_name);
Drop an index from an FTN table in an SQL database being used for Fidonet/FTN processing if it exists, where $db_handle is an existing open database handle, and $index_name is the name of the index to be dropped.
An example of opening an FTN database, then closing it:
use FTN::Database; my $db_handle = open_ftn_database(\%db_option); ... close_ftn_database($db_handle);
An example of creating a database for FTN related processing, using a mysql database:
use FTN::Database; my $database_name = "ftndbtst"; my $db_option = { Type = "mysql", Name = "mysql", User = $db_user, Password = $db_password, }; my $db_handle = open_ftn_database(\%db_option); create_ftn_database($db_handle, $database_name); ... close_ftn_database($db_handle);
An example of dropping a database being used for FTN related processing, using a mysql database:
use FTN::Database; my $database_name = "ftndbtst"; my $db_option = { Type = "mysql", Name = "mysql", User = $db_user, Password = $db_password, }; my $db_handle = open_ftn_database(\%db_option); ... drop_ftn_database($db_handle, $database_name); close_ftn_database($db_handle);
Robert James Clay, <jame at rocasa.us>
<jame at rocasa.us>
Please report any bugs or feature requests via the web interface at http://sourceforge.net/p/ftnpl/ftn-database/tickets/. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Note that you can also report any bugs or feature requests to bug-ftn-database at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FTN-Database; however, the FTN-Database Issue tracker at the SourceForge project is preferred.
bug-ftn-database at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc FTN::Database
You can also look for information at:
FTN::Database issue tracker
http://sourceforge.net/p/ftnpl/ftn-database/tickets/
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=FTN-Database
Search CPAN
http://search.cpan.org/dist/FTN-Database
L<DBI>, L<FTN::Database::Nodelist>, L<FTN::Database::ToDo>
Copyright 2010-2012 Robert James Clay, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install FTN::Database, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FTN::Database
CPAN shell
perl -MCPAN -e shell install FTN::Database
For more information on module installation, please visit the detailed CPAN module installation guide.