NAME
Cake::DBI::Abstract
SYNOPSIS
use Cake::DBI::Abstract;
my $query = Cake::DBI::Abstract->new();
#set tables
$query->table(
'users' => {'as' => 'u'},
'-left_join' => [
hobbies => {'as' => 'h'},
'-on' => [
'h.uid' => 'u.uid'
]
]
);
##select records
$query->from('u.*','h.username NAME');
$query->where(
uid => 1,
'-or',
name => {'LIKE' => '%m%'},
'-or' => [
uid => 2,
name => 't'
]
);
##generate sql string and bind values
my ($sql,@binds) = $query->query();
DESCRIPTION
This module generates sql syntaxes like (SELECT,UPDATE,INSERT) directly from Perl
Methods
create
Accepts hash ref of options
my ($sql,@binds) = $query->create({
'-insert_mode' => 'DELAYED' || 'LOW_PRIORITY' || 'HIGH_PRIORITY' || 'IGNORE',
'-on_duplicate' => {
col1 => val
},
col1 => val1,
col2 => val2
});