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 |
|
|
13 |
# Create |
|
14 |
my $self = ref $proto ? $proto : $proto->new(@_); |
|
packaging one directory
|
15 |
|
rename DBIx::Custom::SQLite ...
|
16 |
# Create 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 |
|
27 |
# Data source for memory database |
|
28 |
$self->data_source('dbi:SQLite:dbname=:memory:'); |
|
29 |
|
|
30 |
# Connect |
|
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 |
|
|
removed DESTROY method(not b...
|
48 |
# Connect to database |
49 |
my $dbi = DBIx::Custom::SQLite->connect(database => 'dbname'); |
|
packaging one directory
|
50 |
|
removed DESTROY method(not b...
|
51 |
# Connect to 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 | ||
59 |
This class is L<DBIx::Custom> subclass. |
|
60 |
You can use all attributes of L<DBIx::Custom>. |
|
61 | ||
removed DBIx::Custom commit ...
|
62 |
=head2 C<database> |
update document
|
63 | |
cleanup
|
64 |
my $database = $dbi->database; |
65 |
$dbi = $dbi->database('your_database'); |
|
packaging one directory
|
66 | |
removed DESTROY method(not b...
|
67 |
Database name. |
68 |
This is used for connect(). |
|
69 | ||
rename DBIx::Custom::SQLite ...
|
70 |
=head1 METHODS |
packaging one directory
|
71 | |
update document
|
72 |
This class is L<DBIx::Custom> subclass. |
73 |
You can use all methods of L<DBIx::Custom>. |
|
packaging one directory
|
74 | |
removed DBIx::Custom commit ...
|
75 |
=head2 C<connect (overridden)> |
removed DESTROY method(not b...
|
76 |
|
77 |
$dbi = DBIx::Custom::SQLite->connect( |
|
78 |
data_source => "dbi:SQLite:dbname=your_db" |
|
79 |
); |
|
80 |
|
|
81 |
$dbi = DBIx::Custom::SQLite->connect(database => 'your_db'); |
|
packaging one directory
|
82 | |
update document
|
83 |
Connect to database. |
removed DESTROY method(not b...
|
84 |
You can also specify database name, instead of data source. |
packaging one directory
|
85 | |
removed DBIx::Custom commit ...
|
86 |
=head2 C<connect_memory> |
packaging one directory
|
87 | |
update document
|
88 |
$dbi->connect_memory; |
packaging one directory
|
89 | |
removed DESTROY method(not b...
|
90 |
Connect to memory database. |
add Oracle, DB2, Pg,
|
91 | |
removed DESTROY method(not b...
|
92 |
=head2 C<last_insert_rowid> |
update document
|
93 | |
rename DBIx::Custom::SQLite ...
|
94 |
$last_insert_rowid = $dbi->last_insert_rowid; |
removed DESTROY method(not b...
|
95 | |
96 |
Get last insert row id. |
|
update document
|
97 |
This is equal to SQLite last_insert_rowid() function. |
add Oracle, DB2, Pg,
|
98 | |
rename DBIx::Custom::SQLite ...
|
99 |
=cut |