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