remove commented copyright
[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
ea93df61 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
9156433b 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
6a9f7bae 31sub parse {
32 my ( $tr, $dbh ) = @_;
33
bdfd8a3f 34 my $create = join(";\n",
35 map { $_ || () }
36 @{ $dbh->selectcol_arrayref('select sql from sqlite_master') },
6a9f7bae 37 );
bdfd8a3f 38 $create .= ";";
39 $tr->debug( "create =\n$create\n" );
6a9f7bae 40
41 my $schema = $tr->schema;
42
6a9f7bae 43 SQL::Translator::Parser::SQLite::parse( $tr, $create );
44 return 1;
45}
46
471;
48
49# -------------------------------------------------------------------
50# Where man is not nature is barren.
51# William Blake
52# -------------------------------------------------------------------
53
54=pod
55
56=head1 AUTHOR
57
11ad2df9 58Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
6a9f7bae 59
60=head1 SEE ALSO
61
9156433b 62SQL::Translator::Parser::SQLite.
6a9f7bae 63
64=cut