| ... | ... |
@@ -237,7 +237,6 @@ sub delete {
|
| 237 | 237 |
croak qq{"table" option must be specified. } . _subname
|
| 238 | 238 |
unless $table; |
| 239 | 239 |
my $where = delete $args{where} || {};
|
| 240 |
- my $append = delete $args{append};
|
|
| 241 | 240 |
my $allow_delete_all = delete $args{allow_delete_all};
|
| 242 | 241 |
my $where_param = delete $args{where_param} || {};
|
| 243 | 242 |
my $id = delete $args{id};
|
| ... | ... |
@@ -274,7 +273,6 @@ sub delete {
|
| 274 | 273 |
$sql .= "delete "; |
| 275 | 274 |
$sql .= "$prefix " if defined $prefix; |
| 276 | 275 |
$sql .= "from " . $self->_q($table) . " $where_clause "; |
| 277 |
- $sql .= $append if defined $append; |
|
| 278 | 276 |
|
| 279 | 277 |
# Execute query |
| 280 | 278 |
return $self->execute($sql, $where_param, table => $table, %args); |
| ... | ... |
@@ -408,6 +406,8 @@ sub execute {
|
| 408 | 406 |
"must be specified when id is specified " . _subname |
| 409 | 407 |
if defined $id && !defined $primary_key; |
| 410 | 408 |
$primary_key = [$primary_key] unless ref $primary_key eq 'ARRAY'; |
| 409 |
+ my $append = delete $args{append};
|
|
| 410 |
+ $query .= $append if defined $append && !ref $query; |
|
| 411 | 411 |
|
| 412 | 412 |
# Check argument names |
| 413 | 413 |
foreach my $name (keys %args) {
|
| ... | ... |
@@ -418,7 +418,6 @@ sub execute {
|
| 418 | 418 |
$query = $self->_create_query($query, $after_build_sql) unless ref $query; |
| 419 | 419 |
|
| 420 | 420 |
# Save query |
| 421 |
- if (ref $query eq 'DBIx::Custom::Result') { $DB::single = 1 }
|
|
| 422 | 421 |
$self->last_sql($query->sql); |
| 423 | 422 |
|
| 424 | 423 |
return $query if $query_return; |
| ... | ... |
@@ -617,7 +616,6 @@ sub insert {
|
| 617 | 616 |
unless defined $table; |
| 618 | 617 |
my $p = delete $args{param} || {};
|
| 619 | 618 |
$param ||= $p; |
| 620 |
- my $append = delete $args{append} || '';
|
|
| 621 | 619 |
my $id = delete $args{id};
|
| 622 | 620 |
my $primary_key = delete $args{primary_key};
|
| 623 | 621 |
croak "insert method primary_key option " . |
| ... | ... |
@@ -650,7 +648,6 @@ sub insert {
|
| 650 | 648 |
$sql .= "$prefix " if defined $prefix; |
| 651 | 649 |
$sql .= "into " . $self->_q($table) . " " |
| 652 | 650 |
. $self->values_clause($param, {wrap => $wrap}) . " ";
|
| 653 |
- $sql .= $append if defined $append; |
|
| 654 | 651 |
|
| 655 | 652 |
# Execute query |
| 656 | 653 |
return $self->execute($sql, $param, table => $table, %args); |
| ... | ... |
@@ -884,7 +881,6 @@ sub select {
|
| 884 | 881 |
: []; |
| 885 | 882 |
my $columns = delete $args{column};
|
| 886 | 883 |
my $where = delete $args{where} || {};
|
| 887 |
- my $append = delete $args{append};
|
|
| 888 | 884 |
my $join = delete $args{join} || [];
|
| 889 | 885 |
croak qq{"join" must be array reference } . _subname
|
| 890 | 886 |
unless ref $join eq 'ARRAY'; |
| ... | ... |
@@ -987,9 +983,6 @@ sub select {
|
| 987 | 983 |
$self->_push_relation(\$sql, $tables, $relation, $where_clause eq '' ? 1 : 0) |
| 988 | 984 |
if $relation; |
| 989 | 985 |
|
| 990 |
- # Append |
|
| 991 |
- $sql .= $append if defined $append; |
|
| 992 |
- |
|
| 993 | 986 |
# Execute query |
| 994 | 987 |
my $result = $self->execute($sql, $where_param, table => $tables, %args); |
| 995 | 988 |
|
| ... | ... |
@@ -1130,7 +1123,6 @@ sub update {
|
| 1130 | 1123 |
$param ||= $p; |
| 1131 | 1124 |
my $where = delete $args{where} || {};
|
| 1132 | 1125 |
my $where_param = delete $args{where_param} || {};
|
| 1133 |
- my $append = delete $args{append} || '';
|
|
| 1134 | 1126 |
my $allow_update_all = delete $args{allow_update_all};
|
| 1135 | 1127 |
my $id = delete $args{id};
|
| 1136 | 1128 |
my $primary_key = delete $args{primary_key};
|
| ... | ... |
@@ -1183,7 +1175,6 @@ sub update {
|
| 1183 | 1175 |
$sql .= "update "; |
| 1184 | 1176 |
$sql .= "$prefix " if defined $prefix; |
| 1185 | 1177 |
$sql .= $self->_q($table) . " set $assign_clause $where_clause "; |
| 1186 |
- $sql .= $append if defined $append; |
|
| 1187 | 1178 |
|
| 1188 | 1179 |
# Execute query |
| 1189 | 1180 |
return $self->execute($sql, $param, table => $table, %args); |
| ... | ... |
@@ -2812,7 +2803,10 @@ as parameter value. |
| 2812 | 2803 |
|
| 2813 | 2804 |
{date => \"NOW()"}
|
| 2814 | 2805 |
|
| 2815 |
-The following opitons are available. |
|
| 2806 |
+B<options> |
|
| 2807 |
+ |
|
| 2808 |
+C<insert> method use all of C<execute> method options, |
|
| 2809 |
+and use the following new ones. |
|
| 2816 | 2810 |
|
| 2817 | 2811 |
=over 4 |
| 2818 | 2812 |
|
| ... | ... |
@@ -2820,14 +2814,6 @@ The following opitons are available. |
| 2820 | 2814 |
|
| 2821 | 2815 |
Same as C<select> method's C<append> option. |
| 2822 | 2816 |
|
| 2823 |
-=item C<bind_type> |
|
| 2824 |
- |
|
| 2825 |
-Same as C<execute> method's C<bind_type> option. |
|
| 2826 |
- |
|
| 2827 |
-=item C<filter> |
|
| 2828 |
- |
|
| 2829 |
-Same as C<execute> method's C<filter> option. |
|
| 2830 |
- |
|
| 2831 | 2817 |
=item C<id> |
| 2832 | 2818 |
|
| 2833 | 2819 |
id => 4 |
| ... | ... |
@@ -2858,21 +2844,6 @@ prefix before table name section |
| 2858 | 2844 |
|
| 2859 | 2845 |
insert or replace into book |
| 2860 | 2846 |
|
| 2861 |
-=item C<primary_key> |
|
| 2862 |
- |
|
| 2863 |
- primary_key => 'id' |
|
| 2864 |
- primary_key => ['id1', 'id2'] |
|
| 2865 |
- |
|
| 2866 |
-Primary key. This is used by C<id> option. |
|
| 2867 |
- |
|
| 2868 |
-=item C<query> |
|
| 2869 |
- |
|
| 2870 |
-Same as C<execute> method's C<query> option. |
|
| 2871 |
- |
|
| 2872 |
-=item C<after_build_sql> |
|
| 2873 |
- |
|
| 2874 |
-Same as C<execute> method's C<after_build_sql> option. |
|
| 2875 |
- |
|
| 2876 | 2847 |
=item C<table> |
| 2877 | 2848 |
|
| 2878 | 2849 |
table => 'book' |
| ... | ... |
@@ -2983,11 +2954,11 @@ is automatically set to the value like "2010-10-11 10:12:54". |
| 2983 | 2954 |
|
| 2984 | 2955 |
$dbi->insert($param, table => 'book', timestamp => 1); |
| 2985 | 2956 |
|
| 2986 |
-=head2 C<like_value EXPERIMENTAL> |
|
| 2957 |
+=head2 C<like_value> |
|
| 2987 | 2958 |
|
| 2988 | 2959 |
my $like_value = $dbi->like_value |
| 2989 | 2960 |
|
| 2990 |
-Constant code reference for the like value. |
|
| 2961 |
+Code reference which return a value for the like value. |
|
| 2991 | 2962 |
|
| 2992 | 2963 |
sub { "%$_[0]%" }
|
| 2993 | 2964 |
|
| ... | ... |
@@ -3001,15 +2972,18 @@ Create a new L<DBIx::Custom::Mapper> object. |
| 3001 | 2972 |
|
| 3002 | 2973 |
my $param = $dbi->merge_param({key1 => 1}, {key1 => 1, key2 => 2});
|
| 3003 | 2974 |
|
| 3004 |
-Merge parameters. |
|
| 2975 |
+Merge parameters. The following new parameter is created. |
|
| 3005 | 2976 |
|
| 3006 | 2977 |
{key1 => [1, 1], key2 => 2}
|
| 3007 | 2978 |
|
| 2979 |
+If same keys contains, the value is converted to array reference. |
|
| 2980 |
+ |
|
| 3008 | 2981 |
=head2 C<model> |
| 3009 | 2982 |
|
| 3010 | 2983 |
my $model = $dbi->model('book');
|
| 3011 | 2984 |
|
| 3012 |
-Get a L<DBIx::Custom::Model> object, |
|
| 2985 |
+Get a L<DBIx::Custom::Model> object |
|
| 2986 |
+create by C<create_model> or C<include_model> |
|
| 3013 | 2987 |
|
| 3014 | 2988 |
=head2 C<mycolumn> |
| 3015 | 2989 |
|
| ... | ... |
@@ -3036,7 +3010,7 @@ Create a new L<DBIx::Custom> object. |
| 3036 | 3010 |
my $not_exists = $dbi->not_exists; |
| 3037 | 3011 |
|
| 3038 | 3012 |
DBIx::Custom::NotExists object, indicating the column is not exists. |
| 3039 |
-This is used by C<clause> of L<DBIx::Custom::Where> . |
|
| 3013 |
+This is used in C<param> of L<DBIx::Custom::Where> . |
|
| 3040 | 3014 |
|
| 3041 | 3015 |
=head2 C<order> |
| 3042 | 3016 |
|