line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::ActiveRecord::Arel::Query::Update; |
2
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
73
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
8
|
use base 'DBIx::ActiveRecord::Arel::Query'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
799
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
1
|
|
|
1
|
0
|
2
|
my ($self, $main, $hash, $columns) = @_; |
8
|
1
|
|
|
|
|
10
|
my $o = $self->SUPER::new($main); |
9
|
1
|
|
|
|
|
4
|
$o->merge($main->query); |
10
|
1
|
|
|
|
|
2
|
$o->{hash} = $hash; |
11
|
1
|
|
|
|
|
2
|
$o->{columns} = $columns; |
12
|
1
|
|
|
|
|
3
|
$o; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
0
|
3
|
sub columns {shift->{columns}} |
16
|
2
|
|
|
2
|
0
|
5
|
sub hash {shift->{hash}} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _to_sql { |
19
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
2
|
$DBIx::ActiveRecord::Arel::Column::USE_FULL_NAME = 0; |
22
|
1
|
|
|
|
|
2
|
$DBIx::ActiveRecord::Arel::Column::AS = {}; |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
4
|
my @keys = $self->columns ? grep {exists $self->hash->{$_}} @{$self->columns} : keys %{$self->hash}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
4
|
|
25
|
1
|
|
|
|
|
2
|
my @set = map {$_.' = ?'} @keys; |
|
1
|
|
|
|
|
3
|
|
26
|
1
|
|
|
|
|
7
|
my $sql = 'UPDATE '.$self->main->table.' SET '.join(', ', @set); |
27
|
1
|
|
|
|
|
6
|
my $where = $self->build_where; |
28
|
1
|
50
|
|
|
|
5
|
$sql .= " WHERE $where" if $where; |
29
|
1
|
|
|
|
|
1
|
unshift @{$self->{binds}}, map {$self->hash->{$_}} @keys; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
30
|
1
|
|
|
|
|
4
|
$sql; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |