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