File Coverage

blib/lib/Class/DBI/ClassGenerator/DBD/SQLite.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             # $Id: SQLite.pm,v 1.3 2008-08-28 17:07:11 cantrelld Exp $
2              
3             package Class::DBI::ClassGenerator::DBD::SQLite;
4              
5 1     1   6 use strict;
  1         2  
  1         178  
6 1     1   7 use warnings;
  1         2  
  1         41  
7              
8 1     1   6 use vars qw($VERSION);
  1         1  
  1         244  
9              
10             $VERSION = '1.0';
11              
12             =head1 NAME
13              
14             Class::DBI::ClassGenerator::DBD::SQLite - SQLite-specific helper module
15             for Class::DBI::ClassGenerator.
16              
17             You should never have to use this module directly. It is only of
18             interest if hacking on the main module, or for those wishing to add
19             support for another type of database.
20              
21             See Class::DBI::ClassGenerator::Extending for details.
22              
23             =cut
24              
25             sub _get_tables {
26 2     2   1756 my(undef, $dbh) = @_;
27              
28 2         3 return map { @{$_} } @{$dbh->selectall_arrayref("SELECT name FROM sqlite_master WHERE type='table'")};
  4         852  
  4         16  
  2         29  
29             }
30              
31             sub _get_columns {
32 4     4   639 my(undef, $dbh, $table) = @_;
33              
34 4         35 my $data = $dbh->selectall_hashref("PRAGMA table_info($table)", 'name');
35 17         143 return map {
36 4         13 $_ => {
37             type => '', # $data->{$_}->{type}
38             null => !$data->{$_}->{notnull},
39             pk => $data->{$_}->{pk},
40             default => $data->{$_}->{dflt_value}
41             }
42 4         1383 } keys %{$data}
43             }
44              
45             =head1 BUGS and WARNINGS
46              
47             This should be considered to be pre-production code. It's probably chock
48             full of exciting bugs.
49              
50             =head1 AUTHOR, COPYRIGHT and LICENCE
51              
52             Written by David Cantrell Edavid@cantrell.org.ukE
53              
54             Copyright 2008 Outcome Technologies Ltd
55              
56             This software is free-as-in-speech software, and may be used, distributed,
57             and modified under the terms of either the GNU General Public Licence
58             version 2 or the Artistic Licence. It's up to you which one you use. The
59             full text of the licences can be found in the files GPL2.txt and
60             ARTISTIC.txt, respectively.
61              
62             =cut
63              
64             1;