Bumping version to 1.61
[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;
f27f9229 23use warnings;
6a9f7bae 24use DBI;
25use SQL::Translator::Parser::SQLite;
26use Data::Dumper;
27
0c04c5a2 28our ( $DEBUG, @EXPORT_OK );
752a0ffc 29our $VERSION = '1.61';
6a9f7bae 30$DEBUG = 0 unless defined $DEBUG;
31
6a9f7bae 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