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 | ||
packaging one directory
|
8 |
use Carp 'croak'; |
9 | ||
update document
|
10 |
__PACKAGE__->attr('database'); |
11 | ||
packaging one directory
|
12 |
sub connect { |
update document
|
13 |
my $proto = shift; |
14 |
|
|
15 |
# Create |
|
16 |
my $self = ref $proto ? $proto : $proto->new(@_); |
|
packaging one directory
|
17 |
|
rename DBIx::Custom::SQLite ...
|
18 |
# Create data source |
packaging one directory
|
19 |
if (!$self->data_source && (my $database = $self->database)) { |
20 |
$self->data_source("dbi:SQLite:dbname=$database"); |
|
21 |
} |
|
22 |
|
|
23 |
return $self->SUPER::connect; |
|
24 |
} |
|
25 | ||
26 |
sub connect_memory { |
|
removed DESTROY method(not b...
|
27 |
my $self = shift->new(@_); |
packaging one directory
|
28 |
|
29 |
# Data source for memory database |
|
30 |
$self->data_source('dbi:SQLite:dbname=:memory:'); |
|
31 |
|
|
32 |
# Connect |
|
33 |
$self->connect; |
|
34 |
|
|
35 |
return $self; |
|
36 |
} |
|
37 | ||
removed reconnect method
|
38 |
sub last_insert_rowid { shift->dbh->func('last_insert_rowid') } |
packaging one directory
|
39 | |
removed register_format()
|
40 |
1; |
41 | ||
packaging one directory
|
42 |
=head1 NAME |
43 | ||
cleanup
|
44 |
DBIx::Custom::SQLite - SQLite implementation |
packaging one directory
|
45 | |
rename DBIx::Custom::SQLite ...
|
46 |
=head1 SYNOPSYS |
packaging one directory
|
47 | |
48 |
use DBIx::Custom::SQLite; |
|
49 |
|
|
removed DESTROY method(not b...
|
50 |
# Connect to database |
51 |
my $dbi = DBIx::Custom::SQLite->connect(database => 'dbname'); |
|
packaging one directory
|
52 |
|
removed DESTROY method(not b...
|
53 |
# Connect to memory database |
update document
|
54 |
my $dbi = DBIx::Custom::SQLite->connect_memory; |
55 |
|
|
removed DESTROY method(not b...
|
56 |
# Get last insert row id |
update document
|
57 |
my $id = $dbi->last_insert_rowid; |
packaging one directory
|
58 |
|
update document
|
59 |
=head1 ATTRIBUTES |
60 | ||
61 |
This class is L<DBIx::Custom> subclass. |
|
62 |
You can use all attributes of L<DBIx::Custom>. |
|
63 | ||
removed DBIx::Custom commit ...
|
64 |
=head2 C<database> |
update document
|
65 | |
cleanup
|
66 |
my $database = $dbi->database; |
67 |
$dbi = $dbi->database('your_database'); |
|
packaging one directory
|
68 | |
removed DESTROY method(not b...
|
69 |
Database name. |
70 |
This is used for connect(). |
|
71 | ||
rename DBIx::Custom::SQLite ...
|
72 |
=head1 METHODS |
packaging one directory
|
73 | |
update document
|
74 |
This class is L<DBIx::Custom> subclass. |
75 |
You can use all methods of L<DBIx::Custom>. |
|
packaging one directory
|
76 | |
removed DBIx::Custom commit ...
|
77 |
=head2 C<connect (overridden)> |
removed DESTROY method(not b...
|
78 |
|
79 |
$dbi = DBIx::Custom::SQLite->connect( |
|
80 |
data_source => "dbi:SQLite:dbname=your_db" |
|
81 |
); |
|
82 |
|
|
83 |
$dbi = DBIx::Custom::SQLite->connect(database => 'your_db'); |
|
packaging one directory
|
84 | |
update document
|
85 |
Connect to database. |
removed DESTROY method(not b...
|
86 |
You can also specify database name, instead of data source. |
packaging one directory
|
87 | |
removed DBIx::Custom commit ...
|
88 |
=head2 C<connect_memory> |
packaging one directory
|
89 | |
update document
|
90 |
$dbi->connect_memory; |
packaging one directory
|
91 | |
removed DESTROY method(not b...
|
92 |
Connect to memory database. |
add Oracle, DB2, Pg,
|
93 | |
removed DESTROY method(not b...
|
94 |
=head2 C<last_insert_rowid> |
update document
|
95 | |
rename DBIx::Custom::SQLite ...
|
96 |
$last_insert_rowid = $dbi->last_insert_rowid; |
removed DESTROY method(not b...
|
97 | |
98 |
Get last insert row id. |
|
update document
|
99 |
This is equal to SQLite last_insert_rowid() function. |
add Oracle, DB2, Pg,
|
100 | |
rename DBIx::Custom::SQLite ...
|
101 |
=cut |