... | ... |
@@ -1,3 +1,6 @@ |
1 |
+0.1677 |
|
2 |
+ - improved table search in column and join clause |
|
3 |
+ - DEPRECATED table tag. use table option. |
|
1 | 4 |
0.1676 |
2 | 5 |
- fixed test bug |
3 | 6 |
0.1675 |
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
package DBIx::Custom; |
2 | 2 |
|
3 |
-our $VERSION = '0.1676'; |
|
3 |
+our $VERSION = '0.1677'; |
|
4 | 4 |
|
5 | 5 |
use 5.008001; |
6 | 6 |
use strict; |
... | ... |
@@ -1239,8 +1239,8 @@ sub _search_tables { |
1239 | 1239 |
my $safety_character = $self->safety_character; |
1240 | 1240 |
my $q = $self->reserved_word_quote; |
1241 | 1241 |
my $q_re = quotemeta($q); |
1242 |
- my $table_re = $q ? qr/\b$q_re?([$safety_character]+)$q_re?\./ |
|
1243 |
- : qr/\b([$safety_character]+)\./; |
|
1242 |
+ my $table_re = $q ? qr/(?:^|[^$safety_character])$q_re?([$safety_character]+)$q_re?\./ |
|
1243 |
+ : qr/(?:^|[^$safety_character])([$safety_character]+)\./; |
|
1244 | 1244 |
while ($source =~ /$table_re/g) { |
1245 | 1245 |
push @$tables, $1; |
1246 | 1246 |
} |
... | ... |
@@ -1769,6 +1769,20 @@ The following opitons are currently available. |
1769 | 1769 |
|
1770 | 1770 |
=over 4 |
1771 | 1771 |
|
1772 |
+=item C<table> |
|
1773 |
+ |
|
1774 |
+Table names for filtering. |
|
1775 |
+ |
|
1776 |
+ $dbi->execute(table => ['author', 'book']); |
|
1777 |
+ |
|
1778 |
+C<execute()> is unlike C<insert()>, C<update()>, C<delete()>, C<select(), |
|
1779 |
+Filtering is off because we don't know what filter is applied. |
|
1780 |
+ |
|
1781 |
+ |
|
1782 |
+ |
|
1783 |
+ |
|
1784 |
+ |
|
1785 |
+ |
|
1772 | 1786 |
=item C<filter> |
1773 | 1787 |
|
1774 | 1788 |
Filter, executed before data is send to database. This is array reference. |
... | ... |
@@ -2662,14 +2676,6 @@ C<columns> of model object is automatically set, parsing database information. |
2662 | 2676 |
|
2663 | 2677 |
The following tags is available. |
2664 | 2678 |
|
2665 |
-=head2 C<table> |
|
2666 |
- |
|
2667 |
-Table tag |
|
2668 |
- |
|
2669 |
- {table TABLE} -> TABLE |
|
2670 |
- |
|
2671 |
-This is used to tell C<execute()> what table is needed . |
|
2672 |
- |
|
2673 | 2679 |
=head2 C<?> |
2674 | 2680 |
|
2675 | 2681 |
Placeholder tag. |
... | ... |
@@ -794,22 +794,14 @@ You can specify C<filter()> at C<execute()>. |
794 | 794 |
|
795 | 795 |
Note that at C<execute()> the filter applied by C<apply_filter()> |
796 | 796 |
don't has effective to columns. |
797 |
-You have to use C<table> tag in SQL |
|
797 |
+You have to use C<table> option |
|
798 | 798 |
|
799 |
- my $sql = "select * from {table book} where {= author} and {like title};" |
|
799 |
+ $dbi->execute($sql, table => ['author', 'book']); |
|
800 | 800 |
|
801 | 801 |
=head3 Tag list |
802 | 802 |
|
803 | 803 |
The following tag is available. |
804 | 804 |
|
805 |
-=head4 C<table> |
|
806 |
- |
|
807 |
- {table NAME} -> NAME |
|
808 |
- |
|
809 |
-This is used to specify table name in SQL. |
|
810 |
-If you specify table name, Filtering by |
|
811 |
-C<apply_filter()> is effective. |
|
812 |
- |
|
813 | 805 |
=head4 C<?> |
814 | 806 |
|
815 | 807 |
{? NAME} -> ? |
... | ... |
@@ -807,19 +807,13 @@ C<execute()>においてもC<filter>を指定することができます。 |
807 | 807 |
C<execute>ではC<apply_filter()>で適用されたフィルタ |
808 | 808 |
は有効ではないということに注意してください。 |
809 | 809 |
C<apply_filter()>で適用されたフィルタを有効にするには、 |
810 |
-C<table>タグを利用します。 |
|
810 |
+C<table>オプションを利用します。 |
|
811 | 811 |
|
812 |
- my $sql = "select * from {table book} where {= author} and {like title};" |
|
812 |
+ $dbi->execute($sql, table => ['author', 'book']); |
|
813 | 813 |
|
814 |
-=head3 タグ一覧 |
|
815 |
- |
|
816 |
-=head4 C<table> |
|
814 |
+後ろで適用したフィルタのほうが優先順位が高くなります。 |
|
817 | 815 |
|
818 |
- {table NAME} -> NAME |
|
819 |
- |
|
820 |
-これはSQLの中でテーブル名を指定する場合に利用します。 |
|
821 |
-テーブル名を指定することによって、C<apply_filter()> |
|
822 |
-によるフィルタリングが有効になります。 |
|
816 |
+=head3 タグ一覧 |
|
823 | 817 |
|
824 | 818 |
=head4 C<?> |
825 | 819 |
|