Eidolon::Driver::DB - Eidolon generic database driver.
Example database driver:
package Eidolon::Driver::DB::Example; use base qw/Eidolon::Driver::DB/; sub new { my ($class, $self); $class = shift; $self = $class->SUPER::new("Example", @_); return $self; } sub call { my ($self, $function, @params, $query); ($self, $function, @params) = @_; throw DriverError::DB::SQL($function); # never will reach here return $self->execute($query, @params); }
The Eidolon::Driver::DB is a generic database driver for Eidolon. It declares some functions that are common for all driver types and some abstract methods, that must be overloaded in ancestor classes. All database drivers should subclass this package.
Actually, Eidolon database stack is more high-level abstraction over the DBI package. However, this abstraction is not ORM-like but makes SQL syntax differences between different DBMSs less visible.
To use database drivers you must have DBI and needed DBD packages installed.
Class constructor. Sets initial class data: $dbd - DBI driver name, $db - database name, $user - database user name, $password - database password, $host - database host, $port - database port, $cfg - configuration hashref:
$dbd
$db
$user
$password
$host
$port
$cfg
Automatically fetch all query results right after query execution. Default value is 0.
0
Automatically commit transaction after each SQL query. Default value is 1.
1
Query execution. Given $query executed with binded @params. If any error occurs, exception is thrown.
$query
@params
Prepared query execution. Previously executed query will be executed again with new @params.
Returns one row fetched from database or undef if no results remained.
undef
Returns reference to array of all rows fetched from database after query execution.
Clear in-memory cache of fetched data.
Call stored procedure or function with $function as name and @params as parameters. Abstract method, should be overloaded in ancestors.
$function
Eidolon, Eidolon::Driver::DB::Exceptions
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Anton Belousov, <abel@cpan.org>
Copyright (c) 2009, Atma 7, http://www.atma7.com
To install Eidolon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eidolon
CPAN shell
perl -MCPAN -e shell install Eidolon
For more information on module installation, please visit the detailed CPAN module installation guide.