Class::User::DBI::DB - An internal-use class for the various Class::User::DBI::* classes.
Class::User::DBI::*
Version 0.10
my $sql = Class::User::DBI::DB::$USER_QUERY{SQL_some_query}; db_run_ex( $connector, $sql, @parameters ); # or db_run_ex( $connector, $sql, ( [ @params1 ], [ @params2 ] ) );
This package contains all of the SQL queries for the classes in this distribution.
There is also one subroutine, intended for use by the classes. It handles database queries through the DBIx::Connector object.
This package is generally not intended for external consumption. However, if your database flavor doesn't like this distribution's SQL, you may be relieved to find out that this is the only place you need to look for SQL problems. All of the distribution's SQL is here; even table creation.
Exports (by request) hashes containing the SQL queries for each class. The hashes are given names that represent abbreviated versions of the classes they support.
By default it also exports db_run_ex, which is a utility function facilitating database queries through the connector object.
db_run_ex
db_run_ex( $connector, $sql, @parameters ); # or db_run_ex( $connector, $sql, ( [ @params1 ], [ @params2 ] ) );
Pass a connector object, an SQL query, and a list of bind values. For multiple execute() calls, pass an array of array refs instead of a flat array. Each anonymous array holds the bind values for a single $sth->execute() call.
execute()
$sth->execute()
The dependencies for this module are the same as for Class::User::DBI, from this same distribution. Refer to the documentation in that module for a full description.
All of the SQL for this entire distribution is found in the Class::User::DBI::DB module. Any adjustments required to suit your database engine may be made here. This module's SQL is known to run unaltered with SQLite and MySQL.
If you find that your particular database engine is not playing nicely with the test suite from this module, it may be necessary to provide the database login credentials for a test database using the same engine that your application will actually be using. You may do this by setting $ENV{CUDBI_TEST_DSN}, $ENV{CUDBI_TEST_DATABASE}, $ENV{CUDBI_TEST_USER}, and $ENV{CUDBI_TEST_PASS}.
$ENV{CUDBI_TEST_DSN}
$ENV{CUDBI_TEST_DATABASE}
$ENV{CUDBI_TEST_USER}
$ENV{CUDBI_TEST_PASS}
Currently the test suite tests against a SQLite database since it's such a lightweight dependency for the testing. The author also uses this module with several MySQL databases. As you're configuring your database, providing its credentials to the tests and running the test scripts will offer really good diagnostics if some aspect of your database tables proves to be at odds with what this module needs.
This module has only been tested on MySQL and SQLite database engines. If you are successful in using it with other engines, please send me an email detailing any additional configuration changes you had to make so that I can document the compatibility, and improve the documentation for the configuration process.
David Oswald, <davido at cpan.org>
<davido at cpan.org>
Please report any bugs or feature requests to bug-class-user-dbi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-User-DBI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-class-user-dbi at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Class::User::DBI::DB
You can also look for information at:
Class-User-DBI on Github
https://github.com/daoswald/Class-User-DBI.git
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-User-DBI
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Class-User-DBI
CPAN Ratings
http://cpanratings.perl.org/d/Class-User-DBI
Search CPAN
http://search.cpan.org/dist/Class-User-DBI/
Copyright 2012 David Oswald.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Class::User::DBI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::User::DBI
CPAN shell
perl -MCPAN -e shell install Class::User::DBI
For more information on module installation, please visit the detailed CPAN module installation guide.