Remove all expansion $XX tags (isolated commit, easily revertable)
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Parser / DBI / SQLite.pm
CommitLineData
6a9f7bae 1package SQL::Translator::Parser::DBI::SQLite;
2
3# -------------------------------------------------------------------
478f608d 4# Copyright (C) 2002-2009 SQLFairy Authors
6a9f7bae 5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License as
8# published by the Free Software Foundation; version 2.
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18# 02111-1307 USA
19# -------------------------------------------------------------------
20
21=head1 NAME
22
23SQL::Translator::Parser::DBI::SQLite - parser for DBD::SQLite
24
25=head1 SYNOPSIS
26
27See SQL::Translator::Parser::DBI.
28
29=head1 DESCRIPTION
30
9156433b 31Queries the "sqlite_master" table for schema definition. The schema
32is held in this table simply as CREATE statements for the database
33objects, so it really just builds up a string of all these and passes
34the result to the regular SQLite parser. Therefore there is no gain
35(at least in performance) to using this module over simply dumping the
36schema to a text file and parsing that.
6a9f7bae 37
38=cut
39
40use strict;
41use DBI;
42use SQL::Translator::Parser::SQLite;
43use Data::Dumper;
44
da06ac74 45use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
46$VERSION = '1.99';
6a9f7bae 47$DEBUG = 0 unless defined $DEBUG;
48
49# -------------------------------------------------------------------
50sub parse {
51 my ( $tr, $dbh ) = @_;
52
bdfd8a3f 53 my $create = join(";\n",
54 map { $_ || () }
55 @{ $dbh->selectcol_arrayref('select sql from sqlite_master') },
6a9f7bae 56 );
bdfd8a3f 57 $create .= ";";
58 $tr->debug( "create =\n$create\n" );
6a9f7bae 59
60 my $schema = $tr->schema;
61
6a9f7bae 62 SQL::Translator::Parser::SQLite::parse( $tr, $create );
63 return 1;
64}
65
661;
67
68# -------------------------------------------------------------------
69# Where man is not nature is barren.
70# William Blake
71# -------------------------------------------------------------------
72
73=pod
74
75=head1 AUTHOR
76
da804135 77Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
6a9f7bae 78
79=head1 SEE ALSO
80
9156433b 81SQL::Translator::Parser::SQLite.
6a9f7bae 82
83=cut