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