| Class-DBI-Plugin-FastDelete documentation | Contained in the Class-DBI-Plugin-FastDelete distribution. |
Class::DBI::Plugin::FastDelete - Add to Class::DBI for more fast delete method.
This documentation refers to Class::DBI::Plugin::FastDelete version 0.01
package Your::CD; use base 'Class::DBI'; use Class::DBI::Plugin::FastDelete; ............ Your::CD->fast_delete( artist => 'Green Day' );
This Plugin provide to Class::DBI for more fast delete method. fast_delete method can't use trigger. Instead its fast!
fast_delete method provide more fast delete method.
There are no known bugs in this module. Please report problems to Atsushi Kobayashi (<nekokak@cpan.org>) Patches are welcome.
Atsushi Kobayashi, <nekokak@cpan.org>
Copyright (C) 2006 by Atsushi Kobayashi (<nekokak@cpan.org>). All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
| Class-DBI-Plugin-FastDelete documentation | Contained in the Class-DBI-Plugin-FastDelete distribution. |
package Class::DBI::Plugin::FastDelete; use strict; use warnings; use vars qw($VERSION @EXPORT); require Exporter; @EXPORT = qw(fast_delete); $VERSION = 0.01; use SQL::Abstract; sub import { my $pkg = caller(0); $pkg->mk_classdata('_fast_delete'); goto &Exporter::import; } sub fast_delete { my $class = shift; my $where = (ref $_[0]) ? $_[0] : { @_ }; unless ( $class->_fast_delete ){ $class->_fast_delete(SQL::Abstract->new); } my ($stmt, @bind) = $class->_fast_delete->delete($class->table,$where); my $sth; eval { $sth = $class->db_Main->prepare($stmt) }; if ($@) { return $class->_db_error( msg => "Can't delete $class: $@", err => $@, method => 'delete_fast', ); } eval { $sth->execute(@bind) }; if ($@) { return $class->_db_error( msg => "Can't delete $class: $@", err => $@, method => 'delete_fast', ); } return 1; } 1; __END__