packaging one directory
|
1 |
package DBIx::Custom::Basic; |
2 | ||
3 |
use warnings; |
|
4 |
use strict; |
|
update document
|
5 | |
6 |
use base 'DBIx::Custom'; |
|
Simplify key search
|
7 | |
update document
|
8 |
use Encode qw/decode encode/; |
packaging one directory
|
9 | |
many many changes
|
10 |
__PACKAGE__->resist_filter( |
11 |
none => sub { $_[0] }, |
|
Simplify key search
|
12 |
encode_utf8 => sub { encode('UTF-8', $_[0]) }, |
13 |
decode_utf8 => sub { decode('UTF-8', $_[0]) } |
|
packaging one directory
|
14 |
); |
15 | ||
many many changes
|
16 |
__PACKAGE__->resist_format( |
packaging one directory
|
17 |
'SQL99_date' => '%Y-%m-%d', |
18 |
'SQL99_datetime' => '%Y-%m-%d %H:%M:%S', |
|
19 |
'SQL99_time' => '%H:%M:%S', |
|
20 |
'ISO-8601_date' => '%Y-%m-%d', |
|
21 |
'ISO-8601_datetime' => '%Y-%m-%dT%H:%M:%S', |
|
22 |
'ISO-8601_time' => '%H:%M:%S', |
|
23 |
); |
|
24 | ||
25 |
1; |
|
26 | ||
27 |
=head1 NAME |
|
28 | ||
29 |
DBIx::Custom::Basic - DBIx::Custom basic implementation |
|
30 | ||
update document
|
31 |
=head1 SYNOPSYS |
packaging one directory
|
32 | |
update document
|
33 |
# New |
34 |
my $dbi = DBIx::Custom::Basic->new( |
|
35 |
data_source => "dbi:mysql:database=books", |
|
36 |
user => 'ken', |
|
37 |
password => '!LFKD%$&' |
|
38 |
); |
|
packaging one directory
|
39 | |
update document
|
40 |
=head1 METHODS |
packaging one directory
|
41 | |
update document
|
42 |
This class is L<DBIx::Custom> subclass. |
43 |
You can use all methods of L<DBIx::Custom> |
|
update document
|
44 | |
update document
|
45 |
=head1 FILTERS |
packaging one directory
|
46 | |
47 |
=head2 encode_utf8 |
|
48 | ||
version 0.0901
|
49 |
Encode internal string to UTF-8 byte stream |
50 |
If need, utf8::upgrade is also done. |
|
51 | ||
packaging one directory
|
52 |
$dbi->filters->{encode_utf8}->($value); |
53 |
|
|
54 |
This filter is generally used as bind filter |
|
55 | ||
56 |
$dbi->bind_filter($dbi->filters->{encode_utf8}); |
|
57 | ||
58 |
=head2 decode_utf8 |
|
59 | ||
version 0.0901
|
60 |
Decode UTF-8 byte stream to internal string |
packaging one directory
|
61 |
$dbi->filters->{decode_utf8}->($value); |
62 |
|
|
63 |
This filter is generally used as fetch filter |
|
64 | ||
65 |
$dbi->fetch_filter($dbi->filters->{decode_utf8}); |
|
66 | ||
Simplify key search
|
67 |
=head1 FORMATS |
packaging one directory
|
68 |
|
69 |
strptime formats is available |
|
70 |
|
|
71 |
# format name format |
|
72 |
'SQL99_date' '%Y-%m-%d', |
|
73 |
'SQL99_datetime' '%Y-%m-%d %H:%M:%S', |
|
74 |
'SQL99_time' '%H:%M:%S', |
|
75 |
'ISO-8601_date' '%Y-%m-%d', |
|
76 |
'ISO-8601_datetime' '%Y-%m-%dT%H:%M:%S', |
|
77 |
'ISO-8601_time' '%H:%M:%S', |
|
78 | ||
79 |
You get format as the following |
|
80 | ||
81 |
my $format = $dbi->formats->{$format_name}; |
|
82 | ||
83 |
=cut |