1 package SQL::Translator::Parser::DBI::SQLite;
3 # -------------------------------------------------------------------
5 # -------------------------------------------------------------------
6 # Copyright (C) 2002-2009 SQLFairy Authors
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; version 2.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # -------------------------------------------------------------------
25 SQL::Translator::Parser::DBI::SQLite - parser for DBD::SQLite
29 See SQL::Translator::Parser::DBI.
33 Queries the "sqlite_master" table for schema definition. The schema
34 is held in this table simply as CREATE statements for the database
35 objects, so it really just builds up a string of all these and passes
36 the result to the regular SQLite parser. Therefore there is no gain
37 (at least in performance) to using this module over simply dumping the
38 schema to a text file and parsing that.
44 use SQL::Translator::Parser::SQLite;
47 use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
49 $DEBUG = 0 unless defined $DEBUG;
51 # -------------------------------------------------------------------
53 my ( $tr, $dbh ) = @_;
55 my $create = join(";\n",
57 @{ $dbh->selectcol_arrayref('select sql from sqlite_master') },
60 $tr->debug( "create =\n$create\n" );
62 my $schema = $tr->schema;
64 SQL::Translator::Parser::SQLite::parse( $tr, $create );
70 # -------------------------------------------------------------------
71 # Where man is not nature is barren.
73 # -------------------------------------------------------------------
79 Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
83 SQL::Translator::Parser::SQLite.