cleanup
|
1 |
package DBIx::Custom; |
2 | ||
add feture. all model class ...
|
3 |
our $VERSION = '0.1646'; |
fixed DBIx::Custom::QueryBui...
|
4 | |
5 |
use 5.008001; |
|
cleanup
|
6 |
use strict; |
7 |
use warnings; |
|
8 | ||
remove run_transaction().
|
9 |
use base 'Object::Simple'; |
many change
|
10 | |
packaging one directory
|
11 |
use Carp 'croak'; |
12 |
use DBI; |
|
13 |
use DBIx::Custom::Result; |
|
cleanup
|
14 |
use DBIx::Custom::Query; |
cleanup
|
15 |
use DBIx::Custom::QueryBuilder; |
added experimental DBIx::Cus...
|
16 |
use DBIx::Custom::Where; |
add feture. all model class ...
|
17 |
use DBIx::Custom::Model; |
cleanup
|
18 |
use DBIx::Custom::Tag; |
update document
|
19 |
use Encode qw/encode_utf8 decode_utf8/; |
packaging one directory
|
20 | |
fix tests
|
21 |
__PACKAGE__->attr( |
added experimental DBIx::Cus...
|
22 |
[qw/data_source dbh password user/], |
fix tests
|
23 |
cache => 1, |
table object call dbi object...
|
24 |
dbi_option => sub { {} }, |
cleanup
|
25 |
query_builder => sub { DBIx::Custom::QueryBuilder->new }, |
many changed
|
26 |
result_class => 'DBIx::Custom::Result', |
update pod
|
27 |
safety_column_name => sub { qr/^[\w\.]*$/ }, |
28 |
stash => sub { {} } |
|
many changed
|
29 |
); |
30 | ||
31 |
__PACKAGE__->attr( |
|
32 |
cache_method => sub { |
|
33 |
sub { |
|
34 |
my $self = shift; |
|
35 |
|
|
36 |
$self->{_cached} ||= {}; |
|
37 |
|
|
38 |
if (@_ > 1) { |
|
39 |
$self->{_cached}{$_[0]} = $_[1] |
|
40 |
} |
|
41 |
else { |
|
42 |
return $self->{_cached}{$_[0]} |
|
43 |
} |
|
44 |
} |
|
45 |
} |
|
46 |
); |
|
47 | ||
48 |
__PACKAGE__->attr( |
|
fix tests
|
49 |
filters => sub { |
50 |
{ |
|
51 |
encode_utf8 => sub { encode_utf8($_[0]) }, |
|
52 |
decode_utf8 => sub { decode_utf8($_[0]) } |
|
53 |
} |
|
many changed
|
54 |
} |
fix tests
|
55 |
); |
cleanup
|
56 | |
added helper method
|
57 |
our $AUTOLOAD; |
58 |
sub AUTOLOAD { |
|
59 |
my $self = shift; |
|
60 | ||
renamed helper to method.
|
61 |
# Method name |
62 |
my ($package, $mname) = $AUTOLOAD =~ /^([\w\:]+)\:\:(\w+)$/; |
|
added helper method
|
63 | |
renamed helper to method.
|
64 |
# Method |
65 |
$self->{_methods} ||= {}; |
|
add feture. all model class ...
|
66 |
if (my $method = $self->{_methods}->{$mname}) { |
67 |
return $self->$method(@_) |
|
68 |
} |
|
69 |
elsif ($self->dbh->can($mname)) { |
|
70 |
$self->dbh->$mname(@_); |
|
71 |
} |
|
72 |
else { |
|
73 |
croak qq/Can't locate object method "$mname" via "$package"/ |
|
74 |
} |
|
added helper method
|
75 |
} |
76 | ||
renamed auto_filter to apply...
|
77 |
sub apply_filter { |
many changed
|
78 |
my ($self, $table, @cinfos) = @_; |
79 | ||
80 |
# Initialize filters |
|
cleanup
|
81 |
$self->{filter} ||= {}; |
many changed
|
82 |
$self->{filter}{out} ||= {}; |
83 |
$self->{filter}{in} ||= {}; |
|
cleanup
|
84 |
|
many changed
|
85 |
# Create filters |
86 |
my $usage = "Usage: \$dbi->apply_filter(" . |
|
fix bug : filter can't over...
|
87 |
"TABLE, COLUMN1, {in => INFILTER1, out => OUTFILTER1, end => ENDFILTER1}, " . |
88 |
"COLUMN2, {in => INFILTER2, out => OUTFILTER2, end => ENDFILTER2}, ...)"; |
|
many changed
|
89 | |
90 |
for (my $i = 0; $i < @cinfos; $i += 2) { |
|
added auto_filter method
|
91 |
|
many changed
|
92 |
# Column |
93 |
my $column = $cinfos[$i]; |
|
added auto_filter method
|
94 |
|
fix bug : filter can't over...
|
95 |
# Filter info |
96 |
my $finfo = $cinfos[$i + 1] || {}; |
|
97 |
croak $usage unless ref $finfo eq 'HASH'; |
|
98 |
foreach my $ftype (keys %$finfo) { |
|
99 |
croak $usage unless $ftype eq 'in' || $ftype eq 'out' |
|
100 |
|| $ftype eq 'end'; |
|
many changed
|
101 |
} |
102 |
|
|
fix bug : filter can't over...
|
103 |
foreach my $way (qw/in out end/) { |
104 |
my $filter = $finfo->{$way}; |
|
cleanup
|
105 |
|
fix bug : filter can't over...
|
106 |
# State |
107 |
my $state = !exists $finfo->{$way} ? 'not_exists' |
|
108 |
: !defined $filter ? 'not_defined' |
|
109 |
: ref $filter eq 'CODE' ? 'code' |
|
110 |
: 'name'; |
|
111 |
|
|
112 |
next if $state eq 'not_exists'; |
|
113 |
|
|
114 |
# Check filter |
|
115 |
croak qq{Filter "$filter" is not registered} |
|
116 |
if $state eq 'name' |
|
117 |
&& ! exists $self->filters->{$filter}; |
|
118 |
|
|
119 |
# Filter |
|
120 |
my $f = $state eq 'not_defined' ? undef |
|
121 |
: $state eq 'code' ? $filter |
|
122 |
: $self->filters->{$filter}; |
|
123 |
$self->{filter}{$way}{$table}{$column} = $f; |
|
124 |
$self->{filter}{$way}{$table}{"$table.$column"} = $f; |
|
125 |
$self->{filter}{$way}{$table}{"${table}__$column"} = $f; |
|
many changed
|
126 |
} |
added auto_filter method
|
127 |
} |
128 |
|
|
many changed
|
129 |
return $self; |
added auto_filter method
|
130 |
} |
131 | ||
renamed helper to method.
|
132 |
sub method { |
added helper method
|
133 |
my $self = shift; |
134 |
|
|
135 |
# Merge |
|
renamed helper to method.
|
136 |
my $methods = ref $_[0] eq 'HASH' ? $_[0] : {@_}; |
137 |
$self->{_methods} = {%{$self->{_methods} || {}}, %$methods}; |
|
added helper method
|
138 |
|
139 |
return $self; |
|
140 |
} |
|
141 | ||
packaging one directory
|
142 |
sub connect { |
cleanup
|
143 |
my $self = ref $_[0] ? shift : shift->new(@_);; |
removed register_format()
|
144 |
|
many changed
|
145 |
# Attributes |
packaging one directory
|
146 |
my $data_source = $self->data_source; |
many changed
|
147 |
croak qq{"data_source" must be specified to connect()"} |
check arguments of connect m...
|
148 |
unless $data_source; |
packaging one directory
|
149 |
my $user = $self->user; |
150 |
my $password = $self->password; |
|
renamed dbi_options to dbi_o...
|
151 |
my $dbi_option = {%{$self->dbi_options}, %{$self->dbi_option}}; |
added dbi_options attribute
|
152 |
|
update document
|
153 |
# Connect |
select, insert, update, upda...
|
154 |
my $dbh = eval {DBI->connect( |
packaging one directory
|
155 |
$data_source, |
156 |
$user, |
|
157 |
$password, |
|
158 |
{ |
|
159 |
RaiseError => 1, |
|
160 |
PrintError => 0, |
|
161 |
AutoCommit => 1, |
|
renamed dbi_options to dbi_o...
|
162 |
%$dbi_option |
packaging one directory
|
163 |
} |
164 |
)}; |
|
165 |
|
|
update document
|
166 |
# Connect error |
packaging one directory
|
167 |
croak $@ if $@; |
168 |
|
|
update document
|
169 |
# Database handle |
packaging one directory
|
170 |
$self->dbh($dbh); |
update document
|
171 |
|
packaging one directory
|
172 |
return $self; |
173 |
} |
|
174 | ||
cleanup
|
175 |
sub create_query { |
176 |
my ($self, $source) = @_; |
|
update document
|
177 |
|
cleanup
|
178 |
# Cache |
179 |
my $cache = $self->cache; |
|
update document
|
180 |
|
cleanup
|
181 |
# Create query |
182 |
my $query; |
|
183 |
if ($cache) { |
|
184 |
|
|
185 |
# Get query |
|
186 |
my $q = $self->cache_method->($self, $source); |
|
187 |
|
|
188 |
# Create query |
|
add table tag
|
189 |
if ($q) { |
190 |
$query = DBIx::Custom::Query->new($q); |
|
191 |
$query->filters($self->filters); |
|
192 |
} |
|
cleanup
|
193 |
} |
194 |
|
|
195 |
unless ($query) { |
|
cleanup insert
|
196 | |
cleanup
|
197 |
# Create SQL object |
198 |
my $builder = $self->query_builder; |
|
199 |
|
|
200 |
# Create query |
|
201 |
$query = $builder->build_query($source); |
|
removed register_format()
|
202 | |
cleanup
|
203 |
# Cache query |
204 |
$self->cache_method->($self, $source, |
|
205 |
{sql => $query->sql, |
|
add table tag
|
206 |
columns => $query->columns, |
207 |
tables => $query->tables}) |
|
cleanup
|
208 |
if $cache; |
cleanup insert
|
209 |
} |
210 |
|
|
cleanup
|
211 |
# Prepare statement handle |
212 |
my $sth; |
|
213 |
eval { $sth = $self->dbh->prepare($query->{sql})}; |
|
renamed DBIx::Custom::TagPro...
|
214 |
$self->_croak($@, qq{. Following SQL is executed. "$query->{sql}"}) if $@; |
packaging one directory
|
215 |
|
cleanup
|
216 |
# Set statement handle |
217 |
$query->sth($sth); |
|
packaging one directory
|
218 |
|
cleanup
|
219 |
# Set filters |
220 |
$query->filters($self->filters); |
|
221 |
|
|
cleanup
|
222 |
return $query; |
packaging one directory
|
223 |
} |
224 | ||
cleanup
|
225 |
our %VALID_DELETE_ARGS |
added experimental sugar met...
|
226 |
= map { $_ => 1 } qw/table where append filter allow_delete_all query/; |
cleanup update and update_al...
|
227 | |
cleanup
|
228 |
sub delete { |
select, insert, update, upda...
|
229 |
my ($self, %args) = @_; |
cleanup update and update_al...
|
230 |
|
231 |
# Check arguments |
|
select, insert, update, upda...
|
232 |
foreach my $name (keys %args) { |
add tests
|
233 |
croak qq{"$name" is invalid argument} |
cleanup
|
234 |
unless $VALID_DELETE_ARGS{$name}; |
cleanup update and update_al...
|
235 |
} |
236 |
|
|
237 |
# Arguments |
|
select, insert, update, upda...
|
238 |
my $table = $args{table} || ''; |
added table not specified ex...
|
239 |
croak qq{"table" option must be specified} unless $table; |
select, insert, update, upda...
|
240 |
my $where = $args{where} || {}; |
select() where can't receive...
|
241 |
my $append = $args{append}; |
select, insert, update, upda...
|
242 |
my $filter = $args{filter}; |
cleanup
|
243 |
my $allow_delete_all = $args{allow_delete_all}; |
added auto_filter method
|
244 | |
make delete() using where ob...
|
245 |
# Where |
246 |
my $w; |
|
247 |
if (ref $where eq 'HASH') { |
|
248 |
my $clause = ['and']; |
|
249 |
push @$clause, "{= $_}" for keys %$where; |
|
250 |
$w = $self->where; |
|
251 |
$w->clause($clause); |
|
improved delete() and update...
|
252 |
$w->param($where); |
packaging one directory
|
253 |
} |
select() where can't receive...
|
254 |
elsif (ref $where eq 'DBIx::Custom::Where') { |
255 |
$w = $where; |
|
256 |
$where = $w->param; |
|
257 |
} |
|
make delete() using where ob...
|
258 |
croak qq{"where" must be hash refernce or DBIx::Custom::Where object} |
259 |
unless ref $w eq 'DBIx::Custom::Where'; |
|
260 |
|
|
select() where can't receive...
|
261 |
# String where |
262 |
my $swhere = "$w"; |
|
improved delete() and update...
|
263 |
|
make delete() using where ob...
|
264 |
croak qq{"where" must be specified} |
select() where can't receive...
|
265 |
if $swhere eq '' && !$allow_delete_all; |
make delete() using where ob...
|
266 | |
cleanup
|
267 |
# SQL stack |
268 |
my @sql; |
|
269 | ||
270 |
# Delete |
|
271 |
push @sql, "delete from $table $swhere"; |
|
272 |
push @sql, $append if $append; |
|
273 |
|
|
274 |
my $sql = join(' ', @sql); |
|
packaging one directory
|
275 |
|
added experimental sugar met...
|
276 |
# Create query |
cleanup
|
277 |
my $query = $self->create_query($sql); |
added experimental sugar met...
|
278 |
return $query if $args{query}; |
279 |
|
|
packaging one directory
|
280 |
# Execute query |
added auto_filter method
|
281 |
my $ret_val = $self->execute( |
added experimental sugar met...
|
282 |
$query, param => $where, filter => $filter, |
renamed auto_filter to apply...
|
283 |
table => $table); |
packaging one directory
|
284 |
|
285 |
return $ret_val; |
|
286 |
} |
|
287 | ||
cleanup
|
288 |
sub delete_all { shift->delete(allow_delete_all => 1, @_) } |
packaging one directory
|
289 | |
added helper method
|
290 |
sub DESTROY { } |
291 | ||
renamed auto_filter to apply...
|
292 |
our %VALID_EXECUTE_ARGS = map { $_ => 1 } qw/param filter table/; |
refactoring delete and delet...
|
293 | |
cleanup
|
294 |
sub execute{ |
295 |
my ($self, $query, %args) = @_; |
|
refactoring delete and delet...
|
296 |
|
297 |
# Check arguments |
|
select, insert, update, upda...
|
298 |
foreach my $name (keys %args) { |
add tests
|
299 |
croak qq{"$name" is invalid argument} |
cleanup
|
300 |
unless $VALID_EXECUTE_ARGS{$name}; |
refactoring delete and delet...
|
301 |
} |
302 |
|
|
cleanup
|
303 |
my $params = $args{param} || {}; |
packaging one directory
|
304 |
|
cleanup
|
305 |
# First argument is the soruce of SQL |
306 |
$query = $self->create_query($query) |
|
307 |
unless ref $query; |
|
packaging one directory
|
308 |
|
add table tag
|
309 |
# Applied filter |
cleanup
|
310 |
my $filter = {}; |
add table tag
|
311 |
my $tables = $query->tables; |
312 |
my $arg_tables = $args{table} || []; |
|
313 |
$arg_tables = [$arg_tables] |
|
314 |
unless ref $arg_tables eq 'ARRAY'; |
|
315 |
push @$tables, @$arg_tables; |
|
renamed auto_filter to apply...
|
316 |
foreach my $table (@$tables) { |
cleanup
|
317 |
$filter = { |
318 |
%$filter, |
|
319 |
%{$self->{filter}{out}->{$table} || {}} |
|
added auto_filter method
|
320 |
} |
321 |
} |
|
322 |
|
|
cleanup
|
323 |
# Filter argument |
324 |
my $f = $args{filter} || $query->filter || {}; |
|
325 |
foreach my $column (keys %$f) { |
|
326 |
my $fname = $f->{$column}; |
|
renamed auto_filter to apply...
|
327 |
if (!defined $fname) { |
cleanup
|
328 |
$f->{$column} = undef; |
renamed auto_filter to apply...
|
329 |
} |
330 |
elsif (ref $fname ne 'CODE') { |
|
many changed
|
331 |
croak qq{Filter "$fname" is not registered"} |
cleanup
|
332 |
unless exists $self->filters->{$fname}; |
333 |
|
|
cleanup
|
334 |
$f->{$column} = $self->filters->{$fname}; |
cleanup
|
335 |
} |
336 |
} |
|
cleanup
|
337 |
$filter = {%$filter, %$f}; |
packaging one directory
|
338 |
|
added experimental not_exist...
|
339 |
# Bind |
340 |
my $bind = $self->_bind($params, $query->columns, $filter); |
|
cleanup
|
341 |
|
342 |
# Execute |
|
added experimental not_exist...
|
343 |
my $sth = $query->sth; |
cleanup
|
344 |
my $affected; |
added experimental not_exist...
|
345 |
eval {$affected = $sth->execute(@$bind)}; |
renamed DBIx::Custom::TagPro...
|
346 |
$self->_croak($@, qq{. Following SQL is executed. "$query->{sql}"}) if $@; |
cleanup
|
347 |
|
348 |
# Return resultset if select statement is executed |
|
349 |
if ($sth->{NUM_OF_FIELDS}) { |
|
350 |
|
|
fix bug : filter can't over...
|
351 |
# Result in and end filter |
352 |
my $in_filter = {}; |
|
353 |
my $end_filter = {}; |
|
cleanup
|
354 |
foreach my $table (@$tables) { |
355 |
$in_filter = { |
|
356 |
%$in_filter, |
|
357 |
%{$self->{filter}{in}{$table} || {}} |
|
fix bug : filter can't over...
|
358 |
}; |
359 |
$end_filter = { |
|
360 |
%$end_filter, |
|
361 |
%{$self->{filter}{end}{$table} || {}} |
|
362 |
}; |
|
cleanup
|
363 |
} |
364 |
|
|
365 |
# Result |
|
366 |
my $result = $self->result_class->new( |
|
cleanup
|
367 |
sth => $sth, |
368 |
filters => $self->filters, |
|
369 |
filter_check => $self->filter_check, |
|
cleanup
|
370 |
default_filter => $self->{default_in_filter}, |
fix bug : filter can't over...
|
371 |
filter => $in_filter || {}, |
372 |
end_filter => $end_filter || {} |
|
cleanup
|
373 |
); |
374 | ||
375 |
return $result; |
|
376 |
} |
|
377 |
return $affected; |
|
378 |
} |
|
379 | ||
added auto_filter method
|
380 |
our %VALID_INSERT_ARGS = map { $_ => 1 } qw/table param append |
added experimental sugar met...
|
381 |
filter query/; |
cleanup
|
382 |
sub insert { |
383 |
my ($self, %args) = @_; |
|
384 | ||
385 |
# Check arguments |
|
386 |
foreach my $name (keys %args) { |
|
387 |
croak qq{"$name" is invalid argument} |
|
388 |
unless $VALID_INSERT_ARGS{$name}; |
|
packaging one directory
|
389 |
} |
390 |
|
|
cleanup
|
391 |
# Arguments |
added table not specified ex...
|
392 |
my $table = $args{table}; |
393 |
croak qq{"table" option must be specified} unless $table; |
|
cleanup
|
394 |
my $param = $args{param} || {}; |
395 |
my $append = $args{append} || ''; |
|
396 |
my $filter = $args{filter}; |
|
397 |
|
|
select() where can't receive...
|
398 |
# Columns |
399 |
my @columns; |
|
400 |
my $safety = $self->safety_column_name; |
|
401 |
foreach my $column (keys %$param) { |
|
402 |
croak qq{"$column" is not safety column name} |
|
403 |
unless $column =~ /$safety/; |
|
404 |
push @columns, $column; |
|
405 |
} |
|
cleanup
|
406 |
|
cleanup
|
407 |
# SQL stack |
408 |
my @sql; |
|
409 |
|
|
410 |
# Insert |
|
411 |
push @sql, "insert into $table {insert_param ". join(' ', @columns) . '}'; |
|
412 |
push @sql, $append if $append; |
|
413 |
|
|
select() where can't receive...
|
414 |
# SQL |
cleanup
|
415 |
my $sql = join (' ', @sql); |
packaging one directory
|
416 |
|
added experimental sugar met...
|
417 |
# Create query |
cleanup
|
418 |
my $query = $self->create_query($sql); |
added experimental sugar met...
|
419 |
return $query if $args{query}; |
420 |
|
|
packaging one directory
|
421 |
# Execute query |
added auto_filter method
|
422 |
my $ret_val = $self->execute( |
added experimental sugar met...
|
423 |
$query, |
added auto_filter method
|
424 |
param => $param, |
425 |
filter => $filter, |
|
renamed auto_filter to apply...
|
426 |
table => $table |
added auto_filter method
|
427 |
); |
packaging one directory
|
428 |
|
429 |
return $ret_val; |
|
430 |
} |
|
431 | ||
pod fix
|
432 |
sub each_column { |
added experimental iterate_a...
|
433 |
my ($self, $cb) = @_; |
434 |
|
|
435 |
# Iterate all tables |
|
436 |
my $sth_tables = $self->dbh->table_info; |
|
437 |
while (my $table_info = $sth_tables->fetchrow_hashref) { |
|
438 |
|
|
439 |
# Table |
|
440 |
my $table = $table_info->{TABLE_NAME}; |
|
441 |
|
|
442 |
# Iterate all columns |
|
443 |
my $sth_columns = $self->dbh->column_info(undef, undef, $table, '%'); |
|
444 |
while (my $column_info = $sth_columns->fetchrow_hashref) { |
|
445 |
my $column = $column_info->{COLUMN_NAME}; |
|
removed experimental txn_sco...
|
446 |
$self->$cb($table, $column, $column_info); |
added experimental iterate_a...
|
447 |
} |
448 |
} |
|
449 |
} |
|
450 | ||
added dbi_options attribute
|
451 |
sub new { |
452 |
my $self = shift->SUPER::new(@_); |
|
453 |
|
|
454 |
# Check attribute names |
|
455 |
my @attrs = keys %$self; |
|
456 |
foreach my $attr (@attrs) { |
|
457 |
croak qq{"$attr" is invalid attribute name} |
|
458 |
unless $self->can($attr); |
|
459 |
} |
|
cleanup
|
460 | |
461 |
$self->register_tag( |
|
462 |
'?' => \&DBIx::Custom::Tag::placeholder, |
|
463 |
'=' => \&DBIx::Custom::Tag::equal, |
|
464 |
'<>' => \&DBIx::Custom::Tag::not_equal, |
|
465 |
'>' => \&DBIx::Custom::Tag::greater_than, |
|
466 |
'<' => \&DBIx::Custom::Tag::lower_than, |
|
467 |
'>=' => \&DBIx::Custom::Tag::greater_than_equal, |
|
468 |
'<=' => \&DBIx::Custom::Tag::lower_than_equal, |
|
469 |
'like' => \&DBIx::Custom::Tag::like, |
|
470 |
'in' => \&DBIx::Custom::Tag::in, |
|
471 |
'insert_param' => \&DBIx::Custom::Tag::insert_param, |
|
472 |
'update_param' => \&DBIx::Custom::Tag::update_param |
|
473 |
); |
|
added dbi_options attribute
|
474 |
|
475 |
return $self; |
|
476 |
} |
|
477 | ||
added experimental not_exist...
|
478 |
sub not_exists { bless {}, 'DBIx::Custom::NotExists' } |
479 | ||
cleanup
|
480 |
sub register_filter { |
481 |
my $invocant = shift; |
|
482 |
|
|
483 |
# Register filter |
|
484 |
my $filters = ref $_[0] eq 'HASH' ? $_[0] : {@_}; |
|
485 |
$invocant->filters({%{$invocant->filters}, %$filters}); |
|
486 |
|
|
487 |
return $invocant; |
|
488 |
} |
|
packaging one directory
|
489 | |
renamed DBIx::Custom::TagPro...
|
490 |
sub register_tag { shift->query_builder->register_tag(@_) } |
added register_tag_processor
|
491 | |
refactoring select
|
492 |
our %VALID_SELECT_ARGS |
add experimental selection o...
|
493 |
= map { $_ => 1 } qw/table column where append relation filter query selection/; |
refactoring select
|
494 | |
packaging one directory
|
495 |
sub select { |
select, insert, update, upda...
|
496 |
my ($self, %args) = @_; |
packaging one directory
|
497 |
|
refactoring select
|
498 |
# Check arguments |
select, insert, update, upda...
|
499 |
foreach my $name (keys %args) { |
add tests
|
500 |
croak qq{"$name" is invalid argument} |
refactoring select
|
501 |
unless $VALID_SELECT_ARGS{$name}; |
502 |
} |
|
packaging one directory
|
503 |
|
refactoring select
|
504 |
# Arguments |
added table not specified ex...
|
505 |
my $table = $args{table}; |
506 |
my $tables = ref $table eq 'ARRAY' ? $table |
|
507 |
: defined $table ? [$table] |
|
508 |
: []; |
|
add experimental selection o...
|
509 |
my $columns = $args{column} || []; |
510 |
my $selection = $args{selection} || ''; |
|
511 |
my $where = $args{where} || {}; |
|
512 |
my $relation = $args{relation}; |
|
513 |
my $append = $args{append}; |
|
514 |
my $filter = $args{filter}; |
|
packaging one directory
|
515 |
|
cleanup
|
516 |
# SQL stack |
517 |
my @sql; |
|
518 |
|
|
519 |
push @sql, 'select'; |
|
packaging one directory
|
520 |
|
add experimental selection o...
|
521 |
if ($selection) { |
522 |
croak qq{Can't contain "where" clause in selection} |
|
523 |
if $selection =~ /\swhere\s/; |
|
524 |
push @sql, $selection; |
|
525 |
} |
|
526 |
else { |
|
527 |
# Column clause |
|
528 |
if (@$columns) { |
|
529 |
foreach my $column (@$columns) { |
|
530 |
push @sql, ($column, ','); |
|
531 |
} |
|
532 |
pop @sql if $sql[-1] eq ','; |
|
533 |
} |
|
534 |
else { push @sql, '*' } |
|
535 |
|
|
536 |
# Table |
|
537 |
croak qq{"table" option must be specified} unless @$tables; |
|
538 |
push @sql, 'from'; |
|
539 |
foreach my $table (@$tables) { |
|
540 |
push @sql, ($table, ','); |
|
packaging one directory
|
541 |
} |
cleanup
|
542 |
pop @sql if $sql[-1] eq ','; |
packaging one directory
|
543 |
} |
544 |
|
|
select() where can't receive...
|
545 |
# Where |
546 |
my $w; |
|
added experimental DBIx::Cus...
|
547 |
if (ref $where eq 'HASH') { |
select() where can't receive...
|
548 |
my $clause = ['and']; |
549 |
push @$clause, "{= $_}" for keys %$where; |
|
550 |
$w = $self->where; |
|
551 |
$w->clause($clause); |
|
552 |
$w->param($where); |
|
added experimental DBIx::Cus...
|
553 |
} |
554 |
elsif (ref $where eq 'DBIx::Custom::Where') { |
|
select() where can't receive...
|
555 |
$w = $where; |
556 |
$where = $w->param; |
|
packaging one directory
|
557 |
} |
558 |
|
|
select() where can't receive...
|
559 |
croak qq{"where" must be hash reference or DBIx::Custom::Where object} |
560 |
unless ref $w eq 'DBIx::Custom::Where'; |
|
561 |
|
|
562 |
# String where |
|
563 |
my $swhere = "$w"; |
|
cleanup
|
564 |
push @sql, $swhere; |
select() where can't receive...
|
565 |
|
added commit method
|
566 |
# Relation |
567 |
if ($relation) { |
|
cleanup
|
568 |
push @sql, $swhere eq '' ? 'where' : 'and'; |
569 |
foreach my $rcolumn (keys %$relation) { |
|
570 |
push @sql, ("$rcolumn = " . $relation->{$rcolumn}, 'and'); |
|
packaging one directory
|
571 |
} |
572 |
} |
|
cleanup
|
573 |
pop @sql if $sql[-1] eq 'and'; |
added commit method
|
574 |
|
cleanup
|
575 |
# Append statement |
576 |
push @sql, $append if $append; |
|
577 |
|
|
578 |
# SQL |
|
579 |
my $sql = join (' ', @sql); |
|
packaging one directory
|
580 |
|
added experimental sugar met...
|
581 |
# Create query |
cleanup
|
582 |
my $query = $self->create_query($sql); |
added experimental sugar met...
|
583 |
return $query if $args{query}; |
584 |
|
|
packaging one directory
|
585 |
# Execute query |
added auto_filter method
|
586 |
my $result = $self->execute( |
select() where can't receive...
|
587 |
$query, param => $where, filter => $filter, |
588 |
table => $tables); |
|
packaging one directory
|
589 |
|
590 |
return $result; |
|
591 |
} |
|
592 | ||
add feture. all model class ...
|
593 |
sub model { |
594 |
my ($self, $name, $model) = @_; |
|
removed experimental base_ta...
|
595 |
|
596 |
# Set |
|
add feture. all model class ...
|
597 |
$self->{model} ||= {}; |
598 |
if ($model) { |
|
599 |
$self->{model}{$name} = $model; |
|
removed experimental base_ta...
|
600 |
return $self; |
601 |
} |
|
602 |
|
|
add feture. all model class ...
|
603 |
# Check model existance |
604 |
croak qq{Model "$name" is not included} |
|
605 |
unless $self->{model}{$name}; |
|
removed experimental base_ta...
|
606 |
|
607 |
# Get |
|
add feture. all model class ...
|
608 |
return $self->{model}{$name}; |
removed experimental base_ta...
|
609 |
} |
610 | ||
add feture. all model class ...
|
611 |
sub include_model { |
612 |
my ($self, $name_space, $model_infos) = @_; |
|
remove DBIx::Custom::Model
|
613 |
|
add feture. all model class ...
|
614 |
$name_space ||= ''; |
615 |
unless ($model_infos) { |
|
616 |
# Load name space module |
|
617 |
croak qq{"$name_space" is invalid class name} |
|
618 |
if $name_space =~ /[^\w:]/; |
|
619 |
eval "use $name_space"; |
|
620 |
croak qq{Name space module "$name_space.pm" is needed. $@} if $@; |
|
table object call dbi object...
|
621 |
|
add feture. all model class ...
|
622 |
# Search model modules |
623 |
my $path = $INC{"$name_space.pm"}; |
|
624 |
$path =~ s/\.pm$//; |
|
625 |
opendir my $dh, $path |
|
626 |
or croak qq{Can't open directory "$path": $!}; |
|
627 |
$model_infos = []; |
|
628 |
while (my $module = readdir $dh) { |
|
629 |
push @$model_infos, $module |
|
630 |
if $module =~ s/\.pm$//; |
|
removed experimental base_ta...
|
631 |
} |
add feture. all model class ...
|
632 |
|
633 |
close $dh; |
|
634 |
} |
|
635 |
|
|
636 |
foreach my $model_info (@$model_infos) { |
|
637 |
|
|
638 |
# Model name and class |
|
639 |
my $model_name; |
|
640 |
my $model_class; |
|
641 |
if (ref $model_info eq 'HASH') { |
|
642 |
$model_name = (keys %$model_info)[0]; |
|
643 |
$model_class = $model_info->{$model_name}; |
|
644 |
} |
|
645 |
else { $model_name = $model_class = $model_info } |
|
646 |
my $mclass = "${name_space}::$model_class"; |
|
table object call dbi object...
|
647 |
|
removed experimental base_ta...
|
648 |
# Load |
add feture. all model class ...
|
649 |
croak qq{"$mclass" is invalid class name} |
650 |
if $mclass =~ /[^\w:]/; |
|
651 |
unless ($mclass->can('isa')) { |
|
652 |
eval "use $mclass"; |
|
removed experimental base_ta...
|
653 |
croak $@ if $@; |
654 |
} |
|
table object call dbi object...
|
655 |
|
removed experimental base_ta...
|
656 |
# Instantiate |
add feture. all model class ...
|
657 |
my $model = $mclass->new(dbi => $self); |
658 |
$model->table($model_name) unless $model->table; |
|
removed experimental DBIx::C...
|
659 |
|
removed experimental base_ta...
|
660 |
# Set |
add feture. all model class ...
|
661 |
$self->model($model_name, $model); |
table object call dbi object...
|
662 |
} |
removed experimental base_ta...
|
663 |
return $self; |
remove DBIx::Custom::Model
|
664 |
} |
665 | ||
cleanup
|
666 |
our %VALID_UPDATE_ARGS |
renamed auto_filter to apply...
|
667 |
= map { $_ => 1 } qw/table param |
added experimental sugar met...
|
668 |
where append filter allow_update_all query/; |
cleanup
|
669 | |
670 |
sub update { |
|
671 |
my ($self, %args) = @_; |
|
version 0.0901
|
672 |
|
cleanup
|
673 |
# Check arguments |
674 |
foreach my $name (keys %args) { |
|
675 |
croak qq{"$name" is invalid argument} |
|
676 |
unless $VALID_UPDATE_ARGS{$name}; |
|
removed reconnect method
|
677 |
} |
added cache_method attribute
|
678 |
|
cleanup
|
679 |
# Arguments |
680 |
my $table = $args{table} || ''; |
|
added table not specified ex...
|
681 |
croak qq{"table" option must be specified} unless $table; |
cleanup
|
682 |
my $param = $args{param} || {}; |
683 |
my $where = $args{where} || {}; |
|
select() where can't receive...
|
684 |
my $append = $args{append} || ''; |
cleanup
|
685 |
my $filter = $args{filter}; |
686 |
my $allow_update_all = $args{allow_update_all}; |
|
version 0.0901
|
687 |
|
cleanup
|
688 |
# Update keys |
select() where can't receive...
|
689 |
my @clumns = keys %$param; |
690 | ||
691 |
# Columns |
|
692 |
my @columns; |
|
693 |
my $safety = $self->safety_column_name; |
|
694 |
foreach my $column (keys %$param) { |
|
695 |
croak qq{"$column" is not safety column name} |
|
696 |
unless $column =~ /$safety/; |
|
697 |
push @columns, $column; |
|
698 |
} |
|
699 |
|
|
cleanup
|
700 |
# Update clause |
select() where can't receive...
|
701 |
my $update_clause = '{update_param ' . join(' ', @clumns) . '}'; |
improved delete() and update...
|
702 | |
703 |
# Where |
|
704 |
my $w; |
|
705 |
if (ref $where eq 'HASH') { |
|
706 |
my $clause = ['and']; |
|
707 |
push @$clause, "{= $_}" for keys %$where; |
|
708 |
$w = $self->where; |
|
709 |
$w->clause($clause); |
|
710 |
$w->param($where); |
|
711 |
} |
|
select() where can't receive...
|
712 |
elsif (ref $where eq 'DBIx::Custom::Where') { |
713 |
$w = $where; |
|
714 |
$where = $w->param; |
|
715 |
} |
|
removed experimental registe...
|
716 |
|
improved delete() and update...
|
717 |
croak qq{"where" must be hash refernce or DBIx::Custom::Where object} |
718 |
unless ref $w eq 'DBIx::Custom::Where'; |
|
removed reconnect method
|
719 |
|
select() where can't receive...
|
720 |
# String where |
721 |
my $swhere = "$w"; |
|
improved delete() and update...
|
722 |
|
723 |
croak qq{"where" must be specified} |
|
select() where can't receive...
|
724 |
if "$swhere" eq '' && !$allow_update_all; |
removed reconnect method
|
725 |
|
cleanup
|
726 |
# SQL stack |
727 |
my @sql; |
|
728 |
|
|
729 |
# Update |
|
730 |
push @sql, "update $table $update_clause $swhere"; |
|
731 |
push @sql, $append if $append; |
|
removed reconnect method
|
732 |
|
cleanup
|
733 |
# Rearrange parameters |
improved delete() and update...
|
734 |
foreach my $wkey (keys %$where) { |
removed reconnect method
|
735 |
|
cleanup
|
736 |
if (exists $param->{$wkey}) { |
737 |
$param->{$wkey} = [$param->{$wkey}] |
|
738 |
unless ref $param->{$wkey} eq 'ARRAY'; |
|
739 |
|
|
740 |
push @{$param->{$wkey}}, $where->{$wkey}; |
|
741 |
} |
|
742 |
else { |
|
743 |
$param->{$wkey} = $where->{$wkey}; |
|
744 |
} |
|
removed reconnect method
|
745 |
} |
cleanup
|
746 |
|
cleanup
|
747 |
# SQL |
748 |
my $sql = join(' ', @sql); |
|
749 |
|
|
added experimental sugar met...
|
750 |
# Create query |
cleanup
|
751 |
my $query = $self->create_query($sql); |
added experimental sugar met...
|
752 |
return $query if $args{query}; |
753 |
|
|
cleanup
|
754 |
# Execute query |
added experimental sugar met...
|
755 |
my $ret_val = $self->execute($query, param => $param, |
added auto_filter method
|
756 |
filter => $filter, |
renamed auto_filter to apply...
|
757 |
table => $table); |
cleanup
|
758 |
|
759 |
return $ret_val; |
|
removed reconnect method
|
760 |
} |
761 | ||
cleanup
|
762 |
sub update_all { shift->update(allow_update_all => 1, @_) }; |
763 | ||
cleanup
|
764 |
sub where { |
select() where can't receive...
|
765 |
my $self = shift; |
766 | ||
767 |
return DBIx::Custom::Where->new( |
|
768 |
query_builder => $self->query_builder, |
|
769 |
safety_column_name => $self->safety_column_name |
|
770 |
); |
|
cleanup
|
771 |
} |
added experimental DBIx::Cus...
|
772 | |
added experimental not_exist...
|
773 |
sub _bind { |
cleanup
|
774 |
my ($self, $params, $columns, $filter) = @_; |
removed reconnect method
|
775 |
|
cleanup
|
776 |
# bind values |
added experimental not_exist...
|
777 |
my @bind; |
add tests
|
778 |
|
removed reconnect method
|
779 |
# Build bind values |
780 |
my $count = {}; |
|
added experimental not_exist...
|
781 |
my $not_exists = {}; |
cleanup
|
782 |
foreach my $column (@$columns) { |
removed reconnect method
|
783 |
|
784 |
# Value |
|
added experimental not_exist...
|
785 |
my $value; |
786 |
if(ref $params->{$column} eq 'ARRAY') { |
|
787 |
my $i = $count->{$column} || 0; |
|
788 |
$i += $not_exists->{$column} || 0; |
|
789 |
my $found; |
|
790 |
for (my $k = $i; $i < @{$params->{$column}}; $k++) { |
|
791 |
if (ref $params->{$column}->[$k] eq 'DBIx::Custom::NotExists') { |
|
792 |
$not_exists->{$column}++; |
|
793 |
} |
|
794 |
else { |
|
795 |
$value = $params->{$column}->[$k]; |
|
796 |
$found = 1; |
|
797 |
last |
|
798 |
} |
|
799 |
} |
|
800 |
next unless $found; |
|
801 |
} |
|
802 |
else { $value = $params->{$column} } |
|
removed reconnect method
|
803 |
|
cleanup
|
804 |
# Filter |
805 |
my $f = $filter->{$column} || $self->{default_out_filter} || ''; |
|
cleanup
|
806 |
|
added experimental not_exist...
|
807 |
push @bind, $f ? $f->($value) : $value; |
removed reconnect method
|
808 |
|
809 |
# Count up |
|
810 |
$count->{$column}++; |
|
811 |
} |
|
812 |
|
|
added experimental not_exist...
|
813 |
return \@bind; |
removed reconnect method
|
814 |
} |
815 | ||
cleanup
|
816 |
sub _croak { |
817 |
my ($self, $error, $append) = @_; |
|
818 |
$append ||= ""; |
|
819 |
|
|
820 |
# Verbose |
|
821 |
if ($Carp::Verbose) { croak $error } |
|
822 |
|
|
823 |
# Not verbose |
|
824 |
else { |
|
825 |
|
|
826 |
# Remove line and module infromation |
|
827 |
my $at_pos = rindex($error, ' at '); |
|
828 |
$error = substr($error, 0, $at_pos); |
|
829 |
$error =~ s/\s+$//; |
|
830 |
|
|
831 |
croak "$error$append"; |
|
832 |
} |
|
833 |
} |
|
834 | ||
cleanup
|
835 |
# DEPRECATED! |
cleanup
|
836 |
__PACKAGE__->attr( |
837 |
dbi_options => sub { {} }, |
|
838 |
filter_check => 1 |
|
839 |
); |
|
renamed dbi_options to dbi_o...
|
840 | |
cleanup
|
841 |
# DEPRECATED! |
cleanup
|
842 |
sub default_bind_filter { |
843 |
my $self = shift; |
|
844 |
|
|
845 |
if (@_) { |
|
846 |
my $fname = $_[0]; |
|
847 |
|
|
848 |
if (@_ && !$fname) { |
|
849 |
$self->{default_out_filter} = undef; |
|
850 |
} |
|
851 |
else { |
|
many changed
|
852 |
croak qq{Filter "$fname" is not registered} |
cleanup
|
853 |
unless exists $self->filters->{$fname}; |
854 |
|
|
855 |
$self->{default_out_filter} = $self->filters->{$fname}; |
|
856 |
} |
|
857 |
return $self; |
|
858 |
} |
|
859 |
|
|
860 |
return $self->{default_out_filter}; |
|
861 |
} |
|
862 | ||
cleanup
|
863 |
# DEPRECATED! |
cleanup
|
864 |
sub default_fetch_filter { |
865 |
my $self = shift; |
|
866 |
|
|
867 |
if (@_) { |
|
many changed
|
868 |
my $fname = $_[0]; |
869 | ||
cleanup
|
870 |
if (@_ && !$fname) { |
871 |
$self->{default_in_filter} = undef; |
|
872 |
} |
|
873 |
else { |
|
many changed
|
874 |
croak qq{Filter "$fname" is not registered} |
cleanup
|
875 |
unless exists $self->filters->{$fname}; |
876 |
|
|
877 |
$self->{default_in_filter} = $self->filters->{$fname}; |
|
878 |
} |
|
879 |
|
|
880 |
return $self; |
|
881 |
} |
|
882 |
|
|
many changed
|
883 |
return $self->{default_in_filter}; |
cleanup
|
884 |
} |
885 | ||
cleanup
|
886 |
# DEPRECATED! |
renamed DBIx::Custom::TagPro...
|
887 |
sub register_tag_processor { |
888 |
return shift->query_builder->register_tag_processor(@_); |
|
889 |
} |
|
890 | ||
fixed DBIx::Custom::QueryBui...
|
891 |
1; |
892 | ||
removed reconnect method
|
893 |
=head1 NAME |
894 | ||
renamed build_query to creat...
|
895 |
DBIx::Custom - DBI interface, having hash parameter binding and filtering system |
removed reconnect method
|
896 | |
897 |
=head1 SYNOPSYS |
|
cleanup
|
898 | |
renamed build_query to creat...
|
899 |
use DBIx::Custom; |
renamed update tag to update...
|
900 |
my $dbi = DBIx::Custom->connect(data_source => "dbi:mysql:database=dbname", |
renamed dbi_options to dbi_o...
|
901 |
user => 'ken', password => '!LFKD%$&', |
902 |
dbi_option => {mysql_enable_utf8 => 1}); |
|
cleanup
|
903 | |
removed reconnect method
|
904 |
# Insert |
added insert, update, update...
|
905 |
$dbi->insert(table => 'book', |
renamed update tag to update...
|
906 |
param => {title => 'Perl', author => 'Ken'}, |
renamed dbi_options to dbi_o...
|
907 |
filter => {title => 'to_something'}); |
removed reconnect method
|
908 |
|
909 |
# Update |
|
added insert, update, update...
|
910 |
$dbi->update(table => 'book', |
renamed update tag to update...
|
911 |
param => {title => 'Perl', author => 'Ken'}, |
removed reconnect method
|
912 |
where => {id => 5}, |
renamed dbi_options to dbi_o...
|
913 |
filter => {title => 'to_something'}); |
removed reconnect method
|
914 |
|
915 |
# Update all |
|
added insert, update, update...
|
916 |
$dbi->update_all(table => 'book', |
renamed update tag to update...
|
917 |
param => {title => 'Perl'}, |
renamed dbi_options to dbi_o...
|
918 |
filter => {title => 'to_something'}); |
removed reconnect method
|
919 |
|
920 |
# Delete |
|
added insert, update, update...
|
921 |
$dbi->delete(table => 'book', |
removed reconnect method
|
922 |
where => {author => 'Ken'}, |
renamed dbi_options to dbi_o...
|
923 |
filter => {title => 'to_something'}); |
removed reconnect method
|
924 |
|
925 |
# Delete all |
|
added insert, update, update...
|
926 |
$dbi->delete_all(table => 'book'); |
cleanup
|
927 | |
removed reconnect method
|
928 |
# Select |
renamed fetch_rows to fetch_...
|
929 |
my $result = $dbi->select( |
added insert, update, update...
|
930 |
table => 'book', |
update document
|
931 |
column => [qw/author title/], |
932 |
where => {author => 'Ken'}, |
|
renamed dbi_options to dbi_o...
|
933 |
relation => {'book.id' => 'rental.book_id'}, |
updated document
|
934 |
append => 'order by id limit 5', |
renamed dbi_options to dbi_o...
|
935 |
filter => {title => 'to_something'} |
added commit method
|
936 |
); |
cleanup
|
937 | |
renamed build_query to creat...
|
938 |
# Execute SQL |
added insert, update, update...
|
939 |
$dbi->execute("select title from book"); |
removed register_format()
|
940 |
|
renamed build_query to creat...
|
941 |
# Execute SQL with hash binding and filtering |
added insert, update, update...
|
942 |
$dbi->execute("select id from book where {= author} and {like title}", |
removed register_format()
|
943 |
param => {author => 'ken', title => '%Perl%'}, |
renamed dbi_options to dbi_o...
|
944 |
filter => {title => 'to_something'}); |
removed reconnect method
|
945 | |
946 |
# Create query and execute it |
|
renamed build_query to creat...
|
947 |
my $query = $dbi->create_query( |
added insert, update, update...
|
948 |
"select id from book where {= author} and {like title}" |
removed reconnect method
|
949 |
); |
updated document
|
950 |
$dbi->execute($query, param => {author => 'Ken', title => '%Perl%'}) |
cleanup
|
951 | |
952 |
# Get DBI object |
|
953 |
my $dbh = $dbi->dbh; |
|
954 | ||
removed register_format()
|
955 |
# Fetch |
956 |
while (my $row = $result->fetch) { |
|
957 |
# ... |
|
958 |
} |
|
959 |
|
|
960 |
# Fetch hash |
|
961 |
while (my $row = $result->fetch_hash) { |
|
962 |
|
|
963 |
} |
|
964 |
|
|
renamed update tag to update...
|
965 |
=head1 DESCRIPTIONS |
removed reconnect method
|
966 | |
renamed build_query to creat...
|
967 |
L<DBIx::Custom> is one of L<DBI> interface modules, |
968 |
such as L<DBIx::Class>, L<DBIx::Simple>. |
|
removed reconnect method
|
969 | |
renamed build_query to creat...
|
970 |
This module is not O/R mapper. O/R mapper is useful, |
971 |
but you must learn many syntax of the O/R mapper, |
|
updated document
|
972 |
which is almost another language. |
973 |
Created SQL statement is offten not effcient and damage SQL performance. |
|
renamed build_query to creat...
|
974 |
so you have to execute raw SQL in the end. |
removed reconnect method
|
975 | |
renamed build_query to creat...
|
976 |
L<DBIx::Custom> is middle area between L<DBI> and O/R mapper. |
updated document
|
977 |
L<DBIx::Custom> provide flexible hash parameter binding and filtering system, |
added experimental expand me...
|
978 |
and suger methods, such as C<insert()>, C<update()>, C<delete()>, C<select()> |
updated document
|
979 |
to execute SQL easily. |
removed reconnect method
|
980 | |
updated document
|
981 |
L<DBIx::Custom> respects SQL. SQL is very complex and not beautiful, |
982 |
but de-facto standard, |
|
983 |
so all people learing database know it. |
|
renamed update tag to update...
|
984 |
If you already know SQL, |
985 |
you learn a little thing to use L<DBIx::Custom>. |
|
removed reconnect method
|
986 | |
pod fix
|
987 |
See L<DBIx::Custom::Guide> for more details. |
988 | ||
989 |
=head1 GUIDE |
|
990 | ||
991 |
L<DBIx::Custom::Guide> - L<DBIx::Custom> complete guide |
|
992 | ||
993 |
=head1 EXAMPLES |
|
994 | ||
995 |
L<DBIx::Custom Wiki|https://github.com/yuki-kimoto/DBIx-Custom/wiki> - Many useful examples |
|
updated document
|
996 | |
update document
|
997 |
=head1 ATTRIBUTES |
packaging one directory
|
998 | |
cleanup
|
999 |
=head2 C<cache> |
packaging one directory
|
1000 | |
cleanup
|
1001 |
my $cache = $dbi->cache; |
1002 |
$dbi = $dbi->cache(1); |
|
removed DESTROY method(not b...
|
1003 | |
cleanup
|
1004 |
Enable parsed L<DBIx::Custom::Query> object caching. |
1005 |
Default to 1. |
|
packaging one directory
|
1006 | |
removed DBIx::Custom commit ...
|
1007 |
=head2 C<data_source> |
packaging one directory
|
1008 | |
cleanup
|
1009 |
my $data_source = $dbi->data_source; |
cleanup
|
1010 |
$dbi = $dbi->data_source("DBI:mysql:database=dbname"); |
removed DESTROY method(not b...
|
1011 | |
cleanup
|
1012 |
Data source. |
1013 |
C<connect()> method use this value to connect the database. |
|
removed DESTROY method(not b...
|
1014 | |
removed DBIx::Custom commit ...
|
1015 |
=head2 C<dbh> |
packaging one directory
|
1016 | |
cleanup
|
1017 |
my $dbh = $dbi->dbh; |
1018 |
$dbi = $dbi->dbh($dbh); |
|
packaging one directory
|
1019 | |
cleanup
|
1020 |
L<DBI> object. You can call all methods of L<DBI>. |
packaging one directory
|
1021 | |
renamed dbi_options to dbi_o...
|
1022 |
=head2 C<dbi_option> |
added dbi_options attribute
|
1023 | |
renamed dbi_options to dbi_o...
|
1024 |
my $dbi_option = $dbi->dbi_option; |
1025 |
$dbi = $dbi->dbi_option($dbi_option); |
|
added dbi_options attribute
|
1026 | |
1027 |
DBI options. |
|
1028 |
C<connect()> method use this value to connect the database. |
|
1029 | ||
cleanup
|
1030 |
Default filter when row is fetched. |
packaging one directory
|
1031 | |
cleanup
|
1032 |
=head2 C<filters> |
bind_filter argument is chan...
|
1033 | |
cleanup
|
1034 |
my $filters = $dbi->filters; |
1035 |
$dbi = $dbi->filters(\%filters); |
|
packaging one directory
|
1036 | |
cleanup
|
1037 |
=head2 C<password> |
1038 | ||
1039 |
my $password = $dbi->password; |
|
1040 |
$dbi = $dbi->password('lkj&le`@s'); |
|
1041 | ||
1042 |
Password. |
|
1043 |
C<connect()> method use this value to connect the database. |
|
update document
|
1044 | |
renamed update tag to update...
|
1045 |
=head2 C<query_builder> |
added commit method
|
1046 | |
renamed update tag to update...
|
1047 |
my $sql_class = $dbi->query_builder; |
1048 |
$dbi = $dbi->query_builder(DBIx::Custom::QueryBuilder->new); |
|
added commit method
|
1049 | |
renamed update tag to update...
|
1050 |
SQL builder. C<query_builder()> must be |
renamed build_query to creat...
|
1051 |
the instance of L<DBIx::Custom::QueryBuilder> subclass. |
1052 |
Default to L<DBIx::Custom::QueryBuilder> object. |
|
cleanup
|
1053 | |
cleanup
|
1054 |
=head2 C<result_class> |
cleanup
|
1055 | |
cleanup
|
1056 |
my $result_class = $dbi->result_class; |
1057 |
$dbi = $dbi->result_class('DBIx::Custom::Result'); |
|
cleanup
|
1058 | |
cleanup
|
1059 |
Result class for select statement. |
1060 |
Default to L<DBIx::Custom::Result>. |
|
cleanup
|
1061 | |
update pod
|
1062 |
=head2 C<(experimental) safety_column_name> |
1063 | ||
1064 |
my $safety_column_name = $self->safety_column_name; |
|
1065 |
$dbi = $self->safety_column_name($name); |
|
1066 | ||
1067 |
Safety column name regex. |
|
1068 |
Default is qr/^[\w\.]*$/ |
|
1069 | ||
cleanup
|
1070 |
=head2 C<user> |
cleanup
|
1071 | |
cleanup
|
1072 |
my $user = $dbi->user; |
1073 |
$dbi = $dbi->user('Ken'); |
|
cleanup
|
1074 | |
cleanup
|
1075 |
User name. |
1076 |
C<connect()> method use this value to connect the database. |
|
update pod
|
1077 | |
cleanup
|
1078 |
=head1 METHODS |
added commit method
|
1079 | |
cleanup
|
1080 |
L<DBIx::Custom> inherits all methods from L<Object::Simple> |
autoload DBI method
|
1081 |
and use all method of L<DBI> |
cleanup
|
1082 |
and implements the following new ones. |
added check_filter attribute
|
1083 | |
cleanup
|
1084 |
=head2 C<(experimental) apply_filter> |
added auto_filter method
|
1085 | |
renamed auto_filter to apply...
|
1086 |
$dbi->apply_filter( |
added auto_filter method
|
1087 |
$table, |
fix bug : filter can't over...
|
1088 |
$column1 => {in => $infilter1, out => $outfilter1, end => $endfilter1} |
1089 |
$column2 => {in => $infilter2, out => $outfilter2, end =. $endfilter2} |
|
renamed auto_filter to apply...
|
1090 |
..., |
added auto_filter method
|
1091 |
); |
1092 | ||
renamed auto_filter to apply...
|
1093 |
C<apply_filter> is automatically filter for columns of table. |
added auto_filter method
|
1094 |
This have effect C<insert>, C<update>, C<delete>. C<select> |
cleanup
|
1095 |
and L<DBIx::Custom::Result> object. but this has'nt C<execute> method. |
1096 | ||
cleanup
|
1097 |
If you want to have effect C<execute()> method, use C<table> |
cleanup
|
1098 |
arguments. |
added auto_filter method
|
1099 | |
cleanup
|
1100 |
$result = $dbi->execute( |
1101 |
"select * from table1 where {= key1} and {= key2};", |
|
1102 |
param => {key1 => 1, key2 => 2}, |
|
renamed auto_filter to apply...
|
1103 |
table => ['table1'] |
cleanup
|
1104 |
); |
fix bug : filter can't over...
|
1105 | |
1106 |
You can use three name as column name. |
|
1107 | ||
1108 |
1. column : author |
|
1109 |
2. table.column : book.author |
|
1110 |
3. table__column : book__author |
|
1111 | ||
removed DBIx::Custom commit ...
|
1112 |
=head2 C<connect> |
packaging one directory
|
1113 | |
cleanup
|
1114 |
my $dbi = DBIx::Custom->connect(data_source => "dbi:mysql:database=dbname", |
update document
|
1115 |
user => 'ken', password => '!LFKD%$&'); |
bind_filter argument is chan...
|
1116 | |
cleanup
|
1117 |
Create a new L<DBIx::Custom> object and connect to the database. |
renamed build_query to creat...
|
1118 |
L<DBIx::Custom> is a wrapper of L<DBI>. |
cleanup
|
1119 |
C<AutoCommit> and C<RaiseError> options are true, |
renamed build_query to creat...
|
1120 |
and C<PrintError> option is false by default. |
packaging one directory
|
1121 | |
cleanup
|
1122 |
=head2 C<create_query> |
1123 |
|
|
1124 |
my $query = $dbi->create_query( |
|
added insert, update, update...
|
1125 |
"select * from book where {= author} and {like title};" |
cleanup
|
1126 |
); |
update document
|
1127 | |
cleanup
|
1128 |
Create the instance of L<DBIx::Custom::Query> from the source of SQL. |
1129 |
If you want to get high performance, |
|
1130 |
use C<create_query()> method and execute it by C<execute()> method |
|
1131 |
instead of suger methods. |
|
bind_filter argument is chan...
|
1132 | |
cleanup
|
1133 |
$dbi->execute($query, {author => 'Ken', title => '%Perl%'}); |
version 0.0901
|
1134 | |
cleanup
|
1135 |
=head2 C<execute> |
packaging one directory
|
1136 | |
cleanup
|
1137 |
my $result = $dbi->execute($query, param => $params, filter => \%filter); |
1138 |
my $result = $dbi->execute($source, param => $params, filter => \%filter); |
|
update document
|
1139 | |
cleanup
|
1140 |
Execute query or the source of SQL. |
1141 |
Query is L<DBIx::Custom::Query> object. |
|
1142 |
Return value is L<DBIx::Custom::Result> if select statement is executed, |
|
1143 |
or the count of affected rows if insert, update, delete statement is executed. |
|
version 0.0901
|
1144 | |
removed DBIx::Custom commit ...
|
1145 |
=head2 C<delete> |
packaging one directory
|
1146 | |
cleanup
|
1147 |
$dbi->delete(table => $table, |
1148 |
where => \%where, |
|
1149 |
append => $append, |
|
added experimental sugar met...
|
1150 |
filter => \%filter, |
1151 |
query => 1); |
|
bind_filter argument is chan...
|
1152 | |
renamed build_query to creat...
|
1153 |
Execute delete statement. |
1154 |
C<delete> method have C<table>, C<where>, C<append>, and C<filter> arguments. |
|
1155 |
C<table> is a table name. |
|
1156 |
C<where> is where clause. this must be hash reference. |
|
1157 |
C<append> is a string added at the end of the SQL statement. |
|
1158 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1159 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1160 |
default to 0. This is experimental. |
|
cleanup
|
1161 |
Return value of C<delete()> is the count of affected rows. |
renamed build_query to creat...
|
1162 | |
removed DBIx::Custom commit ...
|
1163 |
=head2 C<delete_all> |
packaging one directory
|
1164 | |
cleanup
|
1165 |
$dbi->delete_all(table => $table); |
packaging one directory
|
1166 | |
renamed build_query to creat...
|
1167 |
Execute delete statement to delete all rows. |
1168 |
Arguments is same as C<delete> method, |
|
1169 |
except that C<delete_all> don't have C<where> argument. |
|
cleanup
|
1170 |
Return value of C<delete_all()> is the count of affected rows. |
bind_filter argument is chan...
|
1171 | |
cleanup
|
1172 |
=head2 C<insert> |
1173 | ||
1174 |
$dbi->insert(table => $table, |
|
1175 |
param => \%param, |
|
1176 |
append => $append, |
|
added experimental sugar met...
|
1177 |
filter => \%filter, |
1178 |
query => 1); |
|
cleanup
|
1179 | |
1180 |
Execute insert statement. |
|
1181 |
C<insert> method have C<table>, C<param>, C<append> |
|
1182 |
and C<filter> arguments. |
|
1183 |
C<table> is a table name. |
|
1184 |
C<param> is the pairs of column name value. this must be hash reference. |
|
1185 |
C<append> is a string added at the end of the SQL statement. |
|
1186 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1187 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1188 |
default to 0. This is experimental. |
|
cleanup
|
1189 |
This is overwrites C<default_bind_filter>. |
1190 |
Return value of C<insert()> is the count of affected rows. |
|
1191 | ||
pod fix
|
1192 |
=head2 C<(experimental) each_column> |
added experimental iterate_a...
|
1193 | |
pod fix
|
1194 |
$dbi->each_column( |
added experimental iterate_a...
|
1195 |
sub { |
added experimental not_exist...
|
1196 |
my ($self, $table, $column, $info) = @_; |
added experimental iterate_a...
|
1197 |
|
pod fix
|
1198 |
my $type = $info->{TYPE_NAME}; |
1199 |
|
|
1200 |
if ($type eq 'DATE') { |
|
1201 |
# ... |
|
1202 |
} |
|
added experimental iterate_a...
|
1203 |
} |
1204 |
); |
|
pod fix
|
1205 |
Get column informations from database. |
1206 |
Argument is callback. |
|
1207 |
You can do anything in callback. |
|
added experimental not_exist...
|
1208 |
Callback receive four arguments, dbi object, table name, |
1209 |
column name and columninformation. |
|
1210 | ||
add feture. all model class ...
|
1211 |
=head2 C<(experimental) include_model> |
removed experimental base_ta...
|
1212 | |
add feture. all model class ...
|
1213 |
$dbi->include_model( |
1214 |
'MyModel' => [ |
|
removed experimental base_ta...
|
1215 |
'book', 'person', 'company' |
1216 |
] |
|
1217 |
); |
|
1218 | ||
add feture. all model class ...
|
1219 |
Include models. First argument is name space. |
removed experimental base_ta...
|
1220 |
Second argument is array reference of class base names. |
1221 | ||
add feture. all model class ...
|
1222 |
If you don't specify second argument, All models under name space is |
1223 |
included. |
|
1224 | ||
1225 |
$dbi->include_model('MyModel'); |
|
1226 | ||
1227 |
Note that in this case name spece module is needed. |
|
1228 | ||
1229 |
# MyModel.pm |
|
1230 |
package MyModel; |
|
1231 |
|
|
1232 |
use base 'DBIx::Custom::Model'; |
|
1233 | ||
1234 |
The following model is instantiated and included. |
|
removed experimental base_ta...
|
1235 | |
add feture. all model class ...
|
1236 |
MyModel::book |
1237 |
MyModel::person |
|
1238 |
MyModel::company |
|
removed experimental base_ta...
|
1239 | |
add feture. all model class ...
|
1240 |
You can get these instance by C<model()>. |
removed experimental base_ta...
|
1241 | |
add feture. all model class ...
|
1242 |
my $book_model = $dbi->model('book'); |
removed experimental base_ta...
|
1243 | |
add feture. all model class ...
|
1244 |
If you want to other name as model class, |
removed experimental base_ta...
|
1245 |
you can do like this. |
1246 | ||
add feture. all model class ...
|
1247 |
$dbi->include_model( |
1248 |
'MyModel' => [ |
|
removed experimental base_ta...
|
1249 |
{'book' => 'Book'}, |
1250 |
{'person' => 'Person'} |
|
1251 |
] |
|
1252 |
); |
|
1253 | ||
added experimental not_exist...
|
1254 |
=head2 C<(experimental) method> |
1255 | ||
1256 |
$dbi->method( |
|
1257 |
update_or_insert => sub { |
|
1258 |
my $self = shift; |
|
1259 |
# do something |
|
1260 |
}, |
|
1261 |
find_or_create => sub { |
|
1262 |
my $self = shift; |
|
1263 |
# do something |
|
1264 |
} |
|
1265 |
); |
|
1266 | ||
1267 |
Register method. These method is called from L<DBIx::Custom> object directory. |
|
1268 | ||
1269 |
$dbi->update_or_insert; |
|
1270 |
$dbi->find_or_create; |
|
1271 | ||
1272 |
=head2 C<new> |
|
1273 | ||
1274 |
my $dbi = DBIx::Custom->connect(data_source => "dbi:mysql:database=dbname", |
|
1275 |
user => 'ken', password => '!LFKD%$&'); |
|
1276 | ||
1277 |
Create a new L<DBIx::Custom> object. |
|
1278 | ||
1279 |
=head2 C<(experimental) not_exists> |
|
1280 | ||
1281 |
my $not_exists = $dbi->not_exists; |
|
1282 | ||
1283 |
Get DBIx::Custom::NotExists object. |
|
experimental extended select...
|
1284 | |
cleanup
|
1285 |
=head2 C<register_filter> |
1286 | ||
1287 |
$dbi->register_filter(%filters); |
|
1288 |
$dbi->register_filter(\%filters); |
|
1289 |
|
|
1290 |
Register filter. Registered filters is available in the following attributes |
|
1291 |
or arguments. |
|
1292 | ||
1293 |
=over 4 |
|
1294 | ||
1295 |
=item * |
|
1296 | ||
1297 |
C<filter> argument of C<insert()>, C<update()>, |
|
1298 |
C<update_all()>, C<delete()>, C<delete_all()>, C<select()> |
|
1299 |
methods |
|
1300 | ||
1301 |
=item * |
|
1302 | ||
1303 |
C<execute()> method |
|
1304 | ||
1305 |
=item * |
|
1306 | ||
1307 |
C<default_filter> and C<filter> of C<DBIx::Custom::Query> |
|
1308 | ||
1309 |
=item * |
|
1310 | ||
1311 |
C<default_filter> and C<filter> of C<DBIx::Custom::Result> |
|
1312 | ||
1313 |
=back |
|
1314 | ||
renamed DBIx::Custom::TagPro...
|
1315 |
=head2 C<register_tag> |
added register_tag_processor
|
1316 | |
renamed DBIx::Custom::TagPro...
|
1317 |
$dbi->register_tag( |
added register_tag_processor
|
1318 |
limit => sub { |
1319 |
...; |
|
1320 |
} |
|
1321 |
); |
|
1322 | ||
cleanup
|
1323 |
Register tag. |
added register_tag_processor
|
1324 | |
added auto_filter method
|
1325 |
=head2 C<rollback> |
cleanup
|
1326 | |
1327 |
$dbi->rollback; |
|
1328 | ||
1329 |
Rollback transaction. |
|
1330 |
This is same as L<DBI>'s C<rollback>. |
|
1331 | ||
removed DBIx::Custom commit ...
|
1332 |
=head2 C<select> |
packaging one directory
|
1333 |
|
cleanup
|
1334 |
my $result = $dbi->select(table => $table, |
1335 |
column => [@column], |
|
1336 |
where => \%where, |
|
1337 |
append => $append, |
|
1338 |
relation => \%relation, |
|
added experimental sugar met...
|
1339 |
filter => \%filter, |
add experimental selection o...
|
1340 |
query => 1, |
1341 |
selection => $selection); |
|
update document
|
1342 | |
renamed build_query to creat...
|
1343 |
Execute select statement. |
cleanup
|
1344 |
C<select> method have C<table>, C<column>, C<where>, C<append>, |
renamed build_query to creat...
|
1345 |
C<relation> and C<filter> arguments. |
1346 |
C<table> is a table name. |
|
cleanup
|
1347 |
C<where> is where clause. this is normally hash reference. |
renamed build_query to creat...
|
1348 |
C<append> is a string added at the end of the SQL statement. |
1349 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1350 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1351 |
default to 0. This is experimental. |
|
add experimental selection o...
|
1352 |
C<selection> is string of column name and tables. This is experimental |
1353 | ||
1354 |
selection => 'name, location.name as location_name ' . |
|
1355 |
'from company inner join location' |
|
update document
|
1356 | |
cleanup
|
1357 |
First element is a string. it contains tags, |
1358 |
such as "{= title} or {like author}". |
|
1359 |
Second element is paramters. |
|
1360 | ||
cleanup
|
1361 |
=head2 C<update> |
removed reconnect method
|
1362 | |
cleanup
|
1363 |
$dbi->update(table => $table, |
1364 |
param => \%params, |
|
1365 |
where => \%where, |
|
1366 |
append => $append, |
|
added experimental sugar met...
|
1367 |
filter => \%filter, |
1368 |
query => 1) |
|
removed reconnect method
|
1369 | |
cleanup
|
1370 |
Execute update statement. |
1371 |
C<update> method have C<table>, C<param>, C<where>, C<append> |
|
1372 |
and C<filter> arguments. |
|
1373 |
C<table> is a table name. |
|
1374 |
C<param> is column-value pairs. this must be hash reference. |
|
1375 |
C<where> is where clause. this must be hash reference. |
|
1376 |
C<append> is a string added at the end of the SQL statement. |
|
1377 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1378 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1379 |
default to 0. This is experimental. |
|
cleanup
|
1380 |
This is overwrites C<default_bind_filter>. |
1381 |
Return value of C<update()> is the count of affected rows. |
|
removed reconnect method
|
1382 | |
add feture. all model class ...
|
1383 |
=head2 C<(experimental) model> |
remove DBIx::Custom::Model
|
1384 | |
add feture. all model class ...
|
1385 |
$dbi->model('book')->method( |
remove DBIx::Custom::Model
|
1386 |
insert => sub { ... }, |
1387 |
update => sub { ... } |
|
1388 |
); |
|
1389 |
|
|
add feture. all model class ...
|
1390 |
my $model = $dbi->model('book'); |
remove DBIx::Custom::Model
|
1391 | |
add feture. all model class ...
|
1392 |
Set and get a L<DBIx::Custom::Model> object, |
remove DBIx::Custom::Model
|
1393 | |
cleanup
|
1394 |
=head2 C<update_all> |
renamed build_query to creat...
|
1395 | |
cleanup
|
1396 |
$dbi->update_all(table => $table, |
1397 |
param => \%params, |
|
1398 |
filter => \%filter, |
|
1399 |
append => $append); |
|
renamed build_query to creat...
|
1400 | |
cleanup
|
1401 |
Execute update statement to update all rows. |
1402 |
Arguments is same as C<update> method, |
|
1403 |
except that C<update_all> don't have C<where> argument. |
|
1404 |
Return value of C<update_all()> is the count of affected rows. |
|
removed DBIx::Custom commit ...
|
1405 | |
fix tests
|
1406 |
=head2 C<(experimental) where> |
1407 | ||
1408 |
my $where = $dbi->where; |
|
1409 | ||
1410 |
Create a new L<DBIx::Custom::Where> object. |
|
1411 | ||
cleanup
|
1412 |
=head2 C<cache_method> |
cleanup
|
1413 | |
1414 |
$dbi = $dbi->cache_method(\&cache_method); |
|
1415 |
$cache_method = $dbi->cache_method |
|
1416 | ||
1417 |
Method to set and get caches. |
|
1418 | ||
cleanup
|
1419 |
=head1 Tags |
1420 | ||
1421 |
The following tags is available. |
|
1422 | ||
add experimental selection o...
|
1423 |
=head2 C<(experimental) table> |
add table tag
|
1424 | |
1425 |
Table tag |
|
1426 | ||
1427 |
{table TABLE} -> TABLE |
|
1428 | ||
1429 |
This is used to teach what is applied table to C<execute()>. |
|
1430 | ||
cleanup
|
1431 |
=head2 C<?> |
1432 | ||
1433 |
Placeholder tag. |
|
1434 | ||
1435 |
{? NAME} -> ? |
|
1436 | ||
1437 |
=head2 C<=> |
|
1438 | ||
1439 |
Equal tag. |
|
1440 | ||
1441 |
{= NAME} -> NAME = ? |
|
1442 | ||
1443 |
=head2 C<E<lt>E<gt>> |
|
1444 | ||
1445 |
Not equal tag. |
|
1446 | ||
1447 |
{<> NAME} -> NAME <> ? |
|
1448 | ||
1449 |
=head2 C<E<lt>> |
|
1450 | ||
1451 |
Lower than tag |
|
1452 | ||
1453 |
{< NAME} -> NAME < ? |
|
1454 | ||
1455 |
=head2 C<E<gt>> |
|
1456 | ||
1457 |
Greater than tag |
|
1458 | ||
1459 |
{> NAME} -> NAME > ? |
|
1460 | ||
1461 |
=head2 C<E<gt>=> |
|
1462 | ||
1463 |
Greater than or equal tag |
|
1464 | ||
1465 |
{>= NAME} -> NAME >= ? |
|
1466 | ||
1467 |
=head2 C<E<lt>=> |
|
1468 | ||
1469 |
Lower than or equal tag |
|
1470 | ||
1471 |
{<= NAME} -> NAME <= ? |
|
1472 | ||
1473 |
=head2 C<like> |
|
1474 | ||
1475 |
Like tag |
|
1476 | ||
1477 |
{like NAME} -> NAME like ? |
|
1478 | ||
1479 |
=head2 C<in> |
|
1480 | ||
1481 |
In tag. |
|
1482 | ||
1483 |
{in NAME COUNT} -> NAME in [?, ?, ..] |
|
1484 | ||
1485 |
=head2 C<insert_param> |
|
1486 | ||
1487 |
Insert parameter tag. |
|
1488 | ||
1489 |
{insert_param NAME1 NAME2} -> (NAME1, NAME2) values (?, ?) |
|
1490 | ||
1491 |
=head2 C<update_param> |
|
1492 | ||
1493 |
Updata parameter tag. |
|
1494 | ||
1495 |
{update_param NAME1 NAME2} -> set NAME1 = ?, NAME2 = ? |
|
1496 | ||
DBIx::Custom is now stable
|
1497 |
=head1 STABILITY |
1498 | ||
cleanup
|
1499 |
L<DBIx::Custom> is stable. APIs keep backword compatible |
1500 |
except experimental one in the feature. |
|
DBIx::Custom is now stable
|
1501 | |
removed DESTROY method(not b...
|
1502 |
=head1 BUGS |
1503 | ||
renamed build_query to creat...
|
1504 |
Please tell me bugs if found. |
removed DESTROY method(not b...
|
1505 | |
1506 |
C<< <kimoto.yuki at gmail.com> >> |
|
1507 | ||
1508 |
L<http://github.com/yuki-kimoto/DBIx-Custom> |
|
1509 | ||
removed reconnect method
|
1510 |
=head1 AUTHOR |
1511 | ||
1512 |
Yuki Kimoto, C<< <kimoto.yuki at gmail.com> >> |
|
version 0.0901
|
1513 | |
packaging one directory
|
1514 |
=head1 COPYRIGHT & LICENSE |
1515 | ||
cleanup
|
1516 |
Copyright 2009-2011 Yuki Kimoto, all rights reserved. |
packaging one directory
|
1517 | |
1518 |
This program is free software; you can redistribute it and/or modify it |
|
1519 |
under the same terms as Perl itself. |
|
1520 | ||
1521 |
=cut |
|
added cache_method attribute
|
1522 | |
1523 |