... | ... |
@@ -2040,6 +2040,12 @@ These filters are added to the C<out> filters, set by C<apply_filter()>. |
2040 | 2040 |
C<filter> option is also available |
2041 | 2041 |
by C<insert()>, C<update()>, C<delete()>, C<select()> |
2042 | 2042 |
|
2043 |
+=item C<query> |
|
2044 |
+ |
|
2045 |
+ query => 1 |
|
2046 |
+ |
|
2047 |
+C<execute> method return L<DBIx::Custom::Query> object, not executing SQL. |
|
2048 |
+ |
|
2043 | 2049 |
=item C<type> |
2044 | 2050 |
|
2045 | 2051 |
Specify database data type. |
... | ... |
@@ -2066,79 +2072,49 @@ Trun type rule off. |
2066 | 2072 |
|
2067 | 2073 |
$dbi->delete(table => 'book', where => {title => 'Perl'}); |
2068 | 2074 |
|
2069 |
-Delete statement. |
|
2075 |
+Execute delete statement. |
|
2070 | 2076 |
|
2071 |
-The following opitons are currently available. |
|
2077 |
+The following opitons are available. |
|
2072 | 2078 |
|
2073 | 2079 |
=over 4 |
2074 | 2080 |
|
2075 |
-=item C<table> |
|
2076 |
- |
|
2077 |
-Table name. |
|
2078 |
- |
|
2079 |
- $dbi->delete(table => 'book'); |
|
2080 |
- |
|
2081 |
-=item C<where> |
|
2082 |
- |
|
2083 |
-Where clause. This is hash reference or L<DBIx::Custom::Where> object |
|
2084 |
-or array refrence, which contains where clause and paramter. |
|
2085 |
- |
|
2086 |
- # Hash reference |
|
2087 |
- $dbi->delete(where => {title => 'Perl'}); |
|
2088 |
- |
|
2089 |
- # DBIx::Custom::Where object |
|
2090 |
- my $where = $dbi->where( |
|
2091 |
- clause => ['and', 'author = :author', 'title like :title'], |
|
2092 |
- param => {author => 'Ken', title => '%Perl%'} |
|
2093 |
- ); |
|
2094 |
- $dbi->delete(where => $where); |
|
2095 |
- |
|
2096 |
- # String(with where_param option) |
|
2097 |
- $dbi->delete( |
|
2098 |
- where => 'title like :title', |
|
2099 |
- where_param => {title => '%Perl%'} |
|
2100 |
- ); |
|
2101 |
- |
|
2102 | 2081 |
=item C<append> |
2103 | 2082 |
|
2104 |
-Append statement to last of SQL. This is string. |
|
2105 |
- |
|
2106 |
- $dbi->delete(append => 'order by title'); |
|
2083 |
+Same as C<select> method's C<append> option. |
|
2107 | 2084 |
|
2108 | 2085 |
=item C<filter> |
2109 | 2086 |
|
2110 | 2087 |
Same as C<execute> method's C<filter> option. |
2111 | 2088 |
|
2112 |
-=item C<query> |
|
2089 |
+=item C<id> |
|
2113 | 2090 |
|
2114 |
-Get L<DBIx::Custom::Query> object instead of executing SQL. |
|
2115 |
-This is true or false value. |
|
2091 |
+ id => 4 |
|
2092 |
+ id => [4, 5] |
|
2116 | 2093 |
|
2117 |
- my $query = $dbi->delete(query => 1); |
|
2094 |
+ID corresponding to C<primary_key>. |
|
2095 |
+You can delete rows by C<id> and C<primary_key>. |
|
2118 | 2096 |
|
2119 |
-You can check SQL. |
|
2097 |
+ $dbi->delete( |
|
2098 |
+ parimary_key => ['id1', 'id2'], |
|
2099 |
+ id => [4, 5], |
|
2100 |
+ table => 'book', |
|
2101 |
+ ); |
|
2120 | 2102 |
|
2121 |
- my $sql = $query->sql; |
|
2103 |
+The above is same as the followin one. |
|
2122 | 2104 |
|
2123 |
-=item C<id> |
|
2105 |
+ $dbi->delete(where => {id1 => 4, id2 => 5}, table => 'book'); |
|
2124 | 2106 |
|
2125 |
-Delete using primary_key. |
|
2107 |
+=item C<query> |
|
2126 | 2108 |
|
2127 |
- $dbi->delete( |
|
2128 |
- primary_key => 'id', |
|
2129 |
- id => 4, |
|
2130 |
- ); |
|
2109 |
+Same as C<execute> method's C<query> option. |
|
2131 | 2110 |
|
2132 |
- $dbi->delete( |
|
2133 |
- primary_key => ['id1', 'id2'], |
|
2134 |
- id => [4, 5], |
|
2135 |
- ); |
|
2111 |
+=item C<table> |
|
2136 | 2112 |
|
2137 |
-The above is same as the followin ones. |
|
2113 |
+ table => 'book' |
|
2138 | 2114 |
|
2139 |
- $dbi->delete(where => {id => 4}); |
|
2115 |
+=item C<where> |
|
2140 | 2116 |
|
2141 |
- $dbi->delete(where => {id1 => 4, id2 => 5}); |
|
2117 |
+Same as C<select> method's C<where> option. |
|
2142 | 2118 |
|
2143 | 2119 |
=item C<primary_key> |
2144 | 2120 |
|
... | ... |
@@ -2158,7 +2134,7 @@ Same as C<execute> method's C<type_rule_off> option. |
2158 | 2134 |
|
2159 | 2135 |
$dbi->delete_all(table => $table); |
2160 | 2136 |
|
2161 |
-Delete statement to delete all rows. |
|
2137 |
+Execute delete statement for all rows. |
|
2162 | 2138 |
Options is same as C<delete()>. |
2163 | 2139 |
|
2164 | 2140 |
=head2 C<insert> |
... | ... |
@@ -2179,52 +2155,34 @@ Same as C<select> method's C<append> option. |
2179 | 2155 |
|
2180 | 2156 |
Same as C<execute> method's C<filter> option. |
2181 | 2157 |
|
2182 |
-=item C<query> |
|
2183 |
- |
|
2184 |
-Get L<DBIx::Custom::Query> object instead of executing SQL. |
|
2185 |
-This is true or false value. |
|
2186 |
- |
|
2187 |
- my $query = $dbi->insert(query => 1); |
|
2188 |
- |
|
2189 |
-You can check SQL. |
|
2190 |
- |
|
2191 |
- my $sql = $query->sql; |
|
2192 |
- |
|
2193 | 2158 |
=item C<id> |
2194 | 2159 |
|
2195 |
-Insert using primary_key. |
|
2160 |
+ id => 4 |
|
2161 |
+ id => [4, 5] |
|
2196 | 2162 |
|
2197 |
- $dbi->insert( |
|
2198 |
- primary_key => 'id', |
|
2199 |
- id => 4, |
|
2200 |
- param => {title => 'Perl', author => 'Ken'} |
|
2201 |
- ); |
|
2163 |
+ID corresponding to C<primary_key>. |
|
2164 |
+You can insert a row by C<id> and C<primary_key>. |
|
2202 | 2165 |
|
2203 | 2166 |
$dbi->insert( |
2204 |
- primary_key => ['id1', 'id2'], |
|
2167 |
+ {title => 'Perl', author => 'Ken'} |
|
2168 |
+ parimary_key => ['id1', 'id2'], |
|
2205 | 2169 |
id => [4, 5], |
2206 |
- param => {title => 'Perl', author => 'Ken'} |
|
2170 |
+ table => 'book' |
|
2207 | 2171 |
); |
2208 | 2172 |
|
2209 |
-The above is same as the followin ones. |
|
2210 |
- |
|
2211 |
- $dbi->insert( |
|
2212 |
- param => {id => 4, title => 'Perl', author => 'Ken'} |
|
2213 |
- ); |
|
2173 |
+The above is same as the followin one. |
|
2214 | 2174 |
|
2215 | 2175 |
$dbi->insert( |
2216 |
- param => {id1 => 4, id2 => 5, title => 'Perl', author => 'Ken'} |
|
2176 |
+ {id1 => 4, id2 => 5, title => 'Perl', author => 'Ken'}, |
|
2177 |
+ table => 'book' |
|
2217 | 2178 |
); |
2218 | 2179 |
|
2219 | 2180 |
=item C<primary_key> |
2220 | 2181 |
|
2221 |
-See C<id> description. |
|
2182 |
+ primary_key => 'id' |
|
2183 |
+ primary_key => ['id1', 'id2'] |
|
2222 | 2184 |
|
2223 |
-=item C<table> |
|
2224 |
- |
|
2225 |
-Table name. |
|
2226 |
- |
|
2227 |
- $dbi->insert(table => 'book'); |
|
2185 |
+Primary key. This is used by C<id> option. |
|
2228 | 2186 |
|
2229 | 2187 |
=item C<param> |
2230 | 2188 |
|
... | ... |
@@ -2237,13 +2195,23 @@ first argument is received as C<param>. |
2237 | 2195 |
|
2238 | 2196 |
$dbi->insert({title => 'Perl', author => 'Ken'}, table => 'book'); |
2239 | 2197 |
|
2198 |
+=item C<query> |
|
2199 |
+ |
|
2200 |
+Same as C<execute> method's C<query> option. |
|
2201 |
+ |
|
2202 |
+=item C<table> |
|
2203 |
+ |
|
2204 |
+ table => 'book' |
|
2205 |
+ |
|
2206 |
+Table name. |
|
2207 |
+ |
|
2240 | 2208 |
=item C<type> |
2241 | 2209 |
|
2242 | 2210 |
Same as C<execute> method's C<type> option. |
2243 | 2211 |
|
2244 | 2212 |
=item C<type_rule_off> EXPERIMENTAL |
2245 | 2213 |
|
2246 |
-Turn type rule off. |
|
2214 |
+Same as C<execute> method's C<type_rule_off> option. |
|
2247 | 2215 |
|
2248 | 2216 |
=back |
2249 | 2217 |
|
... | ... |
@@ -2413,92 +2381,99 @@ Filter based on type. |
2413 | 2381 |
where => {author => 'Ken'}, |
2414 | 2382 |
); |
2415 | 2383 |
|
2416 |
-Select statement. |
|
2384 |
+Execute select statement. |
|
2417 | 2385 |
|
2418 |
-The following opitons are currently available. |
|
2386 |
+The following opitons are available. |
|
2419 | 2387 |
|
2420 | 2388 |
=over 4 |
2421 | 2389 |
|
2422 |
-=item C<table> |
|
2423 |
- |
|
2424 |
-Table name. |
|
2390 |
+=item C<append> |
|
2425 | 2391 |
|
2426 |
- $dbi->select(table => 'book'); |
|
2392 |
+ append => 'order by title' |
|
2427 | 2393 |
|
2394 |
+Append statement to last of SQL. |
|
2395 |
+ |
|
2428 | 2396 |
=item C<column> |
2429 |
- |
|
2430 |
-Column clause. This is array reference or constant value. |
|
2431 |
- |
|
2432 |
- # Array reference |
|
2433 |
- $dbi->select(column => ['author', 'title']); |
|
2434 | 2397 |
|
2435 |
- # Constant value |
|
2436 |
- $dbi->select(column => 'author'); |
|
2398 |
+ column => 'author' |
|
2399 |
+ column => ['author', 'title'] |
|
2400 |
+ |
|
2401 |
+Column clause. |
|
2437 | 2402 |
|
2438 |
-Default is '*' if C<column> is not specified. |
|
2403 |
+if C<column> is not specified, '*' is set. |
|
2439 | 2404 |
|
2440 |
- # Default |
|
2441 |
- $dbi->select(column => '*'); |
|
2405 |
+ column => '*' |
|
2442 | 2406 |
|
2443 |
-You can specify hash reference. This is EXPERIMENTAL. |
|
2407 |
+You can specify hash reference in array reference. This is EXPERIMENTAL. |
|
2444 | 2408 |
|
2445 |
- # Hash reference EXPERIMENTAL |
|
2446 |
- $dbi->select(column => [ |
|
2409 |
+ column => [ |
|
2447 | 2410 |
{book => [qw/author title/]}, |
2448 | 2411 |
{person => [qw/name age/]} |
2449 |
- ]); |
|
2412 |
+ ] |
|
2450 | 2413 |
|
2451 |
-This is expanded to the following one by C<col> method automatically. |
|
2414 |
+This is expanded to the following one by using C<col> method. |
|
2452 | 2415 |
|
2453 | 2416 |
book.author as "book.author", |
2454 | 2417 |
book.title as "book.title", |
2455 | 2418 |
person.name as "person.name", |
2456 | 2419 |
person.age as "person.age" |
2457 | 2420 |
|
2458 |
-You can specify array reference in array refernce. |
|
2421 |
+You can specify array reference in array reference. |
|
2459 | 2422 |
|
2460 |
- $dbi->select(column => [ |
|
2423 |
+ column => [ |
|
2461 | 2424 |
['date(book.register_datetime)', as => 'book.register_date'] |
2462 |
- ]); |
|
2425 |
+ ]; |
|
2463 | 2426 |
|
2464 |
-These is joined and quoted. |
|
2427 |
+Alias is quoted and joined. |
|
2465 | 2428 |
|
2466 | 2429 |
date(book.register_datetime) as "book.register_date" |
2467 | 2430 |
|
2468 |
-=item C<where> |
|
2431 |
+=item C<filter> |
|
2469 | 2432 |
|
2470 |
-Where clause. This is hash reference or L<DBIx::Custom::Where> object, |
|
2471 |
-or array refrence, which contains where clause and paramter. |
|
2472 |
- |
|
2473 |
- # Hash reference |
|
2474 |
- $dbi->select(where => {author => 'Ken', 'title' => 'Perl'}); |
|
2475 |
- |
|
2476 |
- # DBIx::Custom::Where object |
|
2477 |
- my $where = $dbi->where( |
|
2478 |
- clause => ['and', 'author = :author', 'title like :title'], |
|
2479 |
- param => {author => 'Ken', title => '%Perl%'} |
|
2433 |
+Same as C<execute> method's C<filter> option. |
|
2434 |
+ |
|
2435 |
+=item C<id> |
|
2436 |
+ |
|
2437 |
+ id => 4 |
|
2438 |
+ id => [4, 5] |
|
2439 |
+ |
|
2440 |
+ID corresponding to C<primary_key>. |
|
2441 |
+You can select rows by C<id> and C<primary_key>. |
|
2442 |
+ |
|
2443 |
+ $dbi->select( |
|
2444 |
+ parimary_key => ['id1', 'id2'], |
|
2445 |
+ id => [4, 5], |
|
2446 |
+ table => 'book' |
|
2480 | 2447 |
); |
2481 |
- $dbi->select(where => $where); |
|
2482 | 2448 |
|
2483 |
- # String(with where_param option) |
|
2449 |
+The above is same as the followin one. |
|
2450 |
+ |
|
2484 | 2451 |
$dbi->select( |
2485 |
- where => 'title like :title', |
|
2486 |
- where_param => {title => '%Perl%'} |
|
2452 |
+ where => {id1 => 4, id2 => 5}, |
|
2453 |
+ table => 'book' |
|
2487 | 2454 |
); |
2488 | 2455 |
|
2489 |
-=item C<join> |
|
2456 |
+=item C<param> EXPERIMETNAL |
|
2490 | 2457 |
|
2491 |
-Join clause used in need. This is array reference. |
|
2458 |
+ param => {'table2.key3' => 5} |
|
2492 | 2459 |
|
2493 |
- $dbi->select(join => |
|
2494 |
- [ |
|
2495 |
- 'left outer join company on book.company_id = company_id', |
|
2496 |
- 'left outer join location on company.location_id = location.id' |
|
2497 |
- ] |
|
2498 |
- ); |
|
2460 |
+Parameter shown before where clause. |
|
2461 |
+ |
|
2462 |
+For example, if you want to contain tag in join clause, |
|
2463 |
+you can pass parameter by C<param> option. |
|
2499 | 2464 |
|
2500 |
-If column cluase or where clause contain table name like "company.name", |
|
2501 |
-needed join clause is used automatically. |
|
2465 |
+ join => ['inner join (select * from table2 where table2.key3 = :table2.key3)' . |
|
2466 |
+ ' as table2 on table1.key1 = table2.key1'] |
|
2467 |
+ |
|
2468 |
+=item C<join> |
|
2469 |
+ |
|
2470 |
+ join => [ |
|
2471 |
+ 'left outer join company on book.company_id = company_id', |
|
2472 |
+ 'left outer join location on company.location_id = location.id' |
|
2473 |
+ ] |
|
2474 |
+ |
|
2475 |
+Join clause. If column cluase or where clause contain table name like "company.name", |
|
2476 |
+join clausees needed when SQL is created is used automatically. |
|
2502 | 2477 |
|
2503 | 2478 |
$dbi->select( |
2504 | 2479 |
table => 'book', |
... | ... |
@@ -2510,59 +2485,56 @@ needed join clause is used automatically. |
2510 | 2485 |
] |
2511 | 2486 |
); |
2512 | 2487 |
|
2513 |
-In above select, the following SQL is created. |
|
2488 |
+In above select, column and where clause contain "company" table, |
|
2489 |
+the following SQL is created |
|
2514 | 2490 |
|
2515 | 2491 |
select company.location_id as company__location_id |
2516 | 2492 |
from book |
2517 | 2493 |
left outer join company on book.company_id = company.id |
2518 | 2494 |
where company.name = Orange |
2519 | 2495 |
|
2520 |
-=item C<param> EXPERIMETNAL |
|
2496 |
+=item C<primary_key> |
|
2521 | 2497 |
|
2522 |
-Parameter shown before where clause. |
|
2523 |
- |
|
2524 |
- $dbi->select( |
|
2525 |
- table => 'table1', |
|
2526 |
- column => 'table1.key1 as table1_key1, key2, key3', |
|
2527 |
- where => {'table1.key2' => 3}, |
|
2528 |
- join => ['inner join (select * from table2 where table2.key3 = :table2.key3)' . |
|
2529 |
- ' as table2 on table1.key1 = table2.key1'], |
|
2530 |
- param => {'table2.key3' => 5} |
|
2531 |
- ); |
|
2498 |
+ primary_key => 'id' |
|
2499 |
+ primary_key => ['id1', 'id2'] |
|
2532 | 2500 |
|
2533 |
-For example, if you want to contain tag in join clause, |
|
2534 |
-you can pass parameter by C<param> option. |
|
2501 |
+Primary key. This is used by C<id> option. |
|
2535 | 2502 |
|
2536 |
-=item C<append> |
|
2503 |
+=item C<query> |
|
2537 | 2504 |
|
2538 |
-Append statement to last of SQL. This is string. |
|
2505 |
+Same as C<execute> method's C<query> option. |
|
2539 | 2506 |
|
2540 |
- $dbi->select(append => 'order by title'); |
|
2541 |
- |
|
2542 |
-=item C<id> |
|
2507 |
+=item C<type> |
|
2543 | 2508 |
|
2544 |
-Select using primary_key. |
|
2509 |
+Same as C<execute> method's C<type> option. |
|
2545 | 2510 |
|
2546 |
- $dbi->select( |
|
2547 |
- primary_key => 'id', |
|
2548 |
- id => 4, |
|
2549 |
- ); |
|
2511 |
+=item C<table> |
|
2550 | 2512 |
|
2551 |
- $dbi->select( |
|
2552 |
- primary_key => ['id1', 'id2'], |
|
2553 |
- id => [4, 5] |
|
2554 |
- ); |
|
2513 |
+ table => 'book' |
|
2555 | 2514 |
|
2556 |
-The above is same as the followin ones. |
|
2515 |
+Table name. |
|
2557 | 2516 |
|
2558 |
- $dbi->insert(where => {id => 4}); |
|
2517 |
+=item C<type_rule_off> EXPERIMENTAL |
|
2559 | 2518 |
|
2560 |
- $dbi->insert(where => {id1 => 4, id2 => 5}); |
|
2519 |
+Same as C<execute> method's C<type_rule_off> option. |
|
2561 | 2520 |
|
2562 |
-=item C<primary_key> |
|
2521 |
+=item C<where> |
|
2522 |
+ |
|
2523 |
+ # Hash refrence |
|
2524 |
+ where => {author => 'Ken', 'title' => 'Perl'} |
|
2525 |
+ |
|
2526 |
+ # DBIx::Custom::Where object |
|
2527 |
+ where => $dbi->where( |
|
2528 |
+ clause => ['and', 'author = :author', 'title like :title'], |
|
2529 |
+ param => {author => 'Ken', title => '%Perl%'} |
|
2530 |
+ ); |
|
2563 | 2531 |
|
2564 |
-See C<id> option. |
|
2532 |
+ # String(with where_param option) |
|
2533 |
+ where => 'title like :title', |
|
2534 |
+ where_param => {title => '%Perl%'} |
|
2565 | 2535 |
|
2536 |
+Where clause. |
|
2537 |
+ |
|
2566 | 2538 |
=item C<wrap> EXPERIMENTAL |
2567 | 2539 |
|
2568 | 2540 |
Wrap statement. This is array reference. |
... | ... |
@@ -2571,139 +2543,79 @@ Wrap statement. This is array reference. |
2571 | 2543 |
|
2572 | 2544 |
This option is for Oracle and SQL Server paging process. |
2573 | 2545 |
|
2574 |
-=item C<filter> |
|
2575 |
- |
|
2576 |
-Same as C<execute> method's C<filter> option. |
|
2577 |
- |
|
2578 |
-=item C<query> |
|
2579 |
- |
|
2580 |
-Get L<DBIx::Custom::Query> object instead of executing SQL. |
|
2581 |
-This is true or false value. |
|
2582 |
- |
|
2583 |
- my $query = $dbi->select(query => 1); |
|
2584 |
- |
|
2585 |
-You can check SQL. |
|
2586 |
- |
|
2587 |
- my $sql = $query->sql; |
|
2588 |
- |
|
2589 |
-=item C<type> |
|
2590 |
- |
|
2591 |
-Same as C<execute> method's C<type> option. |
|
2592 |
- |
|
2593 |
-=item C<type_rule_off> EXPERIMENTAL |
|
2594 |
- |
|
2595 |
-Same as C<execute> method's C<type_rule_off> option. |
|
2596 |
- |
|
2597 | 2546 |
=back |
2598 | 2547 |
|
2599 | 2548 |
=head2 C<update> |
2600 | 2549 |
|
2601 |
- $dbi->update( |
|
2602 |
- table => 'book', |
|
2603 |
- param => {title => 'Perl'}, |
|
2604 |
- where => {id => 4} |
|
2605 |
- ); |
|
2550 |
+ $dbi->update({title => 'Perl'}, table => 'book', where => {id => 4}); |
|
2606 | 2551 |
|
2607 |
-Update statement. |
|
2552 |
+Execute update statement. |
|
2608 | 2553 |
|
2609 |
-The following opitons are currently available. |
|
2554 |
+The following opitons are available. |
|
2610 | 2555 |
|
2611 | 2556 |
=over 4 |
2612 | 2557 |
|
2613 |
-=item C<param> |
|
2614 |
- |
|
2615 |
-Update data. This is hash reference. |
|
2616 |
- |
|
2617 |
- $dbi->update(param => {title => 'Perl'}); |
|
2558 |
+=item C<append> |
|
2618 | 2559 |
|
2619 |
-If arguments is odd numbers, first argument is received as C<param>. |
|
2560 |
+Same as C<select> method's C<append> option. |
|
2620 | 2561 |
|
2621 |
- $dbi->update( |
|
2622 |
- {title => 'Perl'}, |
|
2623 |
- table => 'book', |
|
2624 |
- where => {author => 'Ken'} |
|
2625 |
- ); |
|
2562 |
+=item C<filter> |
|
2626 | 2563 |
|
2627 |
-=item C<table> |
|
2564 |
+Same as C<execute> method's C<filter> option. |
|
2628 | 2565 |
|
2629 |
-Table name. |
|
2566 |
+=item C<id> |
|
2630 | 2567 |
|
2631 |
- $dbi->update(table => 'book'); |
|
2568 |
+ id => 4 |
|
2569 |
+ id => [4, 5] |
|
2632 | 2570 |
|
2633 |
-=item C<where> |
|
2571 |
+ID corresponding to C<primary_key>. |
|
2572 |
+You can update rows by C<id> and C<primary_key>. |
|
2634 | 2573 |
|
2635 |
-Where clause. This is hash reference or L<DBIx::Custom::Where> object |
|
2636 |
-or array refrence. |
|
2637 |
- |
|
2638 |
- # Hash reference |
|
2639 |
- $dbi->update(where => {author => 'Ken', 'title' => 'Perl'}); |
|
2640 |
- |
|
2641 |
- # DBIx::Custom::Where object |
|
2642 |
- my $where = $dbi->where( |
|
2643 |
- clause => ['and', 'author = :author', 'title like :title'], |
|
2644 |
- param => {author => 'Ken', title => '%Perl%'} |
|
2645 |
- ); |
|
2646 |
- $dbi->update(where => $where); |
|
2647 |
- |
|
2648 |
- # String(with where_param option) |
|
2649 | 2574 |
$dbi->update( |
2650 |
- param => {title => 'Perl'}, |
|
2651 |
- where => 'id = :id', |
|
2652 |
- where_param => {id => 2} |
|
2575 |
+ {title => 'Perl', author => 'Ken'} |
|
2576 |
+ parimary_key => ['id1', 'id2'], |
|
2577 |
+ id => [4, 5], |
|
2578 |
+ table => 'book' |
|
2653 | 2579 |
); |
2654 |
- |
|
2655 |
-=item C<append> |
|
2656 | 2580 |
|
2657 |
-Append statement to last of SQL. This is string. |
|
2581 |
+The above is same as the followin one. |
|
2658 | 2582 |
|
2659 |
- $dbi->update(append => 'order by title'); |
|
2660 |
- |
|
2661 |
-=item C<filter> |
|
2583 |
+ $dbi->update( |
|
2584 |
+ {title => 'Perl', author => 'Ken'} |
|
2585 |
+ where => {id1 => 4, id2 => 5}, |
|
2586 |
+ table => 'book' |
|
2587 |
+ ); |
|
2662 | 2588 |
|
2663 |
-Same as C<execute> method's C<filter> option. |
|
2589 |
+=item C<param> |
|
2664 | 2590 |
|
2665 |
-=item C<query> |
|
2591 |
+ param => {title => 'Perl'} |
|
2666 | 2592 |
|
2667 |
-Get L<DBIx::Custom::Query> object instead of executing SQL. |
|
2668 |
-This is true or false value. |
|
2593 |
+Update data. |
|
2669 | 2594 |
|
2670 |
- my $query = $dbi->update(query => 1); |
|
2595 |
+If C<update> method's arguments is odd numbers, first argument is received as C<param>. |
|
2671 | 2596 |
|
2672 |
-You can check SQL. |
|
2597 |
+ $dbi->update({title => 'Perl'}, table => 'book', where => {id => 2}); |
|
2673 | 2598 |
|
2674 |
- my $sql = $query->sql; |
|
2599 |
+=item C<primary_key> |
|
2675 | 2600 |
|
2676 |
-=item C<id> |
|
2601 |
+ primary_key => 'id' |
|
2602 |
+ primary_key => ['id1', 'id2'] |
|
2677 | 2603 |
|
2678 |
-update using primary_key. |
|
2604 |
+Primary key. This is used by C<id> option. |
|
2679 | 2605 |
|
2680 |
- $dbi->update( |
|
2681 |
- primary_key => 'id', |
|
2682 |
- id => 4, |
|
2683 |
- param => {title => 'Perl', author => 'Ken'} |
|
2684 |
- ); |
|
2606 |
+=item C<query> |
|
2685 | 2607 |
|
2686 |
- $dbi->update( |
|
2687 |
- primary_key => ['id1', 'id2'], |
|
2688 |
- id => [4, 5], |
|
2689 |
- param => {title => 'Perl', author => 'Ken'} |
|
2690 |
- ); |
|
2608 |
+Same as C<execute> method's C<query> option. |
|
2691 | 2609 |
|
2692 |
-The above is same as the followin ones. |
|
2610 |
+=item C<table> |
|
2693 | 2611 |
|
2694 |
- $dbi->update( |
|
2695 |
- where => {id => 4} |
|
2696 |
- param => {title => 'Perl', author => 'Ken'} |
|
2697 |
- ); |
|
2612 |
+ table => 'book' |
|
2698 | 2613 |
|
2699 |
- $dbi->update( |
|
2700 |
- where => {id1 => 4, id2 => 5}, |
|
2701 |
- param => {title => 'Perl', author => 'Ken'} |
|
2702 |
- ); |
|
2614 |
+Table name. |
|
2703 | 2615 |
|
2704 |
-=item C<primary_key> |
|
2616 |
+=item C<where> |
|
2705 | 2617 |
|
2706 |
-See C<id> option. |
|
2618 |
+Same as C<select> method's C<where> option. |
|
2707 | 2619 |
|
2708 | 2620 |
=item C<type> |
2709 | 2621 |
|
... | ... |
@@ -2719,7 +2631,7 @@ Turn type rule off. |
2719 | 2631 |
|
2720 | 2632 |
$dbi->update_all(table => 'book', param => {title => 'Perl'}); |
2721 | 2633 |
|
2722 |
-Update statement to update all rows. |
|
2634 |
+Execute update statement for all rows. |
|
2723 | 2635 |
Options is same as C<update()>. |
2724 | 2636 |
|
2725 | 2637 |
=head2 C<update_param> |