1 package SQL::Translator::Parser::DBI::SQLite;
3 # -------------------------------------------------------------------
4 # Copyright (C) 2002-2009 SQLFairy Authors
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.
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.
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
19 # -------------------------------------------------------------------
23 SQL::Translator::Parser::DBI::SQLite - parser for DBD::SQLite
27 See SQL::Translator::Parser::DBI.
31 Queries the "sqlite_master" table for schema definition. The schema
32 is held in this table simply as CREATE statements for the database
33 objects, so it really just builds up a string of all these and passes
34 the result to the regular SQLite parser. Therefore there is no gain
35 (at least in performance) to using this module over simply dumping the
36 schema to a text file and parsing that.
42 use SQL::Translator::Parser::SQLite;
45 use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
47 $DEBUG = 0 unless defined $DEBUG;
49 # -------------------------------------------------------------------
51 my ( $tr, $dbh ) = @_;
53 my $create = join(";\n",
55 @{ $dbh->selectcol_arrayref('select sql from sqlite_master') },
58 $tr->debug( "create =\n$create\n" );
60 my $schema = $tr->schema;
62 SQL::Translator::Parser::SQLite::parse( $tr, $create );
68 # -------------------------------------------------------------------
69 # Where man is not nature is barren.
71 # -------------------------------------------------------------------
77 Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
81 SQL::Translator::Parser::SQLite.