NAME
orMapper - Easy O/R Mapper for DBI base.
SYNOPSIS
use orMapper; my $read_database = { dsn => 'dbi:mysql:dbname=xxxx;host=localhost;port=3306', uid => 'user_id', pwd => 'password', opt => {AutoCommit => 0}, }; my $write_database = { dsn => 'dbi:mysql:dbname=xxxx;host=localhost;port=3306', uid => 'user_id', pwd => 'password', opt => {AutoCommit => 0}, }; my $db = new orMapper($read_database, $write_database);
DESCRIPTION
This Module is easy database operation module.
- Usage
-
my $data = $db->select_n_arrayref($sql,$value); # $data is Array Reference. my $data = $db->select_n_hashref($sql,$value); # $data is Hash Reference. $sql : SQL(Strings) $value: Bind variable with Array Reference. ex.) my $sql = "select * from test where hoge=?"; my $value = [qw/abc/]; my $data = $db->select_arrayref($param); my $data = $db->select_hashref($param); $param : SQL parameter parameter format: $param = { table => 'table_name', columns => [aaa,bbb,ccc], where => [ {xxx => {'=' => 'value1', '>' => 'value2'}}, {xxx => [qw/abc def cfg/], ], order => {'yyy' => 'desc', 'zzz' => 'asc'}, }; $db->insert($p); $param : SQL parameter parameter format: $param = { table => 'table_name', columns => { aaa => 'bbb', ccc => 'ddd', eee => 'fff', }, }; $db->update($p); $param : SQL parameter parameter format: $param = { table => 'table_name', columns => { aaa => 'bbb', ccc => 'ddd', eee => 'fff', }, where => [ {xxx => {'=' => 'value1', '>' => 'value2'}}, {xxx => [qw/abc def cfg/], ], }; $db->delete($p); $param : SQL parameter parameter format: $param = { table => 'table_name', where => [ {xxx => {'=' => 'value1', '>' => 'value2'}}, {xxx => [qw/abc def cfg/], ], }; $db->truncate($p); $param : SQL parameter parameter format: $param = { table => 'table_name', };
Copyright
Kazunori Minoda (c)2012
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 34:
'=item' outside of any '=over'
- Around line 104:
You forgot a '=back' before '=head1'