| ... | ... |
@@ -10,10 +10,10 @@ __PACKAGE__->attr('database');
|
| 10 | 10 |
sub connect {
|
| 11 | 11 |
my $proto = shift; |
| 12 | 12 |
|
| 13 |
- # Create |
|
| 13 |
+ # Create a new object |
|
| 14 | 14 |
my $self = ref $proto ? $proto : $proto->new(@_); |
| 15 | 15 |
|
| 16 |
- # Create data source |
|
| 16 |
+ # Data source |
|
| 17 | 17 |
if (!$self->data_source && (my $database = $self->database)) {
|
| 18 | 18 |
$self->data_source("dbi:SQLite:dbname=$database");
|
| 19 | 19 |
} |
| ... | ... |
@@ -24,10 +24,10 @@ sub connect {
|
| 24 | 24 |
sub connect_memory {
|
| 25 | 25 |
my $self = shift->new(@_); |
| 26 | 26 |
|
| 27 |
- # Data source for memory database |
|
| 27 |
+ # Data source |
|
| 28 | 28 |
$self->data_source('dbi:SQLite:dbname=:memory:');
|
| 29 | 29 |
|
| 30 |
- # Connect |
|
| 30 |
+ # Connect to database |
|
| 31 | 31 |
$self->connect; |
| 32 | 32 |
|
| 33 | 33 |
return $self; |
| ... | ... |
@@ -45,10 +45,10 @@ DBIx::Custom::SQLite - SQLite implementation |
| 45 | 45 |
|
| 46 | 46 |
use DBIx::Custom::SQLite; |
| 47 | 47 |
|
| 48 |
- # Connect to database |
|
| 48 |
+ # Connect to the database |
|
| 49 | 49 |
my $dbi = DBIx::Custom::SQLite->connect(database => 'dbname'); |
| 50 | 50 |
|
| 51 |
- # Connect to memory database |
|
| 51 |
+ # Connect to the memory database |
|
| 52 | 52 |
my $dbi = DBIx::Custom::SQLite->connect_memory; |
| 53 | 53 |
|
| 54 | 54 |
# Get last insert row id |
| ... | ... |
@@ -56,44 +56,43 @@ DBIx::Custom::SQLite - SQLite implementation |
| 56 | 56 |
|
| 57 | 57 |
=head1 ATTRIBUTES |
| 58 | 58 |
|
| 59 |
-This class is L<DBIx::Custom> subclass. |
|
| 60 |
-You can use all attributes of L<DBIx::Custom>. |
|
| 59 |
+L<DBIx::Custom::SQLite> inherits all attributes from L<DBIx::Custom> |
|
| 60 |
+and implements the following new ones. |
|
| 61 | 61 |
|
| 62 | 62 |
=head2 C<database> |
| 63 | 63 |
|
| 64 | 64 |
my $database = $dbi->database; |
| 65 |
- $dbi = $dbi->database('your_database');
|
|
| 65 |
+ $dbi = $dbi->database('dbname');
|
|
| 66 | 66 |
|
| 67 | 67 |
Database name. |
| 68 |
-This is used for connect(). |
|
| 68 |
+C<connect()> method use this value to connect the database |
|
| 69 |
+if C<data_source> is not specified. |
|
| 69 | 70 |
|
| 70 | 71 |
=head1 METHODS |
| 71 | 72 |
|
| 72 |
-This class is L<DBIx::Custom> subclass. |
|
| 73 |
-You can use all methods of L<DBIx::Custom>. |
|
| 73 |
+L<DBIx::Custom::SQLite> inherits all methods from L<DBIx::Custom> |
|
| 74 |
+and implements the following new ones. |
|
| 74 | 75 |
|
| 75 |
-=head2 C<connect (overridden)> |
|
| 76 |
- |
|
| 77 |
- $dbi = DBIx::Custom::SQLite->connect( |
|
| 78 |
- data_source => "dbi:SQLite:dbname=your_db" |
|
| 79 |
- ); |
|
| 76 |
+=head2 C<connect> |
|
| 80 | 77 |
|
| 81 |
- $dbi = DBIx::Custom::SQLite->connect(database => 'your_db'); |
|
| 78 |
+ my $dbi = DBIx::Custom::SQLite->connect(database => 'dbname'); |
|
| 82 | 79 |
|
| 83 |
-Connect to database. |
|
| 84 |
-You can also specify database name, instead of data source. |
|
| 80 |
+Create a new L<DBIx::Custom::SQLite> object and connect to database. |
|
| 81 |
+This method override C<DBIx::Custom::connect()> method. |
|
| 82 |
+You can specify all attributes of L<DBIx::Custom> |
|
| 83 |
+and L<DBIx::Custom::SQLite>, such as C<database>. |
|
| 85 | 84 |
|
| 86 | 85 |
=head2 C<connect_memory> |
| 87 | 86 |
|
| 88 |
- $dbi->connect_memory; |
|
| 87 |
+ my $dbi = DBIx::Custom::SQLite->connect_memory; |
|
| 89 | 88 |
|
| 90 |
-Connect to memory database. |
|
| 89 |
+Create a new L<DBIx::Custom::SQLite> object and connect to the memory database. |
|
| 91 | 90 |
|
| 92 | 91 |
=head2 C<last_insert_rowid> |
| 93 | 92 |
|
| 94 |
- $last_insert_rowid = $dbi->last_insert_rowid; |
|
| 93 |
+ my $last_insert_rowid = $dbi->last_insert_rowid; |
|
| 95 | 94 |
|
| 96 | 95 |
Get last insert row id. |
| 97 |
-This is equal to SQLite last_insert_rowid() function. |
|
| 96 |
+This is same as C<last_insert_rowid()> function in SQLite. |
|
| 98 | 97 |
|
| 99 | 98 |
=cut |