NAME

FTN::Database - FTN SQL Database related operations for Fidonet/FTN related processing.

VERSION

Version 0.18

DESCRIPTION

FTN::Database is Perl modules containing common database related operations for Fidonet/FTN related SQL Database processing plus associated scripts. The SQL database engine is one for which a DBD module exists, defaulting to SQLite.

EXPORT

The following functions are available in this module: create_ftndb, open_ftndb, close_ftndb, and drop_ftndb.

FUNCTIONS

create_ftndb

Syntax: create_ftndb($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.

open_ftndb

Syntax: $db_handle = open_ftndb(\%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:

Type

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.

Name

The name of the database to be opened. If the Type is SQLite, this is a filename and path to the database file.

User

The database user, which should already have the neccesary priviledges.

Password

The database password for the database user.

close_ftndb

Syntax: close_ftndb($db_handle);

Closing an FTN database, where $db_handle is an existing open database handle.

drop_ftndb

Syntax: drop_ftndb($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.

EXAMPLES

An example of opening an FTN database, then closing it:

use FTN::Database;

my $db_handle = open_ftndb(\%db_option);
...
close_ftndb($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_ftndb(\%db_option);
    create_ftndb($db_handle, $database_name);
    ...
    close_ftndb($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_ftndb(\%db_option);
    ...
    drop_ftndb($db_handle, $database_name);
    close_ftndb($db_handle);

AUTHOR

Robert James Clay, <jame at rocasa.us>

BUGS

Please 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. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc FTN::Database

You can also look for information at:

SEE ALSO

L<DBI>, L<FTN::Database::Nodelist>, L<ftndbadm>, L<ftndbadm>,
and L<ftnpldb-nodelist>

COPYRIGHT & LICENSE

Copyright 2010 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.