Newer Older
90 lines | 1.987kb
packaging one directory
yuki-kimoto authored on 2009-11-16
1
package DBIx::Custom::SQLite;
2

            
3
use strict;
update document
yuki-kimoto authored on 2009-11-17
4
use warnings;
rename DBIx::Custom::SQLite ...
yuki-kimoto authored on 2010-01-30
5

            
update document
yuki-kimoto authored on 2010-05-27
6
use base 'DBIx::Custom';
7

            
8
__PACKAGE__->attr('database');
9

            
packaging one directory
yuki-kimoto authored on 2009-11-16
10
sub connect {
update document
yuki-kimoto authored on 2010-05-27
11
    my $proto = shift;
12
    
cleanup
yuki-kimoto authored on 2010-08-05
13
    # Create a new object
update document
yuki-kimoto authored on 2010-05-27
14
    my $self = ref $proto ? $proto : $proto->new(@_);
packaging one directory
yuki-kimoto authored on 2009-11-16
15
    
cleanup
yuki-kimoto authored on 2010-08-05
16
    # Data source
add tests
yuki-kimoto authored on 2010-08-10
17
    my $database = $self->database;
18
    if (!$self->data_source && $database) {
19
        $self->data_source("dbi:SQLite:dbname=$database")
packaging one directory
yuki-kimoto authored on 2009-11-16
20
    }
21
    
22
    return $self->SUPER::connect;
23
}
24

            
25
sub connect_memory {
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
26
    my $self = shift->new(@_);
packaging one directory
yuki-kimoto authored on 2009-11-16
27
    
cleanup
yuki-kimoto authored on 2010-08-05
28
    # Data source
packaging one directory
yuki-kimoto authored on 2009-11-16
29
    $self->data_source('dbi:SQLite:dbname=:memory:');
30
    
cleanup
yuki-kimoto authored on 2010-08-05
31
    # Connect to database
packaging one directory
yuki-kimoto authored on 2009-11-16
32
    $self->connect;
33
    
34
    return $self;
35
}
36

            
removed register_format()
yuki-kimoto authored on 2010-05-26
37
1;
38

            
packaging one directory
yuki-kimoto authored on 2009-11-16
39
=head1 NAME
40

            
cleanup
yuki-kimoto authored on 2010-08-03
41
DBIx::Custom::SQLite - SQLite implementation
packaging one directory
yuki-kimoto authored on 2009-11-16
42

            
rename DBIx::Custom::SQLite ...
yuki-kimoto authored on 2010-01-30
43
=head1 SYNOPSYS
packaging one directory
yuki-kimoto authored on 2009-11-16
44

            
45
    use DBIx::Custom::SQLite;
46
    
cleanup
yuki-kimoto authored on 2010-08-05
47
    # Connect to the database
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
48
    my $dbi = DBIx::Custom::SQLite->connect(database  => 'dbname');
packaging one directory
yuki-kimoto authored on 2009-11-16
49
    
cleanup
yuki-kimoto authored on 2010-08-05
50
    # Connect to the memory database
update document
yuki-kimoto authored on 2010-05-27
51
    my $dbi = DBIx::Custom::SQLite->connect_memory;
52
    
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
53
    # Get last insert row id
update document
yuki-kimoto authored on 2010-05-27
54
    my $id = $dbi->last_insert_rowid;
packaging one directory
yuki-kimoto authored on 2009-11-16
55
    
update document
yuki-kimoto authored on 2010-05-27
56
=head1 ATTRIBUTES
57

            
cleanup
yuki-kimoto authored on 2010-08-05
58
L<DBIx::Custom::SQLite> inherits all attributes from L<DBIx::Custom>
59
and implements the following new ones.
update document
yuki-kimoto authored on 2010-05-27
60

            
removed DBIx::Custom commit ...
yuki-kimoto authored on 2010-07-14
61
=head2 C<database>
update document
yuki-kimoto authored on 2010-05-27
62

            
cleanup
yuki-kimoto authored on 2010-08-03
63
    my $database = $dbi->database;
cleanup
yuki-kimoto authored on 2010-08-05
64
    $dbi         = $dbi->database('dbname');
packaging one directory
yuki-kimoto authored on 2009-11-16
65

            
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
66
Database name.
cleanup
yuki-kimoto authored on 2010-08-05
67
C<connect()> method use this value to connect the database
68
if C<data_source> is not specified.
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
69

            
rename DBIx::Custom::SQLite ...
yuki-kimoto authored on 2010-01-30
70
=head1 METHODS
packaging one directory
yuki-kimoto authored on 2009-11-16
71

            
cleanup
yuki-kimoto authored on 2010-08-05
72
L<DBIx::Custom::SQLite> inherits all methods from L<DBIx::Custom>
73
and implements the following new ones.
packaging one directory
yuki-kimoto authored on 2009-11-16
74

            
cleanup
yuki-kimoto authored on 2010-08-05
75
=head2 C<connect>
removed DESTROY method(not b...
yuki-kimoto authored on 2010-07-18
76
    
cleanup
yuki-kimoto authored on 2010-08-05
77
    my $dbi = DBIx::Custom::SQLite->connect(database  => 'dbname');
packaging one directory
yuki-kimoto authored on 2009-11-16
78

            
cleanup
yuki-kimoto authored on 2010-08-05
79
Create a new L<DBIx::Custom::SQLite> object and connect to the database.
cleanup
yuki-kimoto authored on 2010-08-05
80
This method overrides C<DBIx::Custom::connect()> method.
cleanup
yuki-kimoto authored on 2010-08-05
81
You can specify all attributes of L<DBIx::Custom>
82
and L<DBIx::Custom::SQLite>, such as C<database>.
packaging one directory
yuki-kimoto authored on 2009-11-16
83

            
removed DBIx::Custom commit ...
yuki-kimoto authored on 2010-07-14
84
=head2 C<connect_memory>
packaging one directory
yuki-kimoto authored on 2009-11-16
85

            
cleanup
yuki-kimoto authored on 2010-08-05
86
    my $dbi = DBIx::Custom::SQLite->connect_memory;
packaging one directory
yuki-kimoto authored on 2009-11-16
87

            
cleanup
yuki-kimoto authored on 2010-08-05
88
Create a new L<DBIx::Custom::SQLite> object and connect to the memory database.
add Oracle, DB2, Pg,
yuki-kimoto authored on 2009-11-16
89

            
rename DBIx::Custom::SQLite ...
yuki-kimoto authored on 2010-01-30
90
=cut