... | ... |
@@ -1765,7 +1765,6 @@ sub select_at { |
1765 | 1765 |
|
1766 | 1766 |
# Options |
1767 | 1767 |
my $primary_keys = delete $opt{primary_key}; |
1768 |
- $primary_keys = [$primary_keys] unless ref $primary_keys; |
|
1769 | 1768 |
my $where = delete $opt{where}; |
1770 | 1769 |
my $param = delete $opt{param}; |
1771 | 1770 |
|
... | ... |
@@ -1788,7 +1787,6 @@ sub delete_at { |
1788 | 1787 |
|
1789 | 1788 |
# Options |
1790 | 1789 |
my $primary_keys = delete $opt{primary_key}; |
1791 |
- $primary_keys = [$primary_keys] unless ref $primary_keys; |
|
1792 | 1790 |
my $where = delete $opt{where}; |
1793 | 1791 |
|
1794 | 1792 |
# Create where parameter |
... | ... |
@@ -1808,7 +1806,6 @@ sub update_at { |
1808 | 1806 |
$param = shift if @_ % 2; |
1809 | 1807 |
my %opt = @_; |
1810 | 1808 |
my $primary_keys = delete $opt{primary_key}; |
1811 |
- $primary_keys = [$primary_keys] unless ref $primary_keys; |
|
1812 | 1809 |
my $where = delete $opt{where}; |
1813 | 1810 |
my $p = delete $opt{param} || {}; |
1814 | 1811 |
$param ||= $p; |
... | ... |
@@ -59,7 +59,7 @@ for my $method (@methods) { |
59 | 59 |
elsif (index($method, 'select') != -1) { push @attrs, @select_attrs } |
60 | 60 |
|
61 | 61 |
for my $attr (@attrs) { |
62 |
- $code .= "$attr => exists \$self->{$attr} ? \$self->{$attr} : \$self->$attr,"; |
|
62 |
+ $code .= "exists \$self->{$attr} ? ($attr => \$self->{$attr}) : (),"; |
|
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
$code .= qq/\@_);/ . |
... | ... |
@@ -116,6 +116,13 @@ sub new { |
116 | 116 |
unless $self->can($attr); |
117 | 117 |
} |
118 | 118 |
|
119 |
+ # Cache |
|
120 |
+ for my $attr (qw/dbi table created_at updated_at bind_type join primary_key/) { |
|
121 |
+ $self->$attr; |
|
122 |
+ $self->{$attr} = undef unless exists $self->{$attr}; |
|
123 |
+ } |
|
124 |
+ $self->columns; |
|
125 |
+ |
|
119 | 126 |
return $self; |
120 | 127 |
} |
121 | 128 |
|