- removed DEPRECATED DBIx::Custom::MySQL and DBIx...
...::Custom::SQLite
... | ... |
@@ -1,3 +1,11 @@ |
1 |
+0.1675 |
|
2 |
+ - removed DEPRECATED DBIx::Custom::MySQL and DBIx::Custom::SQLite |
|
3 |
+ these implementations remine in https://github.com/yuki-kimoto/DBIx-Custom/wiki |
|
4 |
+ for some users. |
|
5 |
+ - removed EXPERIMENTAL replace(). |
|
6 |
+ - removed EXPERIMENTAL mark from many methods. |
|
7 |
+0.1674 |
|
8 |
+ - fixed test bug |
|
1 | 9 |
0.1673 |
2 | 10 |
- fixed dbh() method bug. |
3 | 11 |
0.1672 |
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
package DBIx::Custom; |
2 | 2 |
|
3 |
-our $VERSION = '0.1673'; |
|
3 |
+our $VERSION = '0.1675'; |
|
4 | 4 |
|
5 | 5 |
use 5.008001; |
6 | 6 |
use strict; |
... | ... |
@@ -786,26 +786,6 @@ sub register_filter { |
786 | 786 |
|
787 | 787 |
sub register_tag { shift->query_builder->register_tag(@_) } |
788 | 788 |
|
789 |
-sub replace { |
|
790 |
- my ($self, $join, $search, $replace) = @_; |
|
791 |
- |
|
792 |
- # Replace |
|
793 |
- my @replace_join; |
|
794 |
- my $is_replaced; |
|
795 |
- foreach my $j (@$join) { |
|
796 |
- if ($search eq $j) { |
|
797 |
- push @replace_join, $replace; |
|
798 |
- $is_replaced = 1; |
|
799 |
- } |
|
800 |
- else { |
|
801 |
- push @replace_join, $j; |
|
802 |
- } |
|
803 |
- } |
|
804 |
- croak qq{Can't replace "$search" with "$replace"} unless $is_replaced; |
|
805 |
- |
|
806 |
- return \@replace_join; |
|
807 |
-} |
|
808 |
- |
|
809 | 789 |
our %SELECT_ARGS |
810 | 790 |
= map { $_ => 1 } @COMMON_ARGS, qw/column where append relation join param/; |
811 | 791 |
|
... | ... |
@@ -1533,7 +1513,7 @@ L<DBIx::Custom Wiki|https://github.com/yuki-kimoto/DBIx-Custom/wiki> |
1533 | 1513 |
|
1534 | 1514 |
=head1 ATTRIBUTES |
1535 | 1515 |
|
1536 |
-=head2 C<connector> EXPERIMENTAL |
|
1516 |
+=head2 C<connector> |
|
1537 | 1517 |
|
1538 | 1518 |
my $connector = $dbi->connector; |
1539 | 1519 |
$dbi = $dbi->connector(DBIx::Connector->new(...)); |
... | ... |
@@ -1592,7 +1572,7 @@ the value is used to check if the process is in transaction. |
1592 | 1572 |
|
1593 | 1573 |
Filters, registered by C<register_filter()>. |
1594 | 1574 |
|
1595 |
-=head2 C<models> EXPERIMENTAL |
|
1575 |
+=head2 C<models> |
|
1596 | 1576 |
|
1597 | 1577 |
my $models = $dbi->models; |
1598 | 1578 |
$dbi = $dbi->models(\%models); |
... | ... |
@@ -1613,7 +1593,7 @@ Password, used when C<connect()> is executed. |
1613 | 1593 |
|
1614 | 1594 |
Query builder, default to L<DBIx::Custom::QueryBuilder> object. |
1615 | 1595 |
|
1616 |
-=head2 C<reserved_word_quote> EXPERIMENTAL |
|
1596 |
+=head2 C<reserved_word_quote> |
|
1617 | 1597 |
|
1618 | 1598 |
my reserved_word_quote = $dbi->reserved_word_quote; |
1619 | 1599 |
$dbi = $dbi->reserved_word_quote('"'); |
... | ... |
@@ -1648,7 +1628,7 @@ L<DBIx::Custom> inherits all methods from L<Object::Simple> |
1648 | 1628 |
and use all methods of L<DBI> |
1649 | 1629 |
and implements the following new ones. |
1650 | 1630 |
|
1651 |
-=head2 C<apply_filter> EXPERIMENTAL |
|
1631 |
+=head2 C<apply_filter> |
|
1652 | 1632 |
|
1653 | 1633 |
$dbi->apply_filter( |
1654 | 1634 |
'book', |
... | ... |
@@ -1901,7 +1881,7 @@ filter name registerd by C<register_filter()>. |
1901 | 1881 |
|
1902 | 1882 |
These filters are added to the C<out> filters, set by C<apply_filter()>. |
1903 | 1883 |
|
1904 |
-=head2 C<column> EXPERIMENTAL |
|
1884 |
+=head2 C<column> |
|
1905 | 1885 |
|
1906 | 1886 |
my $column = $self->column(book => ['author', 'title']); |
1907 | 1887 |
|
... | ... |
@@ -2108,7 +2088,7 @@ Create insert parameter tag. |
2108 | 2088 |
|
2109 | 2089 |
(title, author) values ({? title}, {? author}); |
2110 | 2090 |
|
2111 |
-=head2 C<include_model> EXPERIMENTAL |
|
2091 |
+=head2 C<include_model> |
|
2112 | 2092 |
|
2113 | 2093 |
$dbi->include_model('MyModel'); |
2114 | 2094 |
|
... | ... |
@@ -2156,7 +2136,7 @@ You can get model object by C<model()>. |
2156 | 2136 |
|
2157 | 2137 |
See L<DBIx::Custom::Model> to know model features. |
2158 | 2138 |
|
2159 |
-=head2 C<merge_param> EXPERIMENTAL |
|
2139 |
+=head2 C<merge_param> |
|
2160 | 2140 |
|
2161 | 2141 |
my $param = $dbi->merge_param({key1 => 1}, {key1 => 1, key2 => 2}); |
2162 | 2142 |
|
... | ... |
@@ -2166,7 +2146,7 @@ $param: |
2166 | 2146 |
|
2167 | 2147 |
{key1 => [1, 1], key2 => 2} |
2168 | 2148 |
|
2169 |
-=head2 C<method> EXPERIMENTAL |
|
2149 |
+=head2 C<method> |
|
2170 | 2150 |
|
2171 | 2151 |
$dbi->method( |
2172 | 2152 |
update_or_insert => sub { |
... | ... |
@@ -2186,7 +2166,7 @@ Register method. These method is called directly from L<DBIx::Custom> object. |
2186 | 2166 |
$dbi->update_or_insert; |
2187 | 2167 |
$dbi->find_or_create; |
2188 | 2168 |
|
2189 |
-=head2 C<model> EXPERIMENTAL |
|
2169 |
+=head2 C<model> |
|
2190 | 2170 |
|
2191 | 2171 |
$dbi->model('book')->method( |
2192 | 2172 |
insert => sub { ... }, |
... | ... |
@@ -2197,7 +2177,7 @@ Register method. These method is called directly from L<DBIx::Custom> object. |
2197 | 2177 |
|
2198 | 2178 |
Set and get a L<DBIx::Custom::Model> object, |
2199 | 2179 |
|
2200 |
-=head2 C<mycolumn> EXPERIMENTAL |
|
2180 |
+=head2 C<mycolumn> |
|
2201 | 2181 |
|
2202 | 2182 |
my $column = $self->mycolumn(book => ['author', 'title']); |
2203 | 2183 |
|
... | ... |
@@ -2277,21 +2257,6 @@ Column names is |
2277 | 2257 |
|
2278 | 2258 |
['title', 'author'] |
2279 | 2259 |
|
2280 |
-=head2 C<replace> EXPERIMENTAL |
|
2281 |
- |
|
2282 |
- my $join = [ |
|
2283 |
- 'left outer join table2 on table1.key1 = table2.key1', |
|
2284 |
- 'left outer join table3 on table2.key3 = table3.key3' |
|
2285 |
- ]; |
|
2286 |
- $join = $dbi->replace( |
|
2287 |
- $join, |
|
2288 |
- 'left outer join table2 on table1.key1 = table2.key1', |
|
2289 |
- 'left outer join (select * from table2 where {= table2.key1}) ' . |
|
2290 |
- 'as table2 on table1.key1 = table2.key1' |
|
2291 |
- ); |
|
2292 |
- |
|
2293 |
-Replace join clauses if match the expression. |
|
2294 |
- |
|
2295 | 2260 |
=head2 C<select> |
2296 | 2261 |
|
2297 | 2262 |
my $result = $dbi->select( |
... | ... |
@@ -2350,7 +2315,7 @@ or array refrence, which contains where clause and paramter. |
2350 | 2315 |
] |
2351 | 2316 |
); |
2352 | 2317 |
|
2353 |
-=item C<join> EXPERIMENTAL |
|
2318 |
+=item C<join> |
|
2354 | 2319 |
|
2355 | 2320 |
Join clause used in need. This is array reference. |
2356 | 2321 |
|
... | ... |
@@ -2445,7 +2410,7 @@ You can check SQL. |
2445 | 2410 |
|
2446 | 2411 |
my $sql = $query->sql; |
2447 | 2412 |
|
2448 |
-=item C<type> EXPERIMENTAL |
|
2413 |
+=item C<type> |
|
2449 | 2414 |
|
2450 | 2415 |
Specify database data type. |
2451 | 2416 |
|
... | ... |
@@ -2668,7 +2633,7 @@ Create update parameter tag. |
2668 | 2633 |
set title = {? title}, author = {? author} |
2669 | 2634 |
|
2670 | 2635 |
You can create tag without 'set ' |
2671 |
-by C<no_set> option. This option is EXPERIMENTAL. |
|
2636 |
+by C<no_set> option. |
|
2672 | 2637 |
|
2673 | 2638 |
my $update_param_tag = $dbi->update_param_tag( |
2674 | 2639 |
{title => 'a', age => 2} |
... | ... |
@@ -2686,7 +2651,7 @@ by C<no_set> option. This option is EXPERIMENTAL. |
2686 | 2651 |
|
2687 | 2652 |
Create a new L<DBIx::Custom::Where> object. |
2688 | 2653 |
|
2689 |
-=head2 C<setup_model> EXPERIMENTAL |
|
2654 |
+=head2 C<setup_model> |
|
2690 | 2655 |
|
2691 | 2656 |
$dbi->setup_model; |
2692 | 2657 |
|
... | ... |
@@ -120,7 +120,7 @@ sub new { |
120 | 120 |
|
121 | 121 |
=head1 NAME |
122 | 122 |
|
123 |
-DBIx::Custom::Model - Model EXPERIMENTAL |
|
123 |
+DBIx::Custom::Model - Model |
|
124 | 124 |
|
125 | 125 |
=head1 SYNOPSIS |
126 | 126 |
|
... | ... |
@@ -246,7 +246,7 @@ you don't have to specify C<table> option. |
246 | 246 |
Same as C<insert_at()> of L<DBIx::Custom> except that |
247 | 247 |
you don't have to specify C<table> and C<primary_key> option. |
248 | 248 |
|
249 |
-=head2 C<method> EXPERIMENTAL |
|
249 |
+=head2 C<method> |
|
250 | 250 |
|
251 | 251 |
$model->method( |
252 | 252 |
update_or_insert => sub { |
... | ... |
@@ -1,36 +0,0 @@ |
1 |
-package DBIx::Custom::MySQL; |
|
2 |
- |
|
3 |
-use strict; |
|
4 |
-use warnings; |
|
5 |
- |
|
6 |
-use base 'DBIx::Custom'; |
|
7 |
- |
|
8 |
-__PACKAGE__->attr([qw/database host port/]); |
|
9 |
- |
|
10 |
-sub connect { |
|
11 |
- my $proto = shift; |
|
12 |
- |
|
13 |
- # Create a new object |
|
14 |
- my $self = ref $proto ? $proto : $proto->new(@_); |
|
15 |
- |
|
16 |
- # Data source |
|
17 |
- if (!$self->data_source) { |
|
18 |
- my $database = $self->database; |
|
19 |
- my $host = $self->host; |
|
20 |
- my $port = $self->port; |
|
21 |
- my $data_source = "dbi:mysql:"; |
|
22 |
- $data_source .= "database=$database;" if $database; |
|
23 |
- $data_source .= "host=$host;" if $host; |
|
24 |
- $data_source .= "port=$port;" if $port; |
|
25 |
- $self->data_source($data_source); |
|
26 |
- } |
|
27 |
- |
|
28 |
- return $self->SUPER::connect; |
|
29 |
-} |
|
30 |
- |
|
31 |
-1; |
|
32 |
- |
|
33 |
-=head1 NAME |
|
34 |
- |
|
35 |
-DBIx::Custom::MySQL - DEPRECATED! |
|
36 |
- |
... | ... |
@@ -372,7 +372,7 @@ Statement handle of L<DBI>. |
372 | 372 |
L<DBIx::Custom::Result> inherits all methods from L<Object::Simple> |
373 | 373 |
and implements the following new ones. |
374 | 374 |
|
375 |
-=head2 C<end_filter> EXPERIMENTAL |
|
375 |
+=head2 C<end_filter> |
|
376 | 376 |
|
377 | 377 |
$result = $result->end_filter(title => 'to_something', |
378 | 378 |
author => 'to_something'); |
... | ... |
@@ -444,19 +444,19 @@ Filters. |
444 | 444 |
These each filters override the filters applied by C<apply_filter> of |
445 | 445 |
L<DBIx::Custom>. |
446 | 446 |
|
447 |
-=head2 C<remove_end_filter> EXPERIMENTAL |
|
447 |
+=head2 C<remove_end_filter> |
|
448 | 448 |
|
449 | 449 |
$result->remove_end_filter; |
450 | 450 |
|
451 | 451 |
Remove end filter. |
452 | 452 |
|
453 |
-=head2 C<remove_filter> EXPERIMENTAL |
|
453 |
+=head2 C<remove_filter> |
|
454 | 454 |
|
455 | 455 |
$result->remove_filter; |
456 | 456 |
|
457 | 457 |
Remove filter. End filter is not removed. |
458 | 458 |
|
459 |
-=head2 C<stash> EXPERIMENTAL |
|
459 |
+=head2 C<stash> |
|
460 | 460 |
|
461 | 461 |
my $stash = $result->stash; |
462 | 462 |
my $foo = $result->stash->{foo}; |
... | ... |
@@ -1,42 +0,0 @@ |
1 |
-package DBIx::Custom::SQLite; |
|
2 |
- |
|
3 |
-use strict; |
|
4 |
-use warnings; |
|
5 |
- |
|
6 |
-use base 'DBIx::Custom'; |
|
7 |
- |
|
8 |
-__PACKAGE__->attr('database'); |
|
9 |
- |
|
10 |
-sub connect { |
|
11 |
- my $proto = shift; |
|
12 |
- |
|
13 |
- # Create a new object |
|
14 |
- my $self = ref $proto ? $proto : $proto->new(@_); |
|
15 |
- |
|
16 |
- # Data source |
|
17 |
- my $database = $self->database; |
|
18 |
- if (!$self->data_source && $database) { |
|
19 |
- $self->data_source("dbi:SQLite:dbname=$database") |
|
20 |
- } |
|
21 |
- |
|
22 |
- return $self->SUPER::connect; |
|
23 |
-} |
|
24 |
- |
|
25 |
-sub connect_memory { |
|
26 |
- my $self = shift->new(@_); |
|
27 |
- |
|
28 |
- # Data source |
|
29 |
- $self->data_source('dbi:SQLite:dbname=:memory:'); |
|
30 |
- |
|
31 |
- # Connect to database |
|
32 |
- $self->connect; |
|
33 |
- |
|
34 |
- return $self; |
|
35 |
-} |
|
36 |
- |
|
37 |
-1; |
|
38 |
- |
|
39 |
-=head1 NAME |
|
40 |
- |
|
41 |
-DBIx::Custom::SQLite - DEPRECATED! |
|
42 |
- |
... | ... |
@@ -2108,36 +2108,3 @@ $rows = $dbi->select( |
2108 | 2108 |
)->fetch_hash_all; |
2109 | 2109 |
is_deeply($rows, [{table1_key1 => 2, key2 => 3, key3 => 5}]); |
2110 | 2110 |
|
2111 |
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0}); |
|
2112 |
-$dbi->reserved_word_quote('"'); |
|
2113 |
-$dbi->execute($CREATE_TABLE->{0}); |
|
2114 |
-$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2}); |
|
2115 |
-$dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3}); |
|
2116 |
-$dbi->execute($CREATE_TABLE->{2}); |
|
2117 |
-$dbi->insert(table => 'table2', param => {key1 => 1, key3 => 4}); |
|
2118 |
-$dbi->insert(table => 'table2', param => {key1 => 2, key3 => 5}); |
|
2119 |
-$join = ['inner join table2 on "table1"."key1" = "table2"."key1"']; |
|
2120 |
-$join = $dbi->replace( |
|
2121 |
- $join, |
|
2122 |
- 'inner join table2 on "table1"."key1" = "table2"."key1"', |
|
2123 |
- 'inner join (select * from table2 where {= table2.key3}) as table2' |
|
2124 |
-); |
|
2125 |
- |
|
2126 |
-$rows = $dbi->select( |
|
2127 |
- table => 'table1', |
|
2128 |
- column => 'table1.key1 as table1_key1, key2, key3', |
|
2129 |
- where => {'table1.key2' => 3}, |
|
2130 |
- join => ['inner join table2 on "table1"."key1" = "table2"."key1"'], |
|
2131 |
- param => {'table2.key3' => 5} |
|
2132 |
-)->fetch_hash_all; |
|
2133 |
-is_deeply($rows, [{table1_key1 => 2, key2 => 3, key3 => 5}]); |
|
2134 |
- |
|
2135 |
-$join = ['inner join table2 on "table1"."key1" = "table2"."key1"']; |
|
2136 |
-eval { |
|
2137 |
- $join = $dbi->replace( |
|
2138 |
- $join, |
|
2139 |
- 'pppp inner join table2 on "table1"."key1" = "table2"."key1"', |
|
2140 |
- 'inner join (select * from table2 where {= table2.key3}) as table2' |
|
2141 |
- ); |
|
2142 |
-}; |
|
2143 |
-like($@, qr/replace/); |
... | ... |
@@ -2,8 +2,6 @@ use Test::More; |
2 | 2 |
use strict; |
3 | 3 |
use warnings; |
4 | 4 |
|
5 |
-use DBIx::Connector; |
|
6 |
- |
|
7 | 5 |
# user password database |
8 | 6 |
our ($USER, $PASSWORD, $DATABASE) = connect_info(); |
9 | 7 |
|
... | ... |
@@ -11,6 +9,8 @@ plan skip_all => 'private MySQL test' unless $USER; |
11 | 9 |
|
12 | 10 |
plan 'no_plan'; |
13 | 11 |
|
12 |
+require DBIx::Connector; |
|
13 |
+ |
|
14 | 14 |
# Function for test name |
15 | 15 |
sub test { print "# $_[0]\n" } |
16 | 16 |
|