File Coverage

blib/lib/Biblio/Zotero/DB/Schema/Result/StoredItem.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Biblio::Zotero::DB::Schema::Result::StoredItem;
2             $Biblio::Zotero::DB::Schema::Result::StoredItem::VERSION = '0.003';
3             # TODO: document
4              
5 13     13   10942 use strict;
  13         33  
  13         435  
6 13     13   70 use warnings;
  13         28  
  13         367  
7 13     13   69 use base qw/Biblio::Zotero::DB::Schema::Result::Item/;
  13         26  
  13         5261  
8              
9             __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
10             __PACKAGE__->table('storedItems');
11             __PACKAGE__->result_source_instance->is_virtual(1);
12              
13             # NOTE: SQL
14             __PACKAGE__->result_source_instance->view_definition(
15             q[
16             SELECT * FROM items me
17             WHERE ( itemid NOT IN ( SELECT me.itemid FROM deletedItems me ) )
18             ]
19             );
20             # the above view_definition is the same as:
21             # ----------------------------------------
22             # my $deleted = $schema->resultset('DeletedItem')
23             # ->get_column('itemid')
24             # ->as_query
25             # $schema
26             # ->resultset('Item')
27             # ->search( { itemid => { 'not in' => $deleted } })
28             # ->as_query
29              
30             1;
31              
32             __END__