packaging one directory
|
1 |
package DBIx::Custom::SQLite; |
2 | ||
3 |
use strict; |
|
update document
|
4 |
use warnings; |
rename DBIx::Custom::SQLite ...
|
5 | |
update document
|
6 |
use base 'DBIx::Custom'; |
7 | ||
8 |
__PACKAGE__->attr('database'); |
|
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 tests
|
17 |
my $database = $self->database; |
18 |
if (!$self->data_source && $database) { |
|
19 |
$self->data_source("dbi:SQLite:dbname=$database") |
|
packaging one directory
|
20 |
} |
21 |
|
|
22 |
return $self->SUPER::connect; |
|
23 |
} |
|
24 | ||
25 |
sub connect_memory { |
|
removed DESTROY method(not b...
|
26 |
my $self = shift->new(@_); |
packaging one directory
|
27 |
|
cleanup
|
28 |
# Data source |
packaging one directory
|
29 |
$self->data_source('dbi:SQLite:dbname=:memory:'); |
30 |
|
|
cleanup
|
31 |
# Connect to database |
packaging one directory
|
32 |
$self->connect; |
33 |
|
|
34 |
return $self; |
|
35 |
} |
|
36 | ||
removed register_format()
|
37 |
1; |
38 | ||
packaging one directory
|
39 |
=head1 NAME |
40 | ||
cleanup
|
41 |
DBIx::Custom::SQLite - SQLite implementation |
packaging one directory
|
42 | |
rename DBIx::Custom::SQLite ...
|
43 |
=head1 SYNOPSYS |
packaging one directory
|
44 | |
45 |
use DBIx::Custom::SQLite; |
|
46 |
|
|
cleanup
|
47 |
# Connect to the database |
removed DESTROY method(not b...
|
48 |
my $dbi = DBIx::Custom::SQLite->connect(database => 'dbname'); |
packaging one directory
|
49 |
|
cleanup
|
50 |
# Connect to the memory database |
update document
|
51 |
my $dbi = DBIx::Custom::SQLite->connect_memory; |
52 |
|
|
removed DESTROY method(not b...
|
53 |
# Get last insert row id |
update document
|
54 |
my $id = $dbi->last_insert_rowid; |
packaging one directory
|
55 |
|
update document
|
56 |
=head1 ATTRIBUTES |
57 | ||
cleanup
|
58 |
L<DBIx::Custom::SQLite> inherits all attributes from L<DBIx::Custom> |
59 |
and implements the following new ones. |
|
update document
|
60 | |
removed DBIx::Custom commit ...
|
61 |
=head2 C<database> |
update document
|
62 | |
cleanup
|
63 |
my $database = $dbi->database; |
cleanup
|
64 |
$dbi = $dbi->database('dbname'); |
packaging one directory
|
65 | |
removed DESTROY method(not b...
|
66 |
Database name. |
cleanup
|
67 |
C<connect()> method use this value to connect the database |
68 |
if C<data_source> is not specified. |
|
removed DESTROY method(not b...
|
69 | |
rename DBIx::Custom::SQLite ...
|
70 |
=head1 METHODS |
packaging one directory
|
71 | |
cleanup
|
72 |
L<DBIx::Custom::SQLite> inherits all methods from L<DBIx::Custom> |
73 |
and implements the following new ones. |
|
packaging one directory
|
74 | |
cleanup
|
75 |
=head2 C<connect> |
removed DESTROY method(not b...
|
76 |
|
cleanup
|
77 |
my $dbi = DBIx::Custom::SQLite->connect(database => 'dbname'); |
packaging one directory
|
78 | |
cleanup
|
79 |
Create a new L<DBIx::Custom::SQLite> object and connect to the database. |
cleanup
|
80 |
This method overrides C<DBIx::Custom::connect()> method. |
cleanup
|
81 |
You can specify all attributes of L<DBIx::Custom> |
82 |
and L<DBIx::Custom::SQLite>, such as C<database>. |
|
packaging one directory
|
83 | |
removed DBIx::Custom commit ...
|
84 |
=head2 C<connect_memory> |
packaging one directory
|
85 | |
cleanup
|
86 |
my $dbi = DBIx::Custom::SQLite->connect_memory; |
packaging one directory
|
87 | |
cleanup
|
88 |
Create a new L<DBIx::Custom::SQLite> object and connect to the memory database. |
add Oracle, DB2, Pg,
|
89 | |
rename DBIx::Custom::SQLite ...
|
90 |
=cut |