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