... | ... |
@@ -1877,7 +1877,7 @@ You can set multiple filters at once. |
1877 | 1877 |
|
1878 | 1878 |
my $assign_param = $dbi->assign_param({title => 'a', age => 2}); |
1879 | 1879 |
|
1880 |
-Create assign tag. |
|
1880 |
+Create assign parameter. |
|
1881 | 1881 |
|
1882 | 1882 |
title = :title, author = :author |
1883 | 1883 |
|
... | ... |
@@ -1985,65 +1985,41 @@ column name and column information. |
1985 | 1985 |
{title => 'Perl', author => '%Ken%'} |
1986 | 1986 |
); |
1987 | 1987 |
|
1988 |
-Execute SQL, containing tags. |
|
1989 |
-Return value is L<DBIx::Custom::Result> in select statement, or |
|
1990 |
-the count of affected rows in insert, update, delete statement. |
|
1988 |
+Execute SQL. SQL can contain parameter such as :author. |
|
1989 |
+Return value is L<DBIx::Custom::Result> when select statement is executed, |
|
1990 |
+or the count of affected rows in insert, update, delete statement is executed. |
|
1991 | 1991 |
|
1992 |
-Tag is turned into the statement containing place holder |
|
1993 |
-before SQL is executed. |
|
1992 |
+Parameter is replaced by placeholder C<?>. |
|
1994 | 1993 |
|
1995 | 1994 |
select * from where title = ? and author like ?; |
1996 | 1995 |
|
1997 |
-See also L<Tags/Tags>. |
|
1998 |
- |
|
1999 |
-The following opitons are currently available. |
|
1996 |
+The following opitons are available. |
|
2000 | 1997 |
|
2001 | 1998 |
=over 4 |
2002 | 1999 |
|
2003 |
-=item C<table> |
|
2004 |
- |
|
2005 |
-Table names for filtering. |
|
2006 |
- |
|
2007 |
- $dbi->execute(table => ['author', 'book']); |
|
2008 |
- |
|
2009 |
-C<execute()> is unlike C<insert()>, C<update()>, C<delete()>, C<select()>, |
|
2010 |
-Filtering is off because we don't know what filter is applied. |
|
2011 |
- |
|
2012 | 2000 |
=item C<filter> |
2001 |
+ |
|
2002 |
+ filter => { |
|
2003 |
+ title => sub { uc $_[0] } |
|
2004 |
+ author => sub { uc $_[0] } |
|
2005 |
+ } |
|
2013 | 2006 |
|
2014 |
-Filter, executed before data is send to database. This is array reference. |
|
2007 |
+ # Filter name |
|
2008 |
+ filter => { |
|
2009 |
+ title => 'upper_case', |
|
2010 |
+ author => 'upper_case' |
|
2011 |
+ } |
|
2012 |
+ |
|
2013 |
+ # At once |
|
2014 |
+ filter => [ |
|
2015 |
+ [qw/title author/] => sub { uc $_[0] } |
|
2016 |
+ ] |
|
2017 |
+ |
|
2018 |
+Filter, executed before data is saved into database. |
|
2015 | 2019 |
Filter value is code reference or |
2016 | 2020 |
filter name registerd by C<register_filter()>. |
2017 | 2021 |
|
2018 |
- # Basic |
|
2019 |
- $dbi->execute( |
|
2020 |
- $sql, |
|
2021 |
- filter => { |
|
2022 |
- title => sub { uc $_[0] } |
|
2023 |
- author => sub { uc $_[0] } |
|
2024 |
- } |
|
2025 |
- ); |
|
2026 |
- |
|
2027 |
- # At once (use array reference) |
|
2028 |
- $dbi->execute( |
|
2029 |
- $sql, |
|
2030 |
- filter => [ |
|
2031 |
- [qw/title author/] => sub { uc $_[0] } |
|
2032 |
- ] |
|
2033 |
- ); |
|
2034 |
- |
|
2035 |
- # Filter name |
|
2036 |
- $dbi->execute( |
|
2037 |
- $sql, |
|
2038 |
- filter => { |
|
2039 |
- title => 'upper_case', |
|
2040 |
- author => 'upper_case' |
|
2041 |
- } |
|
2042 |
- ); |
|
2043 |
- |
|
2044 | 2022 |
These filters are added to the C<out> filters, set by C<apply_filter()>. |
2045 |
-C<filter> option is also available |
|
2046 |
-by C<insert()>, C<update()>, C<delete()>, C<select()> |
|
2047 | 2023 |
|
2048 | 2024 |
=item C<query> |
2049 | 2025 |
|
... | ... |
@@ -2051,6 +2027,16 @@ by C<insert()>, C<update()>, C<delete()>, C<select()> |
2051 | 2027 |
|
2052 | 2028 |
C<execute> method return L<DBIx::Custom::Query> object, not executing SQL. |
2053 | 2029 |
|
2030 |
+=item C<table> |
|
2031 |
+ |
|
2032 |
+ table => 'author' |
|
2033 |
+ table => ['author', 'book'] |
|
2034 |
+ |
|
2035 |
+Table names for filtering. |
|
2036 |
+ |
|
2037 |
+Filtering by C<apply_filter> is off in C<execute> method, |
|
2038 |
+because we don't know what filter is applied. |
|
2039 |
+ |
|
2054 | 2040 |
=item C<type> |
2055 | 2041 |
|
2056 | 2042 |
Specify database data type. |