line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::DBI::Plugin::FastDelete; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
94681
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @EXPORT); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
67
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
@EXPORT = qw(fast_delete); |
9
|
|
|
|
|
|
|
$VERSION = 0.01; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1235
|
use SQL::Abstract; |
|
1
|
|
|
|
|
9651
|
|
|
1
|
|
|
|
|
270
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub import { |
14
|
1
|
|
|
1
|
|
13
|
my $pkg = caller(0); |
15
|
1
|
|
|
|
|
15
|
$pkg->mk_classdata('_fast_delete'); |
16
|
1
|
|
|
|
|
67
|
goto &Exporter::import; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub fast_delete { |
20
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
21
|
0
|
0
|
|
|
|
|
my $where = (ref $_[0]) ? $_[0] : { @_ }; |
22
|
0
|
0
|
|
|
|
|
unless ( $class->_fast_delete ){ |
23
|
0
|
|
|
|
|
|
$class->_fast_delete(SQL::Abstract->new); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my ($stmt, @bind) = $class->_fast_delete->delete($class->table,$where); |
27
|
0
|
|
|
|
|
|
my $sth; |
28
|
0
|
|
|
|
|
|
eval { $sth = $class->db_Main->prepare($stmt) }; |
|
0
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ($@) { |
30
|
0
|
|
|
|
|
|
return $class->_db_error( |
31
|
|
|
|
|
|
|
msg => "Can't delete $class: $@", |
32
|
|
|
|
|
|
|
err => $@, |
33
|
|
|
|
|
|
|
method => 'delete_fast', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
eval { $sth->execute(@bind) }; |
|
0
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if ($@) { |
39
|
0
|
|
|
|
|
|
return $class->_db_error( |
40
|
|
|
|
|
|
|
msg => "Can't delete $class: $@", |
41
|
|
|
|
|
|
|
err => $@, |
42
|
|
|
|
|
|
|
method => 'delete_fast', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return 1; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |