| 1 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Data::Storage::DBI::SQLite; | ||||||||||
| 6 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $Data::Storage::DBI::SQLite::VERSION = '1.102720'; | |||||||||
| 8 | } | ||||||||||
| 9 | # ABSTRACT: Base class for SQLite DBI storages | ||||||||||
| 10 | 1 | ▶ | use parent 'Data::Storage::DBI'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 0 | ▶ | sub connect_string { | ||||||||
|
Subroutine
connect_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 13 | 0 | my $self = shift; | |||||||||
| 14 | 0 | sprintf("dbi:SQLite:dbname=%s", $self->dbname); | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | # Prepare a test database; unlink the existing database and recreate it with | ||||||||||
| 18 | # the initial data. This method is called at the beginning of test programs. | ||||||||||
| 19 | # The functionality implemented here is specific to SQLite, as that's probably | ||||||||||
| 20 | # only going to be used for tests. If you're testing against Oracle databases | ||||||||||
| 21 | # where setup is going to take a lot more steps than unlinking and recreating, | ||||||||||
| 22 | # you might want to prepare a test database beforehand and leave this method | ||||||||||
| 23 | # empty, so the same database is reused for many tests. | ||||||||||
| 24 | 0 | ▶ | sub test_setup { | ||||||||
|
Subroutine
test_setup: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 25 | 0 | my $self = shift; | |||||||||
| 26 | 0 | ▶ | if (-e $self->dbname) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | ▶ | unlink $self->dbname | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | or throw Error::Hierarchy::Internal::CustomMessage( | ||||||||||
| 29 | custom_message => sprintf "can't unlink %s: %s\n", | ||||||||||
| 30 | $self->dbname, $! | ||||||||||
| 31 | ); | ||||||||||
| 32 | } | ||||||||||
| 33 | 0 | $self->connect; | |||||||||
| 34 | 0 | $self->setup; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | sub last_id { | ||||||||
|
Subroutine
last_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 38 | 0 | my $self = shift; | |||||||||
| 39 | 0 | $self->dbh->func('last_insert_rowid'); | |||||||||
| 40 | } | ||||||||||
| 41 | 1 | 1; | |||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | __END__ | ||||||||||