...
|
...
|
@@ -236,16 +236,16 @@ sub delete {
|
236
|
236
|
my $table = $args{table} || '';
|
237
|
237
|
croak qq{"table" option must be specified. } . _subname
|
238
|
238
|
unless $table;
|
239
|
|
- my $where = delete $args{where} || {};
|
240
|
|
- my $allow_delete_all = delete $args{allow_delete_all};
|
241
|
|
- my $where_param = delete $args{where_param} || {};
|
242
|
|
- my $id = delete $args{id};
|
243
|
|
- my $primary_key = delete $args{primary_key};
|
|
239
|
+ my $where = $args{where} || {};
|
|
240
|
+ my $allow_delete_all = $args{allow_delete_all};
|
|
241
|
+ my $where_param = $args{where_param} || {};
|
|
242
|
+ my $id = $args{id};
|
|
243
|
+ my $primary_key = $args{primary_key};
|
244
|
244
|
croak "update method primary_key option " .
|
245
|
245
|
"must be specified when id is specified " . _subname
|
246
|
246
|
if defined $id && !defined $primary_key;
|
247
|
247
|
$primary_key = [$primary_key] unless ref $primary_key eq 'ARRAY';
|
248
|
|
- my $prefix = delete $args{prefix};
|
|
248
|
+ my $prefix = $args{prefix};
|
249
|
249
|
|
250
|
250
|
# Where
|
251
|
251
|
$where = $self->_create_param_from_id($id, $primary_key, $table)
|
...
|
...
|
@@ -378,30 +378,30 @@ sub execute {
|
378
|
378
|
my %args = @_;
|
379
|
379
|
|
380
|
380
|
# Arguments
|
381
|
|
- my $p = delete $args{param} || {};
|
|
381
|
+ my $p = $args{param} || {};
|
382
|
382
|
$param ||= $p;
|
383
|
|
- my $tables = delete $args{table} || [];
|
|
383
|
+ my $tables = $args{table} || [];
|
384
|
384
|
$tables = [$tables] unless ref $tables eq 'ARRAY';
|
385
|
|
- my $filter = delete $args{filter};
|
|
385
|
+ my $filter = $args{filter};
|
386
|
386
|
$filter = _array_to_hash($filter);
|
387
|
|
- my $bind_type = delete $args{bind_type} || delete $args{type};
|
|
387
|
+ my $bind_type = $args{bind_type} || $args{type};
|
388
|
388
|
$bind_type = _array_to_hash($bind_type);
|
389
|
|
- my $type_rule_off = delete $args{type_rule_off};
|
|
389
|
+ my $type_rule_off = $args{type_rule_off};
|
390
|
390
|
my $type_rule_off_parts = {
|
391
|
|
- 1 => delete $args{type_rule1_off},
|
392
|
|
- 2 => delete $args{type_rule2_off}
|
|
391
|
+ 1 => $args{type_rule1_off},
|
|
392
|
+ 2 => $args{type_rule2_off}
|
393
|
393
|
};
|
394
|
|
- my $query_return = delete $args{query};
|
395
|
|
- my $table_alias = delete $args{table_alias} || {};
|
|
394
|
+ my $query_return = $args{query};
|
|
395
|
+ my $table_alias = $args{table_alias} || {};
|
396
|
396
|
my $after_build_sql = $args{after_build_sql} || $args{sqlfilter};
|
397
|
397
|
warn "sqlfilter option is DEPRECATED" if $args{sqlfilter};
|
398
|
|
- my $id = delete $args{id};
|
399
|
|
- my $primary_key = delete $args{primary_key};
|
|
398
|
+ my $id = $args{id};
|
|
399
|
+ my $primary_key = $args{primary_key};
|
400
|
400
|
croak "execute method primary_key option " .
|
401
|
401
|
"must be specified when id is specified " . _subname
|
402
|
402
|
if defined $id && !defined $primary_key;
|
403
|
403
|
$primary_key = [$primary_key] unless ref $primary_key eq 'ARRAY';
|
404
|
|
- my $append = delete $args{append};
|
|
404
|
+ my $append = $args{append};
|
405
|
405
|
$sql .= $append if defined $append && !ref $sql;
|
406
|
406
|
|
407
|
407
|
my $query
|
...
|
...
|
@@ -601,21 +601,20 @@ sub insert {
|
601
|
601
|
my $param;
|
602
|
602
|
$param = shift if @_ % 2;
|
603
|
603
|
my %args = @_;
|
604
|
|
- my $table = delete $args{table};
|
|
604
|
+ my $table = $args{table};
|
605
|
605
|
croak qq{"table" option must be specified } . _subname
|
606
|
606
|
unless defined $table;
|
607
|
|
- my $p = delete $args{param} || {};
|
|
607
|
+ my $p = $args{param} || {};
|
608
|
608
|
$param ||= $p;
|
609
|
|
- my $id = delete $args{id};
|
610
|
|
- my $primary_key = delete $args{primary_key};
|
|
609
|
+ my $id = $args{id};
|
|
610
|
+ my $primary_key = $args{primary_key};
|
611
|
611
|
croak "insert method primary_key option " .
|
612
|
612
|
"must be specified when id is specified " . _subname
|
613
|
613
|
if defined $id && !defined $primary_key;
|
614
|
614
|
$primary_key = [$primary_key] unless ref $primary_key eq 'ARRAY';
|
615
|
|
- my $prefix = delete $args{prefix};
|
616
|
|
- my $wrap = delete $args{wrap};
|
|
615
|
+ my $prefix = $args{prefix};
|
|
616
|
+ my $wrap = $args{wrap};
|
617
|
617
|
my $timestamp = $args{timestamp};
|
618
|
|
- delete $args{where};
|
619
|
618
|
|
620
|
619
|
# Timestamp
|
621
|
620
|
if ($timestamp && (my $insert_timestamp = $self->insert_timestamp)) {
|
...
|
...
|
@@ -649,16 +648,16 @@ sub update_or_insert {
|
649
|
648
|
# Arguments
|
650
|
649
|
my $param = shift;
|
651
|
650
|
my %args = @_;
|
652
|
|
- my $id = delete $args{id};
|
653
|
|
- my $primary_key = delete $args{primary_key};
|
|
651
|
+ my $id = $args{id};
|
|
652
|
+ my $primary_key = $args{primary_key};
|
654
|
653
|
$primary_key = [$primary_key] unless ref $primary_key eq 'ARRAY';
|
655
|
654
|
croak "update_or_insert method need primary_key option " .
|
656
|
655
|
"when id is specified" . _subname
|
657
|
656
|
if defined $id && !defined $primary_key;
|
658
|
|
- my $table = delete $args{table};
|
|
657
|
+ my $table = $args{table};
|
659
|
658
|
croak qq{"table" option must be specified } . _subname
|
660
|
659
|
unless defined $table;
|
661
|
|
- my $select_option = delete $args{select_option};
|
|
660
|
+ my $select_option = $args{select_option};
|
662
|
661
|
|
663
|
662
|
my $rows = $self->select(table => $table, id => $id,
|
664
|
663
|
primary_key => $primary_key, %$select_option)->all;
|