NAME
DBIx::MultiDB - join data from multiple sources
SYNOPSIS
use DBIx::MultiDB;
my $query = DBIx::MultiDB->new(
dsn => 'dbi:SQLite:dbname=/tmp/db1.db',
sql => 'SELECT id, name, company_id FROM employee',
);
$query->attach(
prefix => 'company_',
dsn => 'dbi:SQLite:dbname=/tmp/db2.db',
sql => 'SELECT id, name FROM company',
key => 'id',
referenced_by => 'company_id',
);
$query->execute();
while ( my $row = $query->fetchrow_hashref ) {
# ...
}
DESCRIPTION
DBIx::MultiDB provides a simple way to join data from different sources.
You are not limited to a single database engine: in fact, you can join data from any source for which you have a DBI driver (MySQL, PostgreSQL, SQLite, etc). You can even mix them!
METHODS
new
Constructor. You must provide a dsn and sql, which is your base query.
attach
Once you have a base query, you can attach multiple queries that will be joined to it. For each one, you must provide a dsn, sql, and the relationship information (key and referenced_by). You can optionally provide a prefix that will be used to prevent name clashes.
execute
Execute the query. (This will load all the attached queries, building an index in memory.)
fetchrow_hashref
Return a hashref, containing field names and values.
AUTHOR
Nelson Ferraz, <nferraz at gmail.com>
BUGS
Please report any bugs or feature requests to bug-dbix-multidb at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-MultiDB. 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 DBIx::MultiDB
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2010 Nelson Ferraz, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.