DBIx-Skinny
view release on metacpan or search on metacpan
lib/DBIx/Skinny.pm view on Meta::CPAN
668669670671672673674675676677678679680681682683684685686687
$obj
;
}
sub
bulk_insert {
my
(
$class
,
$table
,
$args
) =
@_
;
my
$code
=
$class
->_attributes->{dbd}->can(
'bulk_insert'
) or Carp::croak
"dbd don't provide bulk_insert method"
;
$code
->(
$class
,
$table
,
$args
);
}
sub
update {
my
(
$class
,
$table
,
$args
,
$where
) =
@_
;
my
$schema
=
$class
->schema;
$class
->call_schema_trigger(
'pre_update'
,
$schema
,
$table
,
$args
);
my
$values
= {};
for
my
$col
(
keys
%{
$args
}) {
$values
->{
$col
} =
$schema
->call_deflate(
$col
,
$args
->{
$col
});
}
lib/DBIx/Skinny.pm view on Meta::CPAN
698699700701702703704705706707708709710711712713714715716717718
my
$sth
=
$class
->_execute(
$sql
,
$bind_columns
,
$table
);
my
$rows
=
$sth
->rows;
$class
->_close_sth(
$sth
);
$class
->call_schema_trigger(
'post_update'
,
$schema
,
$table
,
$rows
);
return
$rows
;
}
sub
update_by_sql {
my
(
$class
,
$sql
,
$bind
) =
@_
;
Carp::carp(
'update_by_sql has been deprecated. Please use $skinny->do($sql, undef, @bind)'
);
$class
->
do
(
$sql
,
undef
,
@$bind
);
}
sub
delete
{
my
(
$class
,
$table
,
$where
) =
@_
;
my
$schema
=
$class
->schema;
lib/DBIx/Skinny/Row.pm view on Meta::CPAN
101102103104105106107108109110111112113114115116117118119120121
return
\
%rows
;
}
sub
insert {
my
$self
=
shift
;
$self
->{skinny}->find_or_create(
$self
->{opt_table_info},
$self
->get_columns);
}
sub
update {
my
(
$self
,
$args
,
$table
) =
@_
;
$table
||=
$self
->{opt_table_info};
my
$upd
=
$self
->get_dirty_columns;
map
{
$upd
->{
$_
} =
$args
->{
$_
}}
keys
%$args
;
return
0
unless
%$upd
;
my
$result
=
$self
->{skinny}->update(
$table
,
$upd
,
$self
->_where_cond(
$table
));
$self
->set_columns(
$upd
);
( run in 0.514 second using v1.01-cache-2.11-cpan-49f99fa48dc )