| 1 | # $Id: Populate.pm 84 2020-05-31 06:29:34Z stro $ | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | package CPAN::SQLite::Populate; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 8 | ▶ | no warnings qw(redefine); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | our $VERSION = '0.219'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use English qw/-no_match_vars/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use CPAN::SQLite::Util qw($table_id has_hash_data print_debug); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | use CPAN::SQLite::DBI::Index; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | ▶ | use CPAN::SQLite::DBI qw($dbh); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 8 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 8 | ▶ | use File::Spec::Functions; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 8 | ▶ | use File::Path; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 8 | ▶ | use Scalar::Util 'weaken'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | our $dbh = $CPAN::SQLite::DBI::dbh; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 8 | my ($setup); | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | my %tbl2obj; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 8 | $tbl2obj{$_} = __PACKAGE__ . '::' . $_ foreach (qw(dists mods auths info)); | |||||||||||||||||||||||||||||||||||||||||
| 26 | 8 | my %obj2tbl = reverse %tbl2obj; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=23.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | $setup = $args{setup}; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | my $index = $args{index}; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | my @tables = qw(dists mods auths info); | |||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | foreach my $table (@tables) { | |||||||||||||||||||||||||||||||||||||||||
| 36 | 16 | my $obj = $index->{$table}; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 16 | ▶ | die "Please supply a CPAN::SQLite::Index::$table object" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$obj and ref $obj eq "CPAN::SQLite::Index::$table"
MC/DC0%0/2
$obj and ref $obj eq "CPAN::SQLite::Index::$table"
$obj
ref $obj eq "CPAN::SQLite::Index::$table"
Truth table33%1/3
A and B
A= $objB= ref $obj eq "CPAN::SQLite::Index::$table"
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | unless ($obj and ref($obj) eq "CPAN::SQLite::Index::$table"); | ||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | my $state = $args{state}; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | unless ($setup) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | die "Please supply a CPAN::SQLite::State object" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$state and ref $state eq "CPAN::SQLite::State"
MC/DC0%0/2
$state and ref $state eq "CPAN::SQLite::State"
$state
ref $state eq "CPAN::SQLite::State"
Truth table0%0/3
A and B
A= $stateB= ref $state eq "CPAN::SQLite::State"
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | unless ($state and ref($state) eq 'CPAN::SQLite::State'); | ||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | my $cdbi = CPAN::SQLite::DBI::Index->new(%args); | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | my $self = { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | index => $index, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | state => $state, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | obj => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | cdbi => $cdbi, | ||||||||||||||||||||||||||||||||||||||||||
| 52 | db_name => $args{db_name}, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | sub populate { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
populate: called CC=5 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | ▶ | if ($setup) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | ▶ | unless ($self->{cdbi}->create_tables(setup => $setup)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | warn "Creating tables failed"; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | ▶ | unless ($self->create_objs()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | warn "Cannot create objects"; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 4 | ▶ | unless ($self->populate_tables()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | warn "Populating tables failed"; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | sub create_objs { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_objs: called CC=12 SCAR=28.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 4 | my @tables = qw(dists auths mods info); | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 4 | foreach my $table (@tables) { | |||||||||||||||||||||||||||||||||||||||||
| 82 | 16 | my $obj; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 16 | my $pack = $tbl2obj{$table}; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 16 | my $index = $self->{index}->{$table}; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 16 | ▶ | if ($index and ref($index) eq "CPAN::SQLite::Index::$table") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$index and ref $index eq "CPAN::SQLite::Index::$table"
MC/DC0%0/2
$index and ref $index eq "CPAN::SQLite::Index::$table"
$index
ref $index eq "CPAN::SQLite::Index::$table"
Truth table33%1/3
A and B
A= $indexB= ref $index eq "CPAN::SQLite::Index::$table"
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 16 | my $info = $index->{info}; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 16 | ▶ | if ($table ne 'info') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 12 | ▶ | return unless has_hash_data($info); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | $obj = $pack->new( | ||||||||||||||||||||||||||||||||||||||||||
| 91 | info => $info, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 16 | cdbi => $self->{cdbi}->{objs}->{$table}); | |||||||||||||||||||||||||||||||||||||||||
| 93 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $obj = $pack->new(cdbi => $self->{cdbi}->{objs}->{$table}); | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 16 | $self->{obj}->{$table} = $obj; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 4 | foreach my $table (@tables) { | |||||||||||||||||||||||||||||||||||||||||
| 100 | 16 | my $obj = $self->{obj}->{$table}; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 16 | foreach (@tables) { | |||||||||||||||||||||||||||||||||||||||||
| 102 | 64 | ▶ | next if ref($obj) eq $tbl2obj{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 48 | $obj->{obj}->{$_} = $self->{obj}->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 48 | weaken $obj->{obj}->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 4 | ▶ | unless ($setup) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $state = $self->{state}; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my @tables = qw(auths dists mods); | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my @data = qw(ids insert update delete); | |||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | foreach my $table (@tables) { | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my $state_obj = $state->{obj}->{$table}; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $pop_obj = $self->{obj}->{$table}; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $pop_obj->{$_} = $state_obj->{$_} for (@data); | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | sub populate_tables { | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
populate_tables: called CC=8 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | ▶ | my @methods = $setup ? qw(insert) : qw(insert update delete); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | # Reset status | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | my $info_obj = $self->{'obj'}->{'info'}; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 4 | ▶ | unless ($info_obj->delete) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | print_debug('Fatal error from ', ref($info_obj), ':', $info_obj->{'error_msg'}); | |||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 4 | my @tables = qw(auths dists mods); | |||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | for my $method (@methods) { | |||||||||||||||||||||||||||||||||||||||||
| 135 | 4 | for my $table (@tables) { | |||||||||||||||||||||||||||||||||||||||||
| 136 | 12 | my $obj = $self->{obj}->{$table}; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 12 | ▶ | unless ($obj->$method()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if (my $error = $obj->{error_msg}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | print_debug("Fatal error from ", ref($obj), ": ", $error, $/); | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my $info = $obj->{info_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | print_debug("Info from ", ref($obj), ": ", $info, $/); | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | # Update status | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 4 | ▶ | unless ($info_obj->insert) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | print_debug('Fatal error from ', ref($info_obj), ':', $info_obj->{'error_msg'}); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | package CPAN::SQLite::Populate::auths; | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 8 | ▶ | use parent 'CPAN::SQLite::Populate'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 8 | ▶ | use CPAN::SQLite::Util qw(has_hash_data print_debug); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 4 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.8
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 4 | my $info = $args{info}; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 4 | ▶ | die "No author info available" unless has_hash_data($info); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | my $cdbi = $args{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 4 | ▶ | die "No dbi object available" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::auths"
MC/DC0%0/2
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::auths"
$cdbi
ref $cdbi eq "CPAN::SQLite::DBI::Index::auths"
Truth table33%1/3
A and B
A= $cdbiB= ref $cdbi eq "CPAN::SQLite::DBI::Index::auths"
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | unless ($cdbi and ref($cdbi) eq 'CPAN::SQLite::DBI::Index::auths'); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 4 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 170 | info => $info, | ||||||||||||||||||||||||||||||||||||||||||
| 171 | insert => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 172 | update => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 173 | delete => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 174 | ids => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 175 | obj => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 176 | cdbi => $cdbi, | ||||||||||||||||||||||||||||||||||||||||||
| 177 | error_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 178 | info_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 179 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 4 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | sub insert { | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert: called CC=11 SCAR=31.7
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | my $info = $self->{info}; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | ▶ | my $data = $setup ? $info : $self->{insert}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 4 | ▶ | unless (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->{info_msg} = q{No author data to insert}; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 4 | my $auth_ids = $self->{ids}; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 4 | my @fields = qw(cpanid email fullname); | |||||||||||||||||||||||||||||||||||||||||
| 198 | 4 | ▶ | my $sth = $cdbi->sth_insert(\@fields) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 201 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 4 | foreach my $cpanid (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 203 | 14737 | my $values = $info->{$cpanid}; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 14737 | ▶ | next unless ($values and $cpanid); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$values and $cpanid
MC/DC0%0/2
$values and $cpanid
$values
$cpanid
Truth table33%1/3
A and B
A= $valuesB= $cpanid
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 14737 | print_debug("Inserting author $cpanid\n"); | |||||||||||||||||||||||||||||||||||||||||
| 206 | $sth->execute($cpanid, $values->{email}, $values->{fullname}) | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 14737 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 211 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 14737 | ▶ | $auth_ids->{$cpanid} = $dbh->func('last_insert_rowid') or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 216 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 4 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 219 | 4 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 4 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 224 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | sub update { | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my $data = $self->{update}; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | unless (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->{info_msg} = q{No author data to update}; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my $info = $self->{info}; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my @fields = qw(cpanid email fullname); | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | foreach my $cpanid (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | print_debug("Updating author $cpanid\n"); | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | next unless $data->{$cpanid}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $sth = $cdbi->sth_update(\@fields, $data->{$cpanid}); | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $values = $info->{$cpanid}; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | next unless ($cpanid and $values); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cpanid and $values
MC/DC0%0/2
$cpanid and $values
$cpanid
$values
Truth table0%0/3
A and B
A= $cpanidB= $values
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | $sth->execute($cpanid, $values->{email}, $values->{fullname}) | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 254 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 262 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | sub delete { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $self->{info_msg} = q{No author data to delete}; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | package CPAN::SQLite::Populate::dists; | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 8 | ▶ | use parent 'CPAN::SQLite::Populate'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 8 | ▶ | use CPAN::SQLite::Util qw(has_hash_data print_debug); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 4 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.8
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 4 | my $info = $args{info}; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 4 | ▶ | die "No dist info available" unless has_hash_data($info); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | my $cdbi = $args{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 281 | 4 | ▶ | die "No dbi object available" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::dists"
MC/DC0%0/2
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::dists"
$cdbi
ref $cdbi eq "CPAN::SQLite::DBI::Index::dists"
Truth table33%1/3
A and B
A= $cdbiB= ref $cdbi eq "CPAN::SQLite::DBI::Index::dists"
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | unless ($cdbi and ref($cdbi) eq 'CPAN::SQLite::DBI::Index::dists'); | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 4 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 284 | info => $info, | ||||||||||||||||||||||||||||||||||||||||||
| 285 | insert => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 286 | update => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 287 | delete => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 288 | ids => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | obj => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 290 | cdbi => $cdbi, | ||||||||||||||||||||||||||||||||||||||||||
| 291 | error_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 292 | info_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 293 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 4 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | sub insert { | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert: called CC=15 SCAR=36.8
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 4 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 4 | ▶ | return unless my $auth_obj = $self->{obj}->{auths}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 4 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 4 | my $auth_ids = $auth_obj->{ids}; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 4 | my $dists = $self->{info}; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 4 | ▶ | my $data = $setup ? $dists : $self->{insert}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 4 | ▶ | unless (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | $self->{info_msg} = q{No dist data to insert}; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 4 | ▶ | unless ($dists and $auth_ids) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dists and $auth_ids
MC/DC0%0/2
$dists and $auth_ids
$dists
$auth_ids
Truth table33%1/3
A and B
A= $distsB= $auth_ids
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{error_msg}->{index} = q{No dist index data available}; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 4 | my $dist_ids = $self->{ids}; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 4 | my @fields = qw(auth_id dist_name dist_file dist_vers dist_abs); | |||||||||||||||||||||||||||||||||||||||||
| 319 | 4 | ▶ | my $sth = $cdbi->sth_insert(\@fields) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 322 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 4 | foreach my $distname (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 324 | 41943 | my $values = $dists->{$distname}; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 41943 | my $cpanid = $values->{cpanid}; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 41943 | ▶ | next unless ($values and $cpanid and $auth_ids->{$cpanid}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$values and $cpanid and $auth_ids->{$cpanid}
$values and $cpanid
MC/DC0%0/3
$values and $cpanid and $auth_ids->{$cpanid}
$values
$cpanid
$auth_ids->{$cpanid}
Truth table25%1/4
A and B and C
A= $valuesB= $cpanidC= $auth_ids->{$cpanid}
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 41943 | print_debug("Inserting $distname of $cpanid\n"); | |||||||||||||||||||||||||||||||||||||||||
| 328 | $sth->execute($auth_ids->{ $values->{cpanid} }, $distname, $values->{dist_file}, $values->{dist_vers}, $values->{dist_abs}) | ||||||||||||||||||||||||||||||||||||||||||
| 329 | 41943 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 333 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 41943 | ▶ | $dist_ids->{$distname} = $dbh->func('last_insert_rowid') or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 338 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 4 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 341 | 4 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 4 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 346 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | sub update { | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my $data = $self->{update}; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | unless (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $self->{info_msg} = q{No dist data to update}; | |||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | return unless my $auth_obj = $self->{obj}->{auths}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $auth_ids = $auth_obj->{ids}; | |||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my $dists = $self->{info}; | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | unless ($dists and $auth_ids) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dists and $auth_ids
MC/DC0%0/2
$dists and $auth_ids
$dists
$auth_ids
Truth table0%0/3
A and B
A= $distsB= $auth_ids
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $self->{error_msg} = q{No dist index data available}; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my @fields = qw(auth_id dist_name dist_file dist_vers dist_abs); | |||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | foreach my $distname (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | next unless $data->{$distname}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | my $sth = $cdbi->sth_update(\@fields, $data->{$distname}); | |||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $values = $dists->{$distname}; | |||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $cpanid = $values->{cpanid}; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | next unless ($values and $cpanid and $auth_ids->{$cpanid}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$values and $cpanid and $auth_ids->{$cpanid}
$values and $cpanid
MC/DC0%0/3
$values and $cpanid and $auth_ids->{$cpanid}
$values
$cpanid
$auth_ids->{$cpanid}
Truth table0%0/4
A and B and C
A= $valuesB= $cpanidC= $auth_ids->{$cpanid}
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | print_debug("Updating $distname of $cpanid\n"); | |||||||||||||||||||||||||||||||||||||||||
| 378 | $sth->execute($auth_ids->{ $values->{cpanid} }, $distname, $values->{dist_file}, $values->{dist_vers}, $values->{dist_abs}) | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 383 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 391 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | sub delete { | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | my $data = $self->{delete}; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | unless (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $self->{info_msg} = q{No dist data to delete}; | |||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $sth = $cdbi->sth_delete('dist_id'); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | foreach my $distname (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | print_debug("Deleting $distname\n"); | |||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | $sth->execute($data->{$distname}) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 415 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 423 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | package CPAN::SQLite::Populate::mods; | ||||||||||||||||||||||||||||||||||||||||||
| 428 | 8 | ▶ | use parent 'CPAN::SQLite::Populate'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | 8 | ▶ | use CPAN::SQLite::Util qw(has_hash_data print_debug); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 4 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.8
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 4 | my $info = $args{info}; | |||||||||||||||||||||||||||||||||||||||||
| 434 | 4 | ▶ | die "No module info available" unless has_hash_data($info); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 4 | my $cdbi = $args{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 436 | 4 | ▶ | die "No dbi object available" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::mods"
MC/DC0%0/2
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::mods"
$cdbi
ref $cdbi eq "CPAN::SQLite::DBI::Index::mods"
Truth table33%1/3
A and B
A= $cdbiB= ref $cdbi eq "CPAN::SQLite::DBI::Index::mods"
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | unless ($cdbi and ref($cdbi) eq 'CPAN::SQLite::DBI::Index::mods'); | ||||||||||||||||||||||||||||||||||||||||||
| 438 | 4 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 439 | info => $info, | ||||||||||||||||||||||||||||||||||||||||||
| 440 | insert => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 441 | update => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 442 | delete => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 443 | ids => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 444 | obj => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 445 | cdbi => $cdbi, | ||||||||||||||||||||||||||||||||||||||||||
| 446 | error_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 447 | info_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 448 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 4 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | sub insert { | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert: called CC=14 SCAR=35.9
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 4 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 4 | ▶ | return unless my $dist_obj = $self->{obj}->{dists}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 4 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 460 | 4 | my $dist_ids = $dist_obj->{ids}; | |||||||||||||||||||||||||||||||||||||||||
| 461 | 4 | my $mods = $self->{info}; | |||||||||||||||||||||||||||||||||||||||||
| 462 | 4 | ▶ | my $data = $setup ? $mods : $self->{insert}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 4 | ▶ | unless (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $self->{info_msg} = q{No module data to insert}; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 4 | ▶ | unless ($mods and $dist_ids) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mods and $dist_ids
MC/DC0%0/2
$mods and $dist_ids
$mods
$dist_ids
Truth table33%1/3
A and B
A= $modsB= $dist_ids
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $self->{error_msg} = q{No module index data available}; | |||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 4 | my $mod_ids = $self->{ids}; | |||||||||||||||||||||||||||||||||||||||||
| 473 | 4 | my @fields = qw(dist_id mod_name mod_abs | |||||||||||||||||||||||||||||||||||||||||
| 474 | mod_vers); | ||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | 4 | ▶ | my $sth = $cdbi->sth_insert(\@fields) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 479 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 480 | 4 | foreach my $modname (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 481 | 235787 | my $values = $mods->{$modname}; | |||||||||||||||||||||||||||||||||||||||||
| 482 | 235787 | ▶ | next unless ($values and $dist_ids->{ $values->{dist_name} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$values and $$dist_ids{$values->{"dist_name"}}
MC/DC0%0/2
$values and $$dist_ids{$values->{"dist_name"}}
$values
$$dist_ids{$values->{"dist_name"}}
Truth table33%1/3
A and B
A= $valuesB= $$dist_ids{$values->{"dist_name"}}
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | $sth->execute($dist_ids->{ $values->{dist_name} }, $modname, $values->{mod_abs}, $values->{mod_vers}) | ||||||||||||||||||||||||||||||||||||||||||
| 484 | 235787 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 488 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 235787 | ▶ | $mod_ids->{$modname} = $dbh->func('last_insert_rowid') or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 493 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 4 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 496 | 4 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 497 | 4 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 501 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 502 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | sub update { | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | my $data = $self->{update}; | |||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | unless (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $self->{info_msg} = q{No module data to update}; | |||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | return unless my $dist_obj = $self->{obj}->{dists}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | my $dist_ids = $dist_obj->{ids}; | |||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my $mods = $self->{info}; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | unless ($dist_ids and $mods) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dist_ids and $mods
MC/DC0%0/2
$dist_ids and $mods
$dist_ids
$mods
Truth table0%0/3
A and B
A= $dist_idsB= $mods
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $self->{error_msg} = q{No module index data available}; | |||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my @fields = qw(dist_id mod_name mod_abs | |||||||||||||||||||||||||||||||||||||||||
| 526 | mod_vers); | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | foreach my $modname (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | next unless $data->{$modname}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | print_debug("Updating $modname\n"); | |||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my $sth = $cdbi->sth_update(\@fields, $data->{$modname}); | |||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | my $values = $mods->{$modname}; | |||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | next unless ($values and $dist_ids->{ $values->{dist_name} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$values and $$dist_ids{$values->{"dist_name"}}
MC/DC0%0/2
$values and $$dist_ids{$values->{"dist_name"}}
$values
$$dist_ids{$values->{"dist_name"}}
Truth table0%0/3
A and B
A= $valuesB= $$dist_ids{$values->{"dist_name"}}
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | $sth->execute($dist_ids->{ $values->{dist_name} }, $modname, $values->{mod_abs}, $values->{mod_vers}) | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 539 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 547 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | sub delete { | ||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | return unless my $dist_obj = $self->{obj}->{dists}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my $data = $dist_obj->{delete}; | |||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | if (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | my $sth = $cdbi->sth_delete('dist_id'); | |||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | foreach my $distname (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | $sth->execute($data->{$distname}) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 567 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | $data = $self->{delete}; | |||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | if (has_hash_data($data)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | my $sth = $cdbi->sth_delete('mod_id'); | |||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | foreach my $modname (keys %$data) { | |||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | $sth->execute($data->{$modname}) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 581 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | print_debug("Deleting $modname\n"); | |||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | $sth->finish; | |||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 591 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | package CPAN::SQLite::Populate::info; | ||||||||||||||||||||||||||||||||||||||||||
| 596 | 8 | ▶ | use parent 'CPAN::SQLite::Populate'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | 8 | ▶ | use CPAN::SQLite::Util qw(has_hash_data print_debug); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 600 | 4 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||
| 601 | 4 | my $cdbi = $args{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 602 | 4 | ▶ | die "No dbi object available" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::info"
MC/DC0%0/2
$cdbi and ref $cdbi eq "CPAN::SQLite::DBI::Index::info"
$cdbi
ref $cdbi eq "CPAN::SQLite::DBI::Index::info"
Truth table33%1/3
A and B
A= $cdbiB= ref $cdbi eq "CPAN::SQLite::DBI::Index::info"
| |||||||||||||||||||||||||||||||||||||||||||
| 603 | unless ($cdbi and ref($cdbi) eq 'CPAN::SQLite::DBI::Index::info'); | ||||||||||||||||||||||||||||||||||||||||||
| 604 | 4 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 605 | obj => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 606 | cdbi => $cdbi, | ||||||||||||||||||||||||||||||||||||||||||
| 607 | error_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 608 | info_msg => '', | ||||||||||||||||||||||||||||||||||||||||||
| 609 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 610 | 4 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | sub insert { | ||||||||||||||||||||||||||||||||||||||||||
| 614 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert: called CC=5 SCAR=21.4
| |||||||||||||||||||||||||||||||||||||||||||
| 615 | 4 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||
| 619 | 4 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||
| 621 | 4 | ▶ | my $sth = $cdbi->sth_insert(['status']) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 624 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 625 | $sth->execute(1) | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 4 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 630 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 631 | 4 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 632 | 4 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 633 | 4 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 637 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 638 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | sub update { | ||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | $self->{'error_msg'} = 'update is not a valid call'; | |||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||
| 647 | sub delete { | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: called CC=4 SCAR=17.5
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | 4 | ▶ | unless ($dbh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | $self->{error_msg} = q{No db handle available}; | |||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||
| 653 | 4 | my $cdbi = $self->{cdbi}; | |||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | 4 | my $sth = $cdbi->sth_delete('status'); | |||||||||||||||||||||||||||||||||||||||||
| 656 | 4 | ▶ | $sth->execute(1) or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | $cdbi->db_error($sth); | |||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 660 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 661 | 4 | $sth->finish(); | |||||||||||||||||||||||||||||||||||||||||
| 662 | 4 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 663 | 4 | ▶ | $dbh->commit() or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | $cdbi->db_error(); | |||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | $self->{error_msg} = $cdbi->{error_msg}; | |||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 667 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 668 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | package CPAN::SQLite::Populate; | ||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | sub db_error { | ||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | ▶ | my ($obj, $sth) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_error: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | return unless $dbh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | if ($sth) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | $sth->finish; | |||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | undef $sth; | |||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | return $obj->{error_msg} = q{Database error: } . $dbh->errstr; | |||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | CPAN::SQLite::Populate - create and populate database tables | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | version 0.219 | ||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | This module is responsible for creating the tables | ||||||||||||||||||||||||||||||||||||||||||
| 696 | (if C<setup> is passed as an option) and then for | ||||||||||||||||||||||||||||||||||||||||||
| 697 | inserting, updating, or deleting (as appropriate) the | ||||||||||||||||||||||||||||||||||||||||||
| 698 | relevant information from the indices of | ||||||||||||||||||||||||||||||||||||||||||
| 699 | I<CPAN::SQLite::Info> and the | ||||||||||||||||||||||||||||||||||||||||||
| 700 | state information from I<CPAN::SQLite::State>. It does | ||||||||||||||||||||||||||||||||||||||||||
| 701 | this through the C<insert>, C<update>, and C<delete> | ||||||||||||||||||||||||||||||||||||||||||
| 702 | methods associated with each table. | ||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | Note that the tables are created with the C<setup> argument | ||||||||||||||||||||||||||||||||||||||||||
| 705 | passed into the C<new> method when creating the | ||||||||||||||||||||||||||||||||||||||||||
| 706 | C<CPAN::SQLite::Index> object; existing tables will be | ||||||||||||||||||||||||||||||||||||||||||
| 707 | dropped. | ||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | =head1 TABLES | ||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | The tables used are described below - the data types correspond | ||||||||||||||||||||||||||||||||||||||||||
| 712 | to mysql tables, with the corresponding adjustments made if | ||||||||||||||||||||||||||||||||||||||||||
| 713 | the SQLite database is used. | ||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | =head2 mods | ||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | This table contains module information, and is created as | ||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||
| 719 | mod_id INTEGER NOT NULL PRIMARY KEY | ||||||||||||||||||||||||||||||||||||||||||
| 720 | mod_name VARCHAR(100) NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 721 | dist_id INTEGER NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 722 | mod_abs TEXT | ||||||||||||||||||||||||||||||||||||||||||
| 723 | mod_vers VARCHAR(10) | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | =over 3 | ||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | =item * mod_id | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | This is the primary (unique) key of the table. | ||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | =item * dist_id | ||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | This key corresponds to the id of the associated distribution | ||||||||||||||||||||||||||||||||||||||||||
| 734 | in the C<dists> table. | ||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | =item * mod_name | ||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | This is the module's name. | ||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | =item * mod_abs | ||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | This is a description, if available, of the module. | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | =item * mod_vers | ||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | This value, if present, gives the version of the module. | ||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||
| 748 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||
| 750 | =head2 dists | ||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||
| 752 | This table contains distribution information, and is created as | ||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | dist_id INTEGER NOT NULL PRIMARY KEY | ||||||||||||||||||||||||||||||||||||||||||
| 755 | dist_name VARCHAR(90) NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 756 | auth_id INTEGER NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 757 | dist_file VARCHAR(110) NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 758 | dist_vers VARCHAR(20) | ||||||||||||||||||||||||||||||||||||||||||
| 759 | dist_abs TEXT | ||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | =over 3 | ||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||
| 763 | =item * dist_id | ||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | This is the primary (unique) key of the table. | ||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||
| 767 | =item * auth_id | ||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | This corresponds to the CPAN author id of the distribution | ||||||||||||||||||||||||||||||||||||||||||
| 770 | in the C<auths> table. | ||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | =item * dist_name | ||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||
| 774 | This corresponds to the distribution name (eg, for | ||||||||||||||||||||||||||||||||||||||||||
| 775 | F<My-Distname-0.22.tar.gz>, C<dist_name> will be C<My-Distname>). | ||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | =item * dist_file | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | This corresponds to the CPAN file name. | ||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | =item * dist_vers | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | This is the version of the CPAN file (eg, for | ||||||||||||||||||||||||||||||||||||||||||
| 784 | F<My-Distname-0.22.tar.gz>, C<dist_vers> will be C<0.22>). | ||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | =item * dist_abs | ||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||
| 788 | This is a description of the distribution. If not directly | ||||||||||||||||||||||||||||||||||||||||||
| 789 | supplied, the description for, eg, C<Foo::Bar>, if present, will | ||||||||||||||||||||||||||||||||||||||||||
| 790 | be used for the C<Foo-Bar> distribution. | ||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||
| 792 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | =head2 auths | ||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | This table contains CPAN author information, and is created as | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | auth_id INTEGER NOT NULL PRIMARY KEY | ||||||||||||||||||||||||||||||||||||||||||
| 799 | cpanid VARCHAR(20) NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 800 | fullname VARCHAR(40) NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 801 | email TEXT | ||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||
| 803 | =over 3 | ||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||
| 805 | =item * auth_id | ||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||
| 807 | This is the primary (unique) key of the table. | ||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||
| 809 | =item * cpanid | ||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||
| 811 | This gives the CPAN author id. | ||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||
| 813 | =item * fullname | ||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||
| 815 | This is the full name of the author. | ||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||
| 817 | =item * email | ||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | This is the supplied email address of the author. | ||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||
| 821 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||
| 823 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||
| 825 | L<CPAN::SQLite::Index> | ||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||
| 827 | =cut | ||||||||||||||||||||||||||||||||||||||||||