blib/lib/SQL/Translator/Parser/DBI/SQLite.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
parse
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package SQL::Translator::Parser::DBI::SQLite;
2  
3 =head1 NAME
4  
5 SQL::Translator::Parser::DBI::SQLite - parser for DBD::SQLite
6  
7 =head1 SYNOPSIS
8  
9 See SQL::Translator::Parser::DBI.
10  
11 =head1 DESCRIPTION
12  
13 Queries the "sqlite_master" table for schema definition. The schema
14 is held in this table simply as CREATE statements for the database
15 objects, so it really just builds up a string of all these and passes
16 the result to the regular SQLite parser. Therefore there is no gain
17 (at least in performance) to using this module over simply dumping the
18 schema to a text file and parsing that.
19  
20 =cut
21  
22 use strict;
23 use warnings;
24 use DBI;
25 use SQL::Translator::Parser::SQLite;
26 use Data::Dumper;
27  
28 our ($DEBUG, @EXPORT_OK);
29 our $VERSION = '1.66';
30 $DEBUG = 0 unless defined $DEBUG;
31  
32 sub parse {
33 my ($tr, $dbh) = @_;
34  
35 my $create = join(";\n", map { $_ || () } @{ $dbh->selectcol_arrayref('select sql from sqlite_master') },);
36 $create .= ";";
37 $tr->debug("create =\n$create\n");
38  
39 my $schema = $tr->schema;
40  
41 SQL::Translator::Parser::SQLite::parse($tr, $create);
42 return 1;
43 }
44  
45 1;
46  
47 # -------------------------------------------------------------------
48 # Where man is not nature is barren.
49 # William Blake
50 # -------------------------------------------------------------------
51  
52 =pod
53  
54 =head1 AUTHOR
55  
56 Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
57  
58 =head1 SEE ALSO
59  
60 SQL::Translator::Parser::SQLite.
61  
62 =cut