packaging one directory
|
1 |
package DBIx::Custom::MySQL; |
2 | ||
3 |
use strict; |
|
removed DESTROY method(not b...
|
4 |
use warnings; |
update document
|
5 | |
update document
|
6 |
use base 'DBIx::Custom'; |
7 | ||
8 |
__PACKAGE__->attr([qw/database host port/]); |
|
9 | ||
packaging one directory
|
10 |
sub connect { |
update document
|
11 |
my $proto = shift; |
12 |
|
|
cleanup
|
13 |
# Create a new object |
update document
|
14 |
my $self = ref $proto ? $proto : $proto->new(@_); |
packaging one directory
|
15 |
|
cleanup
|
16 |
# Data source |
add port and host method
|
17 |
if (!$self->data_source) { |
18 |
my $database = $self->database; |
|
19 |
my $host = $self->host; |
|
20 |
my $port = $self->port; |
|
21 |
my $data_source = "dbi:mysql:"; |
|
22 |
$data_source .= "database=$database;" if $database; |
|
23 |
$data_source .= "host=$host;" if $host; |
|
24 |
$data_source .= "port=$port;" if $port; |
|
25 |
$self->data_source($data_source); |
|
packaging one directory
|
26 |
} |
27 |
|
|
28 |
return $self->SUPER::connect; |
|
29 |
} |
|
30 | ||
removed register_format()
|
31 |
1; |
32 | ||
packaging one directory
|
33 |
=head1 NAME |
34 | ||
cleanup
|
35 |
DBIx::Custom::MySQL - MySQL implementation |
packaging one directory
|
36 | |
deprecated DBIx::Custom::MyS...
|
37 |
=head1 CAUTION |
38 | ||
39 |
B<This module is deprecated now> because This module is not very useful |
|
40 |
I expected. Please use DBIx::Custom instead.> |
|
41 | ||
update document
|
42 |
=head1 SYNOPSYS |
packaging one directory
|
43 | |
cleanup
|
44 |
# Connect to the database |
45 |
my $dbi = DBIx::Custom::MySQL->connect( |
|
46 |
user => 'taro', |
|
47 |
password => 'kliej&@K', |
|
48 |
database => 'dbname' |
|
49 |
); |
|
update document
|
50 |
|
removed DESTROY method(not b...
|
51 |
# Get last insert id |
cleanup
|
52 |
my $last_insert_id = $dbi->last_insert_id; |
packaging one directory
|
53 | |
update document
|
54 |
=head1 ATTRIBUTES |
packaging one directory
|
55 | |
cleanup
|
56 |
L<DBIx::Custom::MySQL> inherits all attributes from L<DBIx::Custom> |
57 |
and implements the following new ones. |
|
packaging one directory
|
58 | |
removed DBIx::Custom commit ...
|
59 |
=head2 C<database> |
packaging one directory
|
60 | |
cleanup
|
61 |
my $database = $dbi->database; |
cleanup
|
62 |
$dbi = $dbi->database('dbname'); |
update document
|
63 | |
removed DESTROY method(not b...
|
64 |
Database name. |
cleanup
|
65 |
C<connect()> method use this value to connect the database |
66 |
if C<data_source> is not specified. |
|
packaging one directory
|
67 | |
removed DESTROY method(not b...
|
68 |
=head2 C<host> |
add Oracle, DB2, Pg,
|
69 | |
cleanup
|
70 |
my $host = $dbi->host; |
cleanup
|
71 |
$dbi = $dbi->host('somehost'); |
update document
|
72 | |
cleanup
|
73 |
Host name or IP address. |
74 |
C<connect()> method use this value to connect the database |
|
75 |
if C<data_source> is not specified. |
|
update document
|
76 | |
removed DBIx::Custom commit ...
|
77 |
=head2 C<port> |
update document
|
78 | |
cleanup
|
79 |
my $port = $dbi->port; |
80 |
$dbi = $dbi->port(1198); |
|
update document
|
81 | |
cleanup
|
82 |
Port number. |
83 |
C<connect()> method use this value to connect the database |
|
84 |
if C<data_source> is not specified. |
|
removed DESTROY method(not b...
|
85 | |
update document
|
86 |
=head1 METHODS |
87 | ||
cleanup
|
88 |
L<DBIx::Custom::MySQL> inherits all methods from L<DBIx::Custom> |
89 |
and implements the following new ones. |
|
update document
|
90 | |
cleanup
|
91 |
=head2 C<connect> |
update document
|
92 | |
cleanup
|
93 |
my $dbi = DBIx::Custom::MySQL->connect( |
94 |
user => 'taro', |
|
95 |
password => 'kliej&@K', |
|
96 |
database => 'dbname', |
|
97 |
host => 'somehost', |
|
98 |
port => 2000 |
|
removed DESTROY method(not b...
|
99 |
); |
update document
|
100 | |
cleanup
|
101 |
Create a new L<DBIx::Custom::MySQL> object and connect to the database. |
cleanup
|
102 |
This method overrides C<DBIx::Custom::connect()> method. |
cleanup
|
103 |
You can specify all attributes of L<DBIx::Custom> |
104 |
and L<DBIx::Custom::MySQL>, such as C<database>, C<host>, C<port>. |
|
update document
|
105 | |
update document
|
106 |
=cut |