| 1 | package DBIO::SQLite::Introspect::Triggers; | ||||||||||||
| 2 | # ABSTRACT: Introspect SQLite triggers | ||||||||||||
| 3 | |||||||||||||
| 4 | 193 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 193 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 193 | our $VERSION = '0.900007'; | |||||||||||
| 8 | |||||||||||||
| 9 | |||||||||||||
| 10 | |||||||||||||
| 11 | 755 | ▶ | sub fetch { | ||||||||||
|
Subroutine
fetch: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 12 | 755 | my ($class, $dbh, $tables) = @_; | |||||||||||
| 13 | |||||||||||||
| 14 | # SQLite matches a name whatever its letter case. | ||||||||||||
| 15 | 755 | my %table_name = map { lc $_ => $_ } keys %$tables; | |||||||||||
| 16 | |||||||||||||
| 17 | 755 | my $rows = $dbh->selectall_arrayref( | |||||||||||
| 18 | q{SELECT name, tbl_name, sql FROM sqlite_master WHERE type = 'trigger'}, | ||||||||||||
| 19 | { Slice => {} }, | ||||||||||||
| 20 | ); | ||||||||||||
| 21 | |||||||||||||
| 22 | 755 | my %triggers; | |||||||||||
| 23 | 755 | for my $row (@$rows) { | |||||||||||
| 24 | 28 | ▶ | my $table = $table_name{ lc $row->{tbl_name} } // next; | ||||||||||
|
Condition50%1/2
$table_name{lc $row->{"tbl_name"}} // (next)
MC/DC0%0/1
$table_name{lc $row->{"tbl_name"}} // (next)
$table_name{lc $row->{"tbl_name"}}
Truth table50%1/2
A
A= $table_name{lc $row->{"tbl_name"}}
| |||||||||||||
| 25 | $triggers{$table}{ $row->{name} } = { | ||||||||||||
| 26 | trigger_name => $row->{name}, | ||||||||||||
| 27 | table_name => $table, | ||||||||||||
| 28 | sql => $row->{sql}, | ||||||||||||
| 29 | 28 | }; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 755 | return \%triggers; | |||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 193 | 1; | |||||||||||
| 36 | |||||||||||||
| 37 | __END__ | ||||||||||||