Newer Older
95 lines | 2.113kb
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

            
added table not specified ex...
Yuki Kimoto authored on 2011-01-21
41
DBIx::Custom::SQLite - DEPRECATED!
packaging one directory
yuki-kimoto authored on 2009-11-16
42

            
deprecated DBIx::Custom::MyS...
root authored on 2010-11-26
43
=head1 CAUTION
44

            
many changed
Yuki Kimoto authored on 2011-01-23
45
B<This module is deprecated now> because This module is less useful
46
than I expected. Please use DBIx::Custom instead.>
deprecated DBIx::Custom::MyS...
root authored on 2010-11-26
47

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

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

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

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

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

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

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

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

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

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

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

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

            
cleanup
yuki-kimoto authored on 2010-08-05
93
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
94

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