cleanup
|
1 |
package DBIx::Custom; |
2 | ||
add models() attribute
|
3 |
our $VERSION = '0.1648'; |
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 |
}}, |
|
add models() attribute
|
30 |
models => sub { {} }, |
cleanup
|
31 |
query_builder => sub { DBIx::Custom::QueryBuilder->new }, |
many changed
|
32 |
result_class => 'DBIx::Custom::Result', |
update pod
|
33 |
safety_column_name => sub { qr/^[\w\.]*$/ }, |
34 |
stash => sub { {} } |
|
many changed
|
35 |
); |
36 | ||
37 |
__PACKAGE__->attr( |
|
38 |
cache_method => sub { |
|
39 |
sub { |
|
40 |
my $self = shift; |
|
41 |
|
|
42 |
$self->{_cached} ||= {}; |
|
43 |
|
|
44 |
if (@_ > 1) { |
|
45 |
$self->{_cached}{$_[0]} = $_[1] |
|
46 |
} |
|
47 |
else { |
|
48 |
return $self->{_cached}{$_[0]} |
|
49 |
} |
|
50 |
} |
|
51 |
} |
|
52 |
); |
|
53 | ||
54 |
__PACKAGE__->attr( |
|
fix tests
|
55 |
filters => sub { |
56 |
{ |
|
57 |
encode_utf8 => sub { encode_utf8($_[0]) }, |
|
58 |
decode_utf8 => sub { decode_utf8($_[0]) } |
|
59 |
} |
|
many changed
|
60 |
} |
fix tests
|
61 |
); |
cleanup
|
62 | |
added helper method
|
63 |
our $AUTOLOAD; |
64 |
sub AUTOLOAD { |
|
65 |
my $self = shift; |
|
66 | ||
renamed helper to method.
|
67 |
# Method name |
68 |
my ($package, $mname) = $AUTOLOAD =~ /^([\w\:]+)\:\:(\w+)$/; |
|
added helper method
|
69 | |
renamed helper to method.
|
70 |
# Method |
71 |
$self->{_methods} ||= {}; |
|
add feture. all model class ...
|
72 |
if (my $method = $self->{_methods}->{$mname}) { |
73 |
return $self->$method(@_) |
|
74 |
} |
|
75 |
elsif ($self->dbh->can($mname)) { |
|
76 |
$self->dbh->$mname(@_); |
|
77 |
} |
|
78 |
else { |
|
79 |
croak qq/Can't locate object method "$mname" via "$package"/ |
|
80 |
} |
|
added helper method
|
81 |
} |
82 | ||
renamed auto_filter to apply...
|
83 |
sub apply_filter { |
many changed
|
84 |
my ($self, $table, @cinfos) = @_; |
85 | ||
86 |
# Initialize filters |
|
cleanup
|
87 |
$self->{filter} ||= {}; |
many changed
|
88 |
$self->{filter}{out} ||= {}; |
89 |
$self->{filter}{in} ||= {}; |
|
cleanup
|
90 |
|
many changed
|
91 |
# Create filters |
92 |
my $usage = "Usage: \$dbi->apply_filter(" . |
|
fix bug : filter can't over...
|
93 |
"TABLE, COLUMN1, {in => INFILTER1, out => OUTFILTER1, end => ENDFILTER1}, " . |
94 |
"COLUMN2, {in => INFILTER2, out => OUTFILTER2, end => ENDFILTER2}, ...)"; |
|
many changed
|
95 | |
96 |
for (my $i = 0; $i < @cinfos; $i += 2) { |
|
added auto_filter method
|
97 |
|
many changed
|
98 |
# Column |
99 |
my $column = $cinfos[$i]; |
|
added auto_filter method
|
100 |
|
fix bug : filter can't over...
|
101 |
# Filter info |
102 |
my $finfo = $cinfos[$i + 1] || {}; |
|
103 |
croak $usage unless ref $finfo eq 'HASH'; |
|
104 |
foreach my $ftype (keys %$finfo) { |
|
105 |
croak $usage unless $ftype eq 'in' || $ftype eq 'out' |
|
106 |
|| $ftype eq 'end'; |
|
many changed
|
107 |
} |
108 |
|
|
fix bug : filter can't over...
|
109 |
foreach my $way (qw/in out end/) { |
110 |
my $filter = $finfo->{$way}; |
|
cleanup
|
111 |
|
fix bug : filter can't over...
|
112 |
# State |
113 |
my $state = !exists $finfo->{$way} ? 'not_exists' |
|
114 |
: !defined $filter ? 'not_defined' |
|
115 |
: ref $filter eq 'CODE' ? 'code' |
|
116 |
: 'name'; |
|
117 |
|
|
118 |
next if $state eq 'not_exists'; |
|
119 |
|
|
120 |
# Check filter |
|
121 |
croak qq{Filter "$filter" is not registered} |
|
122 |
if $state eq 'name' |
|
123 |
&& ! exists $self->filters->{$filter}; |
|
124 |
|
|
125 |
# Filter |
|
126 |
my $f = $state eq 'not_defined' ? undef |
|
127 |
: $state eq 'code' ? $filter |
|
128 |
: $self->filters->{$filter}; |
|
129 |
$self->{filter}{$way}{$table}{$column} = $f; |
|
130 |
$self->{filter}{$way}{$table}{"$table.$column"} = $f; |
|
131 |
$self->{filter}{$way}{$table}{"${table}__$column"} = $f; |
|
many changed
|
132 |
} |
added auto_filter method
|
133 |
} |
134 |
|
|
many changed
|
135 |
return $self; |
added auto_filter method
|
136 |
} |
137 | ||
renamed helper to method.
|
138 |
sub method { |
added helper method
|
139 |
my $self = shift; |
140 |
|
|
141 |
# Merge |
|
renamed helper to method.
|
142 |
my $methods = ref $_[0] eq 'HASH' ? $_[0] : {@_}; |
143 |
$self->{_methods} = {%{$self->{_methods} || {}}, %$methods}; |
|
added helper method
|
144 |
|
145 |
return $self; |
|
146 |
} |
|
147 | ||
packaging one directory
|
148 |
sub connect { |
cleanup
|
149 |
my $self = ref $_[0] ? shift : shift->new(@_);; |
removed register_format()
|
150 |
|
many changed
|
151 |
# Attributes |
packaging one directory
|
152 |
my $data_source = $self->data_source; |
many changed
|
153 |
croak qq{"data_source" must be specified to connect()"} |
check arguments of connect m...
|
154 |
unless $data_source; |
packaging one directory
|
155 |
my $user = $self->user; |
156 |
my $password = $self->password; |
|
renamed dbi_options to dbi_o...
|
157 |
my $dbi_option = {%{$self->dbi_options}, %{$self->dbi_option}}; |
added dbi_options attribute
|
158 |
|
update document
|
159 |
# Connect |
select, insert, update, upda...
|
160 |
my $dbh = eval {DBI->connect( |
packaging one directory
|
161 |
$data_source, |
162 |
$user, |
|
163 |
$password, |
|
164 |
{ |
|
add default_dbi_option()
|
165 |
%{$self->default_dbi_option}, |
renamed dbi_options to dbi_o...
|
166 |
%$dbi_option |
packaging one directory
|
167 |
} |
168 |
)}; |
|
169 |
|
|
update document
|
170 |
# Connect error |
packaging one directory
|
171 |
croak $@ if $@; |
172 |
|
|
update document
|
173 |
# Database handle |
packaging one directory
|
174 |
$self->dbh($dbh); |
update document
|
175 |
|
packaging one directory
|
176 |
return $self; |
177 |
} |
|
178 | ||
cleanup
|
179 |
sub create_query { |
180 |
my ($self, $source) = @_; |
|
update document
|
181 |
|
cleanup
|
182 |
# Cache |
183 |
my $cache = $self->cache; |
|
update document
|
184 |
|
cleanup
|
185 |
# Create query |
186 |
my $query; |
|
187 |
if ($cache) { |
|
188 |
|
|
189 |
# Get query |
|
190 |
my $q = $self->cache_method->($self, $source); |
|
191 |
|
|
192 |
# Create query |
|
add table tag
|
193 |
if ($q) { |
194 |
$query = DBIx::Custom::Query->new($q); |
|
195 |
$query->filters($self->filters); |
|
196 |
} |
|
cleanup
|
197 |
} |
198 |
|
|
199 |
unless ($query) { |
|
cleanup insert
|
200 | |
cleanup
|
201 |
# Create SQL object |
202 |
my $builder = $self->query_builder; |
|
203 |
|
|
204 |
# Create query |
|
205 |
$query = $builder->build_query($source); |
|
removed register_format()
|
206 | |
cleanup
|
207 |
# Cache query |
208 |
$self->cache_method->($self, $source, |
|
209 |
{sql => $query->sql, |
|
add table tag
|
210 |
columns => $query->columns, |
211 |
tables => $query->tables}) |
|
cleanup
|
212 |
if $cache; |
cleanup insert
|
213 |
} |
214 |
|
|
cleanup
|
215 |
# Prepare statement handle |
216 |
my $sth; |
|
217 |
eval { $sth = $self->dbh->prepare($query->{sql})}; |
|
renamed DBIx::Custom::TagPro...
|
218 |
$self->_croak($@, qq{. Following SQL is executed. "$query->{sql}"}) if $@; |
packaging one directory
|
219 |
|
cleanup
|
220 |
# Set statement handle |
221 |
$query->sth($sth); |
|
packaging one directory
|
222 |
|
cleanup
|
223 |
# Set filters |
224 |
$query->filters($self->filters); |
|
225 |
|
|
cleanup
|
226 |
return $query; |
packaging one directory
|
227 |
} |
228 | ||
cleanup
|
229 |
our %VALID_DELETE_ARGS |
added experimental sugar met...
|
230 |
= map { $_ => 1 } qw/table where append filter allow_delete_all query/; |
cleanup update and update_al...
|
231 | |
cleanup
|
232 |
sub delete { |
select, insert, update, upda...
|
233 |
my ($self, %args) = @_; |
cleanup update and update_al...
|
234 |
|
235 |
# Check arguments |
|
select, insert, update, upda...
|
236 |
foreach my $name (keys %args) { |
add tests
|
237 |
croak qq{"$name" is invalid argument} |
cleanup
|
238 |
unless $VALID_DELETE_ARGS{$name}; |
cleanup update and update_al...
|
239 |
} |
240 |
|
|
241 |
# Arguments |
|
select, insert, update, upda...
|
242 |
my $table = $args{table} || ''; |
added table not specified ex...
|
243 |
croak qq{"table" option must be specified} unless $table; |
select, insert, update, upda...
|
244 |
my $where = $args{where} || {}; |
select() where can't receive...
|
245 |
my $append = $args{append}; |
select, insert, update, upda...
|
246 |
my $filter = $args{filter}; |
cleanup
|
247 |
my $allow_delete_all = $args{allow_delete_all}; |
added auto_filter method
|
248 | |
make delete() using where ob...
|
249 |
# Where |
250 |
my $w; |
|
251 |
if (ref $where eq 'HASH') { |
|
252 |
my $clause = ['and']; |
|
253 |
push @$clause, "{= $_}" for keys %$where; |
|
254 |
$w = $self->where; |
|
255 |
$w->clause($clause); |
|
improved delete() and update...
|
256 |
$w->param($where); |
packaging one directory
|
257 |
} |
select() where can't receive...
|
258 |
elsif (ref $where eq 'DBIx::Custom::Where') { |
259 |
$w = $where; |
|
260 |
$where = $w->param; |
|
261 |
} |
|
make delete() using where ob...
|
262 |
croak qq{"where" must be hash refernce or DBIx::Custom::Where object} |
263 |
unless ref $w eq 'DBIx::Custom::Where'; |
|
264 |
|
|
select() where can't receive...
|
265 |
# String where |
266 |
my $swhere = "$w"; |
|
improved delete() and update...
|
267 |
|
make delete() using where ob...
|
268 |
croak qq{"where" must be specified} |
select() where can't receive...
|
269 |
if $swhere eq '' && !$allow_delete_all; |
make delete() using where ob...
|
270 | |
cleanup
|
271 |
# SQL stack |
272 |
my @sql; |
|
273 | ||
274 |
# Delete |
|
275 |
push @sql, "delete from $table $swhere"; |
|
276 |
push @sql, $append if $append; |
|
277 |
|
|
278 |
my $sql = join(' ', @sql); |
|
packaging one directory
|
279 |
|
added experimental sugar met...
|
280 |
# Create query |
cleanup
|
281 |
my $query = $self->create_query($sql); |
added experimental sugar met...
|
282 |
return $query if $args{query}; |
283 |
|
|
packaging one directory
|
284 |
# Execute query |
added auto_filter method
|
285 |
my $ret_val = $self->execute( |
added experimental sugar met...
|
286 |
$query, param => $where, filter => $filter, |
renamed auto_filter to apply...
|
287 |
table => $table); |
packaging one directory
|
288 |
|
289 |
return $ret_val; |
|
290 |
} |
|
291 | ||
cleanup
|
292 |
sub delete_all { shift->delete(allow_delete_all => 1, @_) } |
packaging one directory
|
293 | |
added helper method
|
294 |
sub DESTROY { } |
295 | ||
renamed auto_filter to apply...
|
296 |
our %VALID_EXECUTE_ARGS = map { $_ => 1 } qw/param filter table/; |
refactoring delete and delet...
|
297 | |
cleanup
|
298 |
sub execute{ |
299 |
my ($self, $query, %args) = @_; |
|
refactoring delete and delet...
|
300 |
|
301 |
# Check arguments |
|
select, insert, update, upda...
|
302 |
foreach my $name (keys %args) { |
add tests
|
303 |
croak qq{"$name" is invalid argument} |
cleanup
|
304 |
unless $VALID_EXECUTE_ARGS{$name}; |
refactoring delete and delet...
|
305 |
} |
306 |
|
|
cleanup
|
307 |
my $params = $args{param} || {}; |
packaging one directory
|
308 |
|
cleanup
|
309 |
# First argument is the soruce of SQL |
310 |
$query = $self->create_query($query) |
|
311 |
unless ref $query; |
|
packaging one directory
|
312 |
|
add table tag
|
313 |
# Applied filter |
cleanup
|
314 |
my $filter = {}; |
add table tag
|
315 |
my $tables = $query->tables; |
316 |
my $arg_tables = $args{table} || []; |
|
317 |
$arg_tables = [$arg_tables] |
|
318 |
unless ref $arg_tables eq 'ARRAY'; |
|
319 |
push @$tables, @$arg_tables; |
|
renamed auto_filter to apply...
|
320 |
foreach my $table (@$tables) { |
cleanup
|
321 |
$filter = { |
322 |
%$filter, |
|
323 |
%{$self->{filter}{out}->{$table} || {}} |
|
added auto_filter method
|
324 |
} |
325 |
} |
|
326 |
|
|
cleanup
|
327 |
# Filter argument |
328 |
my $f = $args{filter} || $query->filter || {}; |
|
329 |
foreach my $column (keys %$f) { |
|
330 |
my $fname = $f->{$column}; |
|
renamed auto_filter to apply...
|
331 |
if (!defined $fname) { |
cleanup
|
332 |
$f->{$column} = undef; |
renamed auto_filter to apply...
|
333 |
} |
334 |
elsif (ref $fname ne 'CODE') { |
|
many changed
|
335 |
croak qq{Filter "$fname" is not registered"} |
cleanup
|
336 |
unless exists $self->filters->{$fname}; |
337 |
|
|
cleanup
|
338 |
$f->{$column} = $self->filters->{$fname}; |
cleanup
|
339 |
} |
340 |
} |
|
cleanup
|
341 |
$filter = {%$filter, %$f}; |
packaging one directory
|
342 |
|
added experimental not_exist...
|
343 |
# Bind |
344 |
my $bind = $self->_bind($params, $query->columns, $filter); |
|
cleanup
|
345 |
|
346 |
# Execute |
|
added experimental not_exist...
|
347 |
my $sth = $query->sth; |
cleanup
|
348 |
my $affected; |
added experimental not_exist...
|
349 |
eval {$affected = $sth->execute(@$bind)}; |
renamed DBIx::Custom::TagPro...
|
350 |
$self->_croak($@, qq{. Following SQL is executed. "$query->{sql}"}) if $@; |
cleanup
|
351 |
|
352 |
# Return resultset if select statement is executed |
|
353 |
if ($sth->{NUM_OF_FIELDS}) { |
|
354 |
|
|
fix bug : filter can't over...
|
355 |
# Result in and end filter |
356 |
my $in_filter = {}; |
|
357 |
my $end_filter = {}; |
|
cleanup
|
358 |
foreach my $table (@$tables) { |
359 |
$in_filter = { |
|
360 |
%$in_filter, |
|
361 |
%{$self->{filter}{in}{$table} || {}} |
|
fix bug : filter can't over...
|
362 |
}; |
363 |
$end_filter = { |
|
364 |
%$end_filter, |
|
365 |
%{$self->{filter}{end}{$table} || {}} |
|
366 |
}; |
|
cleanup
|
367 |
} |
368 |
|
|
369 |
# Result |
|
370 |
my $result = $self->result_class->new( |
|
cleanup
|
371 |
sth => $sth, |
372 |
filters => $self->filters, |
|
373 |
filter_check => $self->filter_check, |
|
cleanup
|
374 |
default_filter => $self->{default_in_filter}, |
fix bug : filter can't over...
|
375 |
filter => $in_filter || {}, |
376 |
end_filter => $end_filter || {} |
|
cleanup
|
377 |
); |
378 | ||
379 |
return $result; |
|
380 |
} |
|
381 |
return $affected; |
|
382 |
} |
|
383 | ||
added auto_filter method
|
384 |
our %VALID_INSERT_ARGS = map { $_ => 1 } qw/table param append |
added experimental sugar met...
|
385 |
filter query/; |
cleanup
|
386 |
sub insert { |
387 |
my ($self, %args) = @_; |
|
388 | ||
389 |
# Check arguments |
|
390 |
foreach my $name (keys %args) { |
|
391 |
croak qq{"$name" is invalid argument} |
|
392 |
unless $VALID_INSERT_ARGS{$name}; |
|
packaging one directory
|
393 |
} |
394 |
|
|
cleanup
|
395 |
# Arguments |
added table not specified ex...
|
396 |
my $table = $args{table}; |
397 |
croak qq{"table" option must be specified} unless $table; |
|
cleanup
|
398 |
my $param = $args{param} || {}; |
399 |
my $append = $args{append} || ''; |
|
400 |
my $filter = $args{filter}; |
|
401 |
|
|
select() where can't receive...
|
402 |
# Columns |
403 |
my @columns; |
|
404 |
my $safety = $self->safety_column_name; |
|
405 |
foreach my $column (keys %$param) { |
|
406 |
croak qq{"$column" is not safety column name} |
|
407 |
unless $column =~ /$safety/; |
|
408 |
push @columns, $column; |
|
409 |
} |
|
cleanup
|
410 |
|
cleanup
|
411 |
# SQL stack |
412 |
my @sql; |
|
413 |
|
|
414 |
# Insert |
|
415 |
push @sql, "insert into $table {insert_param ". join(' ', @columns) . '}'; |
|
416 |
push @sql, $append if $append; |
|
417 |
|
|
select() where can't receive...
|
418 |
# SQL |
cleanup
|
419 |
my $sql = join (' ', @sql); |
packaging one directory
|
420 |
|
added experimental sugar met...
|
421 |
# Create query |
cleanup
|
422 |
my $query = $self->create_query($sql); |
added experimental sugar met...
|
423 |
return $query if $args{query}; |
424 |
|
|
packaging one directory
|
425 |
# Execute query |
added auto_filter method
|
426 |
my $ret_val = $self->execute( |
added experimental sugar met...
|
427 |
$query, |
added auto_filter method
|
428 |
param => $param, |
429 |
filter => $filter, |
|
renamed auto_filter to apply...
|
430 |
table => $table |
added auto_filter method
|
431 |
); |
packaging one directory
|
432 |
|
433 |
return $ret_val; |
|
434 |
} |
|
435 | ||
pod fix
|
436 |
sub each_column { |
added experimental iterate_a...
|
437 |
my ($self, $cb) = @_; |
438 |
|
|
439 |
# Iterate all tables |
|
440 |
my $sth_tables = $self->dbh->table_info; |
|
441 |
while (my $table_info = $sth_tables->fetchrow_hashref) { |
|
442 |
|
|
443 |
# Table |
|
444 |
my $table = $table_info->{TABLE_NAME}; |
|
445 |
|
|
446 |
# Iterate all columns |
|
447 |
my $sth_columns = $self->dbh->column_info(undef, undef, $table, '%'); |
|
448 |
while (my $column_info = $sth_columns->fetchrow_hashref) { |
|
449 |
my $column = $column_info->{COLUMN_NAME}; |
|
removed experimental txn_sco...
|
450 |
$self->$cb($table, $column, $column_info); |
added experimental iterate_a...
|
451 |
} |
452 |
} |
|
453 |
} |
|
454 | ||
added dbi_options attribute
|
455 |
sub new { |
456 |
my $self = shift->SUPER::new(@_); |
|
457 |
|
|
458 |
# Check attribute names |
|
459 |
my @attrs = keys %$self; |
|
460 |
foreach my $attr (@attrs) { |
|
461 |
croak qq{"$attr" is invalid attribute name} |
|
462 |
unless $self->can($attr); |
|
463 |
} |
|
cleanup
|
464 | |
465 |
$self->register_tag( |
|
466 |
'?' => \&DBIx::Custom::Tag::placeholder, |
|
467 |
'=' => \&DBIx::Custom::Tag::equal, |
|
468 |
'<>' => \&DBIx::Custom::Tag::not_equal, |
|
469 |
'>' => \&DBIx::Custom::Tag::greater_than, |
|
470 |
'<' => \&DBIx::Custom::Tag::lower_than, |
|
471 |
'>=' => \&DBIx::Custom::Tag::greater_than_equal, |
|
472 |
'<=' => \&DBIx::Custom::Tag::lower_than_equal, |
|
473 |
'like' => \&DBIx::Custom::Tag::like, |
|
474 |
'in' => \&DBIx::Custom::Tag::in, |
|
475 |
'insert_param' => \&DBIx::Custom::Tag::insert_param, |
|
476 |
'update_param' => \&DBIx::Custom::Tag::update_param |
|
477 |
); |
|
added dbi_options attribute
|
478 |
|
479 |
return $self; |
|
480 |
} |
|
481 | ||
added experimental not_exist...
|
482 |
sub not_exists { bless {}, 'DBIx::Custom::NotExists' } |
483 | ||
cleanup
|
484 |
sub register_filter { |
485 |
my $invocant = shift; |
|
486 |
|
|
487 |
# Register filter |
|
488 |
my $filters = ref $_[0] eq 'HASH' ? $_[0] : {@_}; |
|
489 |
$invocant->filters({%{$invocant->filters}, %$filters}); |
|
490 |
|
|
491 |
return $invocant; |
|
492 |
} |
|
packaging one directory
|
493 | |
renamed DBIx::Custom::TagPro...
|
494 |
sub register_tag { shift->query_builder->register_tag(@_) } |
added register_tag_processor
|
495 | |
refactoring select
|
496 |
our %VALID_SELECT_ARGS |
add experimental selection o...
|
497 |
= map { $_ => 1 } qw/table column where append relation filter query selection/; |
refactoring select
|
498 | |
packaging one directory
|
499 |
sub select { |
select, insert, update, upda...
|
500 |
my ($self, %args) = @_; |
packaging one directory
|
501 |
|
refactoring select
|
502 |
# Check arguments |
select, insert, update, upda...
|
503 |
foreach my $name (keys %args) { |
add tests
|
504 |
croak qq{"$name" is invalid argument} |
refactoring select
|
505 |
unless $VALID_SELECT_ARGS{$name}; |
506 |
} |
|
packaging one directory
|
507 |
|
refactoring select
|
508 |
# Arguments |
added table not specified ex...
|
509 |
my $table = $args{table}; |
510 |
my $tables = ref $table eq 'ARRAY' ? $table |
|
511 |
: defined $table ? [$table] |
|
512 |
: []; |
|
add experimental selection o...
|
513 |
my $columns = $args{column} || []; |
514 |
my $selection = $args{selection} || ''; |
|
515 |
my $where = $args{where} || {}; |
|
516 |
my $relation = $args{relation}; |
|
517 |
my $append = $args{append}; |
|
518 |
my $filter = $args{filter}; |
|
packaging one directory
|
519 |
|
cleanup
|
520 |
# SQL stack |
521 |
my @sql; |
|
522 |
|
|
523 |
push @sql, 'select'; |
|
packaging one directory
|
524 |
|
add experimental selection o...
|
525 |
if ($selection) { |
526 |
croak qq{Can't contain "where" clause in selection} |
|
527 |
if $selection =~ /\swhere\s/; |
|
528 |
push @sql, $selection; |
|
529 |
} |
|
530 |
else { |
|
531 |
# Column clause |
|
532 |
if (@$columns) { |
|
533 |
foreach my $column (@$columns) { |
|
534 |
push @sql, ($column, ','); |
|
535 |
} |
|
536 |
pop @sql if $sql[-1] eq ','; |
|
537 |
} |
|
538 |
else { push @sql, '*' } |
|
539 |
|
|
540 |
# Table |
|
541 |
croak qq{"table" option must be specified} unless @$tables; |
|
542 |
push @sql, 'from'; |
|
543 |
foreach my $table (@$tables) { |
|
544 |
push @sql, ($table, ','); |
|
packaging one directory
|
545 |
} |
cleanup
|
546 |
pop @sql if $sql[-1] eq ','; |
packaging one directory
|
547 |
} |
548 |
|
|
select() where can't receive...
|
549 |
# Where |
550 |
my $w; |
|
added experimental DBIx::Cus...
|
551 |
if (ref $where eq 'HASH') { |
select() where can't receive...
|
552 |
my $clause = ['and']; |
553 |
push @$clause, "{= $_}" for keys %$where; |
|
554 |
$w = $self->where; |
|
555 |
$w->clause($clause); |
|
556 |
$w->param($where); |
|
added experimental DBIx::Cus...
|
557 |
} |
558 |
elsif (ref $where eq 'DBIx::Custom::Where') { |
|
select() where can't receive...
|
559 |
$w = $where; |
560 |
$where = $w->param; |
|
packaging one directory
|
561 |
} |
562 |
|
|
select() where can't receive...
|
563 |
croak qq{"where" must be hash reference or DBIx::Custom::Where object} |
564 |
unless ref $w eq 'DBIx::Custom::Where'; |
|
565 |
|
|
566 |
# String where |
|
567 |
my $swhere = "$w"; |
|
cleanup
|
568 |
push @sql, $swhere; |
select() where can't receive...
|
569 |
|
added commit method
|
570 |
# Relation |
571 |
if ($relation) { |
|
cleanup
|
572 |
push @sql, $swhere eq '' ? 'where' : 'and'; |
573 |
foreach my $rcolumn (keys %$relation) { |
|
574 |
push @sql, ("$rcolumn = " . $relation->{$rcolumn}, 'and'); |
|
packaging one directory
|
575 |
} |
576 |
} |
|
cleanup
|
577 |
pop @sql if $sql[-1] eq 'and'; |
added commit method
|
578 |
|
cleanup
|
579 |
# Append statement |
580 |
push @sql, $append if $append; |
|
581 |
|
|
582 |
# SQL |
|
583 |
my $sql = join (' ', @sql); |
|
packaging one directory
|
584 |
|
added experimental sugar met...
|
585 |
# Create query |
cleanup
|
586 |
my $query = $self->create_query($sql); |
added experimental sugar met...
|
587 |
return $query if $args{query}; |
588 |
|
|
packaging one directory
|
589 |
# Execute query |
added auto_filter method
|
590 |
my $result = $self->execute( |
select() where can't receive...
|
591 |
$query, param => $where, filter => $filter, |
592 |
table => $tables); |
|
packaging one directory
|
593 |
|
594 |
return $result; |
|
595 |
} |
|
596 | ||
add feture. all model class ...
|
597 |
sub model { |
598 |
my ($self, $name, $model) = @_; |
|
removed experimental base_ta...
|
599 |
|
600 |
# Set |
|
add feture. all model class ...
|
601 |
if ($model) { |
add models() attribute
|
602 |
$self->models->{$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} |
|
add models() attribute
|
608 |
unless $self->models->{$name}; |
removed experimental base_ta...
|
609 |
|
610 |
# Get |
|
add models() attribute
|
611 |
return $self->models->{$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 | |
add models() attribute
|
1057 |
Filters |
1058 | ||
1059 |
=head2 C<(experimental) models> |
|
1060 | ||
1061 |
my $models = $dbi->models; |
|
1062 |
$dbi = $dbi->models(\%models); |
|
1063 | ||
1064 |
Models |
|
1065 | ||
cleanup
|
1066 |
=head2 C<password> |
1067 | ||
1068 |
my $password = $dbi->password; |
|
1069 |
$dbi = $dbi->password('lkj&le`@s'); |
|
1070 | ||
1071 |
Password. |
|
1072 |
C<connect()> method use this value to connect the database. |
|
update document
|
1073 | |
renamed update tag to update...
|
1074 |
=head2 C<query_builder> |
added commit method
|
1075 | |
renamed update tag to update...
|
1076 |
my $sql_class = $dbi->query_builder; |
1077 |
$dbi = $dbi->query_builder(DBIx::Custom::QueryBuilder->new); |
|
added commit method
|
1078 | |
renamed update tag to update...
|
1079 |
SQL builder. C<query_builder()> must be |
renamed build_query to creat...
|
1080 |
the instance of L<DBIx::Custom::QueryBuilder> subclass. |
1081 |
Default to L<DBIx::Custom::QueryBuilder> object. |
|
cleanup
|
1082 | |
cleanup
|
1083 |
=head2 C<result_class> |
cleanup
|
1084 | |
cleanup
|
1085 |
my $result_class = $dbi->result_class; |
1086 |
$dbi = $dbi->result_class('DBIx::Custom::Result'); |
|
cleanup
|
1087 | |
cleanup
|
1088 |
Result class for select statement. |
1089 |
Default to L<DBIx::Custom::Result>. |
|
cleanup
|
1090 | |
update pod
|
1091 |
=head2 C<(experimental) safety_column_name> |
1092 | ||
1093 |
my $safety_column_name = $self->safety_column_name; |
|
1094 |
$dbi = $self->safety_column_name($name); |
|
1095 | ||
1096 |
Safety column name regex. |
|
1097 |
Default is qr/^[\w\.]*$/ |
|
1098 | ||
cleanup
|
1099 |
=head2 C<user> |
cleanup
|
1100 | |
cleanup
|
1101 |
my $user = $dbi->user; |
1102 |
$dbi = $dbi->user('Ken'); |
|
cleanup
|
1103 | |
cleanup
|
1104 |
User name. |
1105 |
C<connect()> method use this value to connect the database. |
|
update pod
|
1106 | |
cleanup
|
1107 |
=head1 METHODS |
added commit method
|
1108 | |
cleanup
|
1109 |
L<DBIx::Custom> inherits all methods from L<Object::Simple> |
autoload DBI method
|
1110 |
and use all method of L<DBI> |
cleanup
|
1111 |
and implements the following new ones. |
added check_filter attribute
|
1112 | |
cleanup
|
1113 |
=head2 C<(experimental) apply_filter> |
added auto_filter method
|
1114 | |
renamed auto_filter to apply...
|
1115 |
$dbi->apply_filter( |
added auto_filter method
|
1116 |
$table, |
fix bug : filter can't over...
|
1117 |
$column1 => {in => $infilter1, out => $outfilter1, end => $endfilter1} |
1118 |
$column2 => {in => $infilter2, out => $outfilter2, end =. $endfilter2} |
|
renamed auto_filter to apply...
|
1119 |
..., |
added auto_filter method
|
1120 |
); |
1121 | ||
renamed auto_filter to apply...
|
1122 |
C<apply_filter> is automatically filter for columns of table. |
added auto_filter method
|
1123 |
This have effect C<insert>, C<update>, C<delete>. C<select> |
cleanup
|
1124 |
and L<DBIx::Custom::Result> object. but this has'nt C<execute> method. |
1125 | ||
cleanup
|
1126 |
If you want to have effect C<execute()> method, use C<table> |
cleanup
|
1127 |
arguments. |
added auto_filter method
|
1128 | |
cleanup
|
1129 |
$result = $dbi->execute( |
1130 |
"select * from table1 where {= key1} and {= key2};", |
|
1131 |
param => {key1 => 1, key2 => 2}, |
|
renamed auto_filter to apply...
|
1132 |
table => ['table1'] |
cleanup
|
1133 |
); |
fix bug : filter can't over...
|
1134 | |
1135 |
You can use three name as column name. |
|
1136 | ||
1137 |
1. column : author |
|
1138 |
2. table.column : book.author |
|
1139 |
3. table__column : book__author |
|
1140 | ||
removed DBIx::Custom commit ...
|
1141 |
=head2 C<connect> |
packaging one directory
|
1142 | |
cleanup
|
1143 |
my $dbi = DBIx::Custom->connect(data_source => "dbi:mysql:database=dbname", |
update document
|
1144 |
user => 'ken', password => '!LFKD%$&'); |
bind_filter argument is chan...
|
1145 | |
cleanup
|
1146 |
Create a new L<DBIx::Custom> object and connect to the database. |
renamed build_query to creat...
|
1147 |
L<DBIx::Custom> is a wrapper of L<DBI>. |
cleanup
|
1148 |
C<AutoCommit> and C<RaiseError> options are true, |
renamed build_query to creat...
|
1149 |
and C<PrintError> option is false by default. |
packaging one directory
|
1150 | |
cleanup
|
1151 |
=head2 C<create_query> |
1152 |
|
|
1153 |
my $query = $dbi->create_query( |
|
added insert, update, update...
|
1154 |
"select * from book where {= author} and {like title};" |
cleanup
|
1155 |
); |
update document
|
1156 | |
cleanup
|
1157 |
Create the instance of L<DBIx::Custom::Query> from the source of SQL. |
1158 |
If you want to get high performance, |
|
1159 |
use C<create_query()> method and execute it by C<execute()> method |
|
1160 |
instead of suger methods. |
|
bind_filter argument is chan...
|
1161 | |
cleanup
|
1162 |
$dbi->execute($query, {author => 'Ken', title => '%Perl%'}); |
version 0.0901
|
1163 | |
cleanup
|
1164 |
=head2 C<execute> |
packaging one directory
|
1165 | |
cleanup
|
1166 |
my $result = $dbi->execute($query, param => $params, filter => \%filter); |
1167 |
my $result = $dbi->execute($source, param => $params, filter => \%filter); |
|
update document
|
1168 | |
cleanup
|
1169 |
Execute query or the source of SQL. |
1170 |
Query is L<DBIx::Custom::Query> object. |
|
1171 |
Return value is L<DBIx::Custom::Result> if select statement is executed, |
|
1172 |
or the count of affected rows if insert, update, delete statement is executed. |
|
version 0.0901
|
1173 | |
removed DBIx::Custom commit ...
|
1174 |
=head2 C<delete> |
packaging one directory
|
1175 | |
cleanup
|
1176 |
$dbi->delete(table => $table, |
1177 |
where => \%where, |
|
1178 |
append => $append, |
|
added experimental sugar met...
|
1179 |
filter => \%filter, |
1180 |
query => 1); |
|
bind_filter argument is chan...
|
1181 | |
renamed build_query to creat...
|
1182 |
Execute delete statement. |
1183 |
C<delete> method have C<table>, C<where>, C<append>, and C<filter> arguments. |
|
1184 |
C<table> is a table name. |
|
1185 |
C<where> is where clause. this must be hash reference. |
|
1186 |
C<append> is a string added at the end of the SQL statement. |
|
1187 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1188 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1189 |
default to 0. This is experimental. |
|
cleanup
|
1190 |
Return value of C<delete()> is the count of affected rows. |
renamed build_query to creat...
|
1191 | |
removed DBIx::Custom commit ...
|
1192 |
=head2 C<delete_all> |
packaging one directory
|
1193 | |
cleanup
|
1194 |
$dbi->delete_all(table => $table); |
packaging one directory
|
1195 | |
renamed build_query to creat...
|
1196 |
Execute delete statement to delete all rows. |
1197 |
Arguments is same as C<delete> method, |
|
1198 |
except that C<delete_all> don't have C<where> argument. |
|
cleanup
|
1199 |
Return value of C<delete_all()> is the count of affected rows. |
bind_filter argument is chan...
|
1200 | |
cleanup
|
1201 |
=head2 C<insert> |
1202 | ||
1203 |
$dbi->insert(table => $table, |
|
1204 |
param => \%param, |
|
1205 |
append => $append, |
|
added experimental sugar met...
|
1206 |
filter => \%filter, |
1207 |
query => 1); |
|
cleanup
|
1208 | |
1209 |
Execute insert statement. |
|
1210 |
C<insert> method have C<table>, C<param>, C<append> |
|
1211 |
and C<filter> arguments. |
|
1212 |
C<table> is a table name. |
|
1213 |
C<param> is the pairs of column name value. this must be hash reference. |
|
1214 |
C<append> is a string added at the end of the SQL statement. |
|
1215 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1216 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1217 |
default to 0. This is experimental. |
|
cleanup
|
1218 |
This is overwrites C<default_bind_filter>. |
1219 |
Return value of C<insert()> is the count of affected rows. |
|
1220 | ||
pod fix
|
1221 |
=head2 C<(experimental) each_column> |
added experimental iterate_a...
|
1222 | |
pod fix
|
1223 |
$dbi->each_column( |
added experimental iterate_a...
|
1224 |
sub { |
added experimental not_exist...
|
1225 |
my ($self, $table, $column, $info) = @_; |
added experimental iterate_a...
|
1226 |
|
pod fix
|
1227 |
my $type = $info->{TYPE_NAME}; |
1228 |
|
|
1229 |
if ($type eq 'DATE') { |
|
1230 |
# ... |
|
1231 |
} |
|
added experimental iterate_a...
|
1232 |
} |
1233 |
); |
|
pod fix
|
1234 |
Get column informations from database. |
1235 |
Argument is callback. |
|
1236 |
You can do anything in callback. |
|
added experimental not_exist...
|
1237 |
Callback receive four arguments, dbi object, table name, |
1238 |
column name and columninformation. |
|
1239 | ||
add feture. all model class ...
|
1240 |
=head2 C<(experimental) include_model> |
removed experimental base_ta...
|
1241 | |
add feture. all model class ...
|
1242 |
$dbi->include_model( |
1243 |
'MyModel' => [ |
|
removed experimental base_ta...
|
1244 |
'book', 'person', 'company' |
1245 |
] |
|
1246 |
); |
|
1247 | ||
add feture. all model class ...
|
1248 |
Include models. First argument is name space. |
removed experimental base_ta...
|
1249 |
Second argument is array reference of class base names. |
1250 | ||
add feture. all model class ...
|
1251 |
If you don't specify second argument, All models under name space is |
1252 |
included. |
|
1253 | ||
1254 |
$dbi->include_model('MyModel'); |
|
1255 | ||
1256 |
Note that in this case name spece module is needed. |
|
1257 | ||
1258 |
# MyModel.pm |
|
1259 |
package MyModel; |
|
1260 |
|
|
1261 |
use base 'DBIx::Custom::Model'; |
|
1262 | ||
1263 |
The following model is instantiated and included. |
|
removed experimental base_ta...
|
1264 | |
add feture. all model class ...
|
1265 |
MyModel::book |
1266 |
MyModel::person |
|
1267 |
MyModel::company |
|
removed experimental base_ta...
|
1268 | |
add feture. all model class ...
|
1269 |
You can get these instance by C<model()>. |
removed experimental base_ta...
|
1270 | |
add feture. all model class ...
|
1271 |
my $book_model = $dbi->model('book'); |
removed experimental base_ta...
|
1272 | |
add feture. all model class ...
|
1273 |
If you want to other name as model class, |
removed experimental base_ta...
|
1274 |
you can do like this. |
1275 | ||
add feture. all model class ...
|
1276 |
$dbi->include_model( |
1277 |
'MyModel' => [ |
|
removed experimental base_ta...
|
1278 |
{'book' => 'Book'}, |
1279 |
{'person' => 'Person'} |
|
1280 |
] |
|
1281 |
); |
|
1282 | ||
added experimental not_exist...
|
1283 |
=head2 C<(experimental) method> |
1284 | ||
1285 |
$dbi->method( |
|
1286 |
update_or_insert => sub { |
|
1287 |
my $self = shift; |
|
1288 |
# do something |
|
1289 |
}, |
|
1290 |
find_or_create => sub { |
|
1291 |
my $self = shift; |
|
1292 |
# do something |
|
1293 |
} |
|
1294 |
); |
|
1295 | ||
1296 |
Register method. These method is called from L<DBIx::Custom> object directory. |
|
1297 | ||
1298 |
$dbi->update_or_insert; |
|
1299 |
$dbi->find_or_create; |
|
1300 | ||
1301 |
=head2 C<new> |
|
1302 | ||
1303 |
my $dbi = DBIx::Custom->connect(data_source => "dbi:mysql:database=dbname", |
|
1304 |
user => 'ken', password => '!LFKD%$&'); |
|
1305 | ||
1306 |
Create a new L<DBIx::Custom> object. |
|
1307 | ||
1308 |
=head2 C<(experimental) not_exists> |
|
1309 | ||
1310 |
my $not_exists = $dbi->not_exists; |
|
1311 | ||
1312 |
Get DBIx::Custom::NotExists object. |
|
experimental extended select...
|
1313 | |
cleanup
|
1314 |
=head2 C<register_filter> |
1315 | ||
1316 |
$dbi->register_filter(%filters); |
|
1317 |
$dbi->register_filter(\%filters); |
|
1318 |
|
|
1319 |
Register filter. Registered filters is available in the following attributes |
|
1320 |
or arguments. |
|
1321 | ||
1322 |
=over 4 |
|
1323 | ||
1324 |
=item * |
|
1325 | ||
1326 |
C<filter> argument of C<insert()>, C<update()>, |
|
1327 |
C<update_all()>, C<delete()>, C<delete_all()>, C<select()> |
|
1328 |
methods |
|
1329 | ||
1330 |
=item * |
|
1331 | ||
1332 |
C<execute()> method |
|
1333 | ||
1334 |
=item * |
|
1335 | ||
1336 |
C<default_filter> and C<filter> of C<DBIx::Custom::Query> |
|
1337 | ||
1338 |
=item * |
|
1339 | ||
1340 |
C<default_filter> and C<filter> of C<DBIx::Custom::Result> |
|
1341 | ||
1342 |
=back |
|
1343 | ||
renamed DBIx::Custom::TagPro...
|
1344 |
=head2 C<register_tag> |
added register_tag_processor
|
1345 | |
renamed DBIx::Custom::TagPro...
|
1346 |
$dbi->register_tag( |
added register_tag_processor
|
1347 |
limit => sub { |
1348 |
...; |
|
1349 |
} |
|
1350 |
); |
|
1351 | ||
cleanup
|
1352 |
Register tag. |
added register_tag_processor
|
1353 | |
added auto_filter method
|
1354 |
=head2 C<rollback> |
cleanup
|
1355 | |
1356 |
$dbi->rollback; |
|
1357 | ||
1358 |
Rollback transaction. |
|
1359 |
This is same as L<DBI>'s C<rollback>. |
|
1360 | ||
removed DBIx::Custom commit ...
|
1361 |
=head2 C<select> |
packaging one directory
|
1362 |
|
cleanup
|
1363 |
my $result = $dbi->select(table => $table, |
1364 |
column => [@column], |
|
1365 |
where => \%where, |
|
1366 |
append => $append, |
|
1367 |
relation => \%relation, |
|
added experimental sugar met...
|
1368 |
filter => \%filter, |
add experimental selection o...
|
1369 |
query => 1, |
1370 |
selection => $selection); |
|
update document
|
1371 | |
renamed build_query to creat...
|
1372 |
Execute select statement. |
cleanup
|
1373 |
C<select> method have C<table>, C<column>, C<where>, C<append>, |
renamed build_query to creat...
|
1374 |
C<relation> and C<filter> arguments. |
1375 |
C<table> is a table name. |
|
cleanup
|
1376 |
C<where> is where clause. this is normally hash reference. |
renamed build_query to creat...
|
1377 |
C<append> is a string added at the end of the SQL statement. |
1378 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1379 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1380 |
default to 0. This is experimental. |
|
add experimental selection o...
|
1381 |
C<selection> is string of column name and tables. This is experimental |
1382 | ||
1383 |
selection => 'name, location.name as location_name ' . |
|
1384 |
'from company inner join location' |
|
update document
|
1385 | |
cleanup
|
1386 |
First element is a string. it contains tags, |
1387 |
such as "{= title} or {like author}". |
|
1388 |
Second element is paramters. |
|
1389 | ||
cleanup
|
1390 |
=head2 C<update> |
removed reconnect method
|
1391 | |
cleanup
|
1392 |
$dbi->update(table => $table, |
1393 |
param => \%params, |
|
1394 |
where => \%where, |
|
1395 |
append => $append, |
|
added experimental sugar met...
|
1396 |
filter => \%filter, |
1397 |
query => 1) |
|
removed reconnect method
|
1398 | |
cleanup
|
1399 |
Execute update statement. |
1400 |
C<update> method have C<table>, C<param>, C<where>, C<append> |
|
1401 |
and C<filter> arguments. |
|
1402 |
C<table> is a table name. |
|
1403 |
C<param> is column-value pairs. this must be hash reference. |
|
1404 |
C<where> is where clause. this must be hash reference. |
|
1405 |
C<append> is a string added at the end of the SQL statement. |
|
1406 |
C<filter> is filters when parameter binding is executed. |
|
added experimental sugar met...
|
1407 |
C<query> is if you don't execute sql and get L<DBIx::Custom::Query> object as return value. |
1408 |
default to 0. This is experimental. |
|
cleanup
|
1409 |
This is overwrites C<default_bind_filter>. |
1410 |
Return value of C<update()> is the count of affected rows. |
|
removed reconnect method
|
1411 | |
add feture. all model class ...
|
1412 |
=head2 C<(experimental) model> |
remove DBIx::Custom::Model
|
1413 | |
add feture. all model class ...
|
1414 |
$dbi->model('book')->method( |
remove DBIx::Custom::Model
|
1415 |
insert => sub { ... }, |
1416 |
update => sub { ... } |
|
1417 |
); |
|
1418 |
|
|
add feture. all model class ...
|
1419 |
my $model = $dbi->model('book'); |
remove DBIx::Custom::Model
|
1420 | |
add feture. all model class ...
|
1421 |
Set and get a L<DBIx::Custom::Model> object, |
remove DBIx::Custom::Model
|
1422 | |
cleanup
|
1423 |
=head2 C<update_all> |
renamed build_query to creat...
|
1424 | |
cleanup
|
1425 |
$dbi->update_all(table => $table, |
1426 |
param => \%params, |
|
1427 |
filter => \%filter, |
|
1428 |
append => $append); |
|
renamed build_query to creat...
|
1429 | |
cleanup
|
1430 |
Execute update statement to update all rows. |
1431 |
Arguments is same as C<update> method, |
|
1432 |
except that C<update_all> don't have C<where> argument. |
|
1433 |
Return value of C<update_all()> is the count of affected rows. |
|
removed DBIx::Custom commit ...
|
1434 | |
fix tests
|
1435 |
=head2 C<(experimental) where> |
1436 | ||
1437 |
my $where = $dbi->where; |
|
1438 | ||
1439 |
Create a new L<DBIx::Custom::Where> object. |
|
1440 | ||
cleanup
|
1441 |
=head2 C<cache_method> |
cleanup
|
1442 | |
1443 |
$dbi = $dbi->cache_method(\&cache_method); |
|
1444 |
$cache_method = $dbi->cache_method |
|
1445 | ||
1446 |
Method to set and get caches. |
|
1447 | ||
cleanup
|
1448 |
=head1 Tags |
1449 | ||
1450 |
The following tags is available. |
|
1451 | ||
add experimental selection o...
|
1452 |
=head2 C<(experimental) table> |
add table tag
|
1453 | |
1454 |
Table tag |
|
1455 | ||
1456 |
{table TABLE} -> TABLE |
|
1457 | ||
1458 |
This is used to teach what is applied table to C<execute()>. |
|
1459 | ||
cleanup
|
1460 |
=head2 C<?> |
1461 | ||
1462 |
Placeholder tag. |
|
1463 | ||
1464 |
{? NAME} -> ? |
|
1465 | ||
1466 |
=head2 C<=> |
|
1467 | ||
1468 |
Equal tag. |
|
1469 | ||
1470 |
{= NAME} -> NAME = ? |
|
1471 | ||
1472 |
=head2 C<E<lt>E<gt>> |
|
1473 | ||
1474 |
Not equal tag. |
|
1475 | ||
1476 |
{<> NAME} -> NAME <> ? |
|
1477 | ||
1478 |
=head2 C<E<lt>> |
|
1479 | ||
1480 |
Lower than tag |
|
1481 | ||
1482 |
{< NAME} -> NAME < ? |
|
1483 | ||
1484 |
=head2 C<E<gt>> |
|
1485 | ||
1486 |
Greater than tag |
|
1487 | ||
1488 |
{> NAME} -> NAME > ? |
|
1489 | ||
1490 |
=head2 C<E<gt>=> |
|
1491 | ||
1492 |
Greater than or equal tag |
|
1493 | ||
1494 |
{>= NAME} -> NAME >= ? |
|
1495 | ||
1496 |
=head2 C<E<lt>=> |
|
1497 | ||
1498 |
Lower than or equal tag |
|
1499 | ||
1500 |
{<= NAME} -> NAME <= ? |
|
1501 | ||
1502 |
=head2 C<like> |
|
1503 | ||
1504 |
Like tag |
|
1505 | ||
1506 |
{like NAME} -> NAME like ? |
|
1507 | ||
1508 |
=head2 C<in> |
|
1509 | ||
1510 |
In tag. |
|
1511 | ||
1512 |
{in NAME COUNT} -> NAME in [?, ?, ..] |
|
1513 | ||
1514 |
=head2 C<insert_param> |
|
1515 | ||
1516 |
Insert parameter tag. |
|
1517 | ||
1518 |
{insert_param NAME1 NAME2} -> (NAME1, NAME2) values (?, ?) |
|
1519 | ||
1520 |
=head2 C<update_param> |
|
1521 | ||
1522 |
Updata parameter tag. |
|
1523 | ||
1524 |
{update_param NAME1 NAME2} -> set NAME1 = ?, NAME2 = ? |
|
1525 | ||
DBIx::Custom is now stable
|
1526 |
=head1 STABILITY |
1527 | ||
cleanup
|
1528 |
L<DBIx::Custom> is stable. APIs keep backword compatible |
1529 |
except experimental one in the feature. |
|
DBIx::Custom is now stable
|
1530 | |
removed DESTROY method(not b...
|
1531 |
=head1 BUGS |
1532 | ||
renamed build_query to creat...
|
1533 |
Please tell me bugs if found. |
removed DESTROY method(not b...
|
1534 | |
1535 |
C<< <kimoto.yuki at gmail.com> >> |
|
1536 | ||
1537 |
L<http://github.com/yuki-kimoto/DBIx-Custom> |
|
1538 | ||
removed reconnect method
|
1539 |
=head1 AUTHOR |
1540 | ||
1541 |
Yuki Kimoto, C<< <kimoto.yuki at gmail.com> >> |
|
version 0.0901
|
1542 | |
packaging one directory
|
1543 |
=head1 COPYRIGHT & LICENSE |
1544 | ||
cleanup
|
1545 |
Copyright 2009-2011 Yuki Kimoto, all rights reserved. |
packaging one directory
|
1546 | |
1547 |
This program is free software; you can redistribute it and/or modify it |
|
1548 |
under the same terms as Perl itself. |
|
1549 | ||
1550 |
=cut |
|
added cache_method attribute
|
1551 | |
1552 |