packaging one directory
|
1 |
package DBIx::Custom::Query; |
2 |
use Object::Simple; |
|
3 | ||
update document
|
4 |
use strict; |
5 |
use warnings; |
|
6 | ||
packaging one directory
|
7 |
sub sql : Attr {} |
8 |
sub key_infos : Attr {} |
|
9 |
sub bind_filter : Attr {} |
|
10 |
sub fetch_filter : Attr {} |
|
11 |
sub sth : Attr {} |
|
12 | ||
13 |
sub no_bind_filters : Attr { type => 'array', trigger => sub { |
|
14 |
my $self = shift; |
|
15 |
my $no_bind_filters = $self->no_bind_filters || []; |
|
16 |
my %no_bind_filters_map = map {$_ => 1} @{$no_bind_filters}; |
|
17 |
$self->_no_bind_filters_map(\%no_bind_filters_map); |
|
18 |
}} |
|
19 |
sub _no_bind_filters_map : Attr {default => sub { {} }} |
|
20 | ||
21 |
sub no_fetch_filters : Attr { type => 'array', default => sub { [] } } |
|
22 | ||
23 |
Object::Simple->build_class; |
|
24 | ||
25 |
=head1 NAME |
|
26 | ||
update document
|
27 |
DBIx::Custom::Query - DBIx::Custom query |
packaging one directory
|
28 | |
29 |
=head1 SYNOPSIS |
|
30 | ||
31 |
# Create query |
|
32 |
my $dbi = DBIx::Custom->new; |
|
33 |
my $query = $dbi->create_query($template); |
|
34 |
|
|
35 |
# Set query attributes |
|
36 |
$query->bind_filter($dbi->filters->{default_bind_filter}); |
|
37 |
$query->no_bind_filters('title', 'author'); |
|
38 |
|
|
39 |
$query->fetch_filter($dbi->filters->{default_fetch_filter}); |
|
40 |
$query->no_fetch_filters('title', 'author'); |
|
41 |
|
|
42 |
# Execute query |
|
43 |
$dbi->execute($query, $params); |
|
44 | ||
45 |
=head1 OBJECT ACCESSORS |
|
46 | ||
47 |
=head2 sth |
|
48 | ||
49 |
# Set and get statement handle |
|
50 |
$self = $query->sth($sql); |
|
51 |
$sth = $query->sth; |
|
52 | ||
53 |
=head2 sql |
|
54 | ||
55 |
# Set and get SQL |
|
56 |
$self = $query->sql($sql); |
|
57 |
$sql = $query->sql; |
|
58 | ||
59 |
=head2 bind_filter |
|
60 | ||
61 |
# Set and get bind filter |
|
62 |
$self = $query->bind_filter($bind_filter); |
|
63 |
$bind_filter = $query->bind_filter; |
|
64 | ||
65 |
=head2 no_bind_filters |
|
66 | ||
67 |
# Set and get keys of no filtering |
|
68 |
$self = $query->no_bind_filters($no_filters); |
|
69 |
$no_bind_filters = $query->no_bind_filters; |
|
70 | ||
71 |
=head2 fetch_filter |
|
72 | ||
73 |
# Set and get fetch filter |
|
74 |
$self = $query->fetch_filter($fetch_filter); |
|
75 |
$fetch_filter = $query->fetch_filter; |
|
76 | ||
77 |
=head2 no_fetch_filters |
|
78 | ||
79 |
# Set and get keys of no filtering |
|
80 |
$self = $query->no_fetch_filters($no_filters); |
|
81 |
$no_fetch_filters = $query->no_fetch_filters; |
|
82 | ||
83 |
=head2 key_infos |
|
84 | ||
85 |
# Set and get key informations |
|
86 |
$self = $query->key_infos($key_infos); |
|
87 |
$key_infos = $query->key_infos; |
|
88 | ||
89 |
=head1 AUTHOR |
|
90 | ||
91 |
Yuki Kimoto, C<< <kimoto.yuki at gmail.com> >> |
|
92 | ||
93 |
Github L<http://github.com/yuki-kimoto> |
|
94 | ||
95 |
=head1 COPYRIGHT & LICENSE |
|
96 | ||
97 |
Copyright 2009 Yuki Kimoto, all rights reserved. |
|
98 | ||
99 |
This program is free software; you can redistribute it and/or modify it |
|
100 |
under the same terms as Perl itself. |