NAME

Games::Framework::RCP::Database - The interface to logging into the database.

VERSION

Version 0.01_01

SYNOPSIS

Games::Framework::RCP::Database - Connect to the database and use the system.

use Games::Framework::RCP::Database;
my $dbh = Games::Framework::RCP::Database->instance({user => "foo", pass => "bar"});

# Actions go here.

DESCRIPTION

This module provides a proper way to connect to the database and establish a single connection.

CONFIGURATION AND ENVIRONMENT

The only requirements for the environment are that PostGresQL is installed. In the future, other database systems may be supported.

DEPENDENCIES

SUBROUTINES/METHODS

errstr

Alias DBI errors using typeglob magic.

_new_instance

This is used with Class::Singleton to ensure only one instance of a database connection is made.

Params are as follows:

  • $_[0]

    The $class variable. This can be ignored safely.

  • $_[1]

    The hash of $params. It usually contains the following:

    • $dbsys

      database implmentation. Defaults go Pg. Only Pg is supported at this time: this may change.

    • $dbname

      database name. Defaults to rcp.

    • $host

      host of the DB. Defaults to localhost.

    • $port

      port of the DB. Defaults to 5432, Pg's starting port.

    • $user

      username to access the DB. Required!

    • $pass

      password to acces the DB. Required!

    • $options

      various other options to pass in, such as AutoCommit or RaiseError. Default provided.

This returns the database connection upon success. Class::Singleton ensures there is only one connection per program.

get_db_system

Return the database system in use.

get_db_name

Return the database name we are using.

get_host

Return the host we are connecting to.

get_port

Return the port number we use for connecting to the DB.

INCOMPATIBILITIES

At this time, only PostGresQL databases are supported. The author hopes to have support for more databases in the future.

DIAGNOSTICS

There are no known problems, and therefore no need to provide solutions.

AUTHOR

Jason Felds, <wolfman.ncsu2000 at gmail.com>

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-Games-Framework-RCP at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Framework-RCP-Database. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO

perl(1), Class::Singleton, DBD::Pg

SUPPORT

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

perldoc Games::Framework::RCP::Database

You can also look for information at:

ACKNOWLEDGEMENTS

See Games::Framework::RCP for all acknowledgements.

LICENSE AND COPYRIGHT

Copyright 2008 Wolfman2000, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.