...
|
...
|
@@ -599,12 +599,12 @@ sub insert {
|
599
|
599
|
|
600
|
600
|
# Arguments
|
601
|
601
|
my $param = @_ % 2 ? shift : undef;
|
602
|
|
- my %args = @_;
|
603
|
|
- warn "insert method param option is DEPRECATED" if $args{param};
|
604
|
|
- $param ||= delete $args{param} || {};
|
|
602
|
+ my %opt = @_;
|
|
603
|
+ warn "insert method param option is DEPRECATED" if $opt{param};
|
|
604
|
+ $param ||= delete $opt{param} || {};
|
605
|
605
|
|
606
|
606
|
# Timestamp
|
607
|
|
- if ($args{timestamp} && (my $insert_timestamp = $self->insert_timestamp)) {
|
|
607
|
+ if ($opt{timestamp} && (my $insert_timestamp = $self->insert_timestamp)) {
|
608
|
608
|
my $columns = $insert_timestamp->[0];
|
609
|
609
|
$columns = [$columns] unless ref $columns eq 'ARRAY';
|
610
|
610
|
my $value = $insert_timestamp->[1];
|
...
|
...
|
@@ -614,17 +614,17 @@ sub insert {
|
614
|
614
|
|
615
|
615
|
# Merge id to parameter
|
616
|
616
|
$param = $self->merge_param(
|
617
|
|
- $self->_id_to_param($args{id}, $args{primary_key}), $param)
|
618
|
|
- if defined $args{id};
|
|
617
|
+ $self->_id_to_param($opt{id}, $opt{primary_key}), $param)
|
|
618
|
+ if defined $opt{id};
|
619
|
619
|
|
620
|
620
|
# Insert statement
|
621
|
621
|
my $sql = "insert ";
|
622
|
|
- $sql .= "$args{prefix} " if defined $args{prefix};
|
623
|
|
- $sql .= "into " . $self->_q($args{table}) . " "
|
624
|
|
- . $self->values_clause($param, {wrap => $args{wrap}}) . " ";
|
|
622
|
+ $sql .= "$opt{prefix} " if defined $opt{prefix};
|
|
623
|
+ $sql .= "into " . $self->_q($opt{table}) . " "
|
|
624
|
+ . $self->values_clause($param, {wrap => $opt{wrap}}) . " ";
|
625
|
625
|
|
626
|
626
|
# Execute query
|
627
|
|
- return $self->execute($sql, $param, %args);
|
|
627
|
+ return $self->execute($sql, $param, %opt);
|
628
|
628
|
}
|
629
|
629
|
|
630
|
630
|
sub update_or_insert {
|
...
|
...
|
@@ -1106,11 +1106,9 @@ sub update {
|
1106
|
1106
|
if defined $id && !defined $primary_key;
|
1107
|
1107
|
$primary_key = [$primary_key] unless ref $primary_key eq 'ARRAY';
|
1108
|
1108
|
my $prefix = $args{prefix};
|
1109
|
|
- my $wrap = $args{wrap};
|
1110
|
|
- my $timestamp = $args{timestamp};
|
1111
|
1109
|
|
1112
|
1110
|
# Timestamp
|
1113
|
|
- if ($timestamp && (my $update_timestamp = $self->update_timestamp)) {
|
|
1111
|
+ if ($args{timestamp} && (my $update_timestamp = $self->update_timestamp)) {
|
1114
|
1112
|
my $columns = $update_timestamp->[0];
|
1115
|
1113
|
$columns = [$columns] unless ref $columns eq 'ARRAY';
|
1116
|
1114
|
my $value = $update_timestamp->[1];
|
...
|
...
|
@@ -1119,7 +1117,7 @@ sub update {
|
1119
|
1117
|
}
|
1120
|
1118
|
|
1121
|
1119
|
# Update clause
|
1122
|
|
- my $assign_clause = $self->assign_clause($param, {wrap => $wrap});
|
|
1120
|
+ my $assign_clause = $self->assign_clause($param, {wrap => $args{wrap}});
|
1123
|
1121
|
|
1124
|
1122
|
# Where
|
1125
|
1123
|
$where = $self->_id_to_param($id, $primary_key, $table)
|