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