blib/lib/Oryx/DBI/Util/SQLite.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 22 CC 1 SCAR 6.9
CC
1
Cov
0%
type2sql
2.0
column_drop
2.0
table_exists
2.0
CRAP 2.0
1 package Oryx::DBI::Util::SQLite;
2  
3 use base qw(Oryx::DBI::Util);
4  
5 our %SQL_TYPES = (
6 'Oid' => 'integer PRIMARY KEY AUTOINCREMENT',
7 'Integer' => 'integer',
8 'String' => 'text',
9 'Text' => 'text',
10 'Binary' => 'blob',
11 'Float' => 'real',
12 'Boolean' => 'integer',
13 'DateTime' => 'text',
14 );
15  
16 sub type2sql {
17 my ($self, $type, $size) = @_;
18 my $sql_type = $SQL_TYPES{$type};
19 return $sql_type;
20 }
21  
22 # Columns may not be dropped in SQLite. Oh, well.
23 sub column_drop { }
24  
25 sub table_exists {
26 my ($self, $dbh, $table) = @_;
27 my $sth = $dbh->table_info('%', '%', $table);
28 $sth->execute();
29 my @rv = @{$sth->fetchall_arrayref};
30 $sth->finish;
31 return grep { lc $_->[2] eq lc $table } @rv;
32 }
33  
34 1;
35  
36 =head1 NAME
37  
38 Oryx::DBI::Util::SQLite - Oryx DBI utilities for SQLite connections
39  
40 =head1 DESCRIPTION
41  
42 This provides an Oryx DBI utility class for use with L<DBD::SQLite>.
43  
44 =head1 SEE ALSO
45  
46 L<Oryx::DBI::Util>, L<DBD::Pg>
47  
48 =head1 AUTHORS
49  
50 Richard Hundt E<lt>richard NO SPAM AT protea-systems.comE<gt>
51  
52 Andrew Sterling Hanenkamp E<lt>hanenkamp@cpan.orgE<gt>
53  
54 =head1 COPYRIGHT AND LICENSE
55  
56 Copyrright (c) 2005 Richard Hundt.
57  
58 This library is free software and may be used under the same terms as Perl itself.
59  
60 =cut