1 package SQL::Translator::Parser::DBI::SQLite;
3 # -------------------------------------------------------------------
4 # $Id: SQLite.pm,v 1.1 2003-10-03 00:21:41 kycl4rk Exp $
5 # -------------------------------------------------------------------
6 # Copyright (C) 2003 Ken Y. Clark <kclark@cpan.org>.
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.
39 use SQL::Translator::Parser::SQLite;
42 use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
43 $VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/;
44 $DEBUG = 0 unless defined $DEBUG;
46 # -------------------------------------------------------------------
48 my ( $tr, $dbh ) = @_;
50 my $data = $dbh->selectall_arrayref(
51 'select * from sqlite_master', { Columns => {} }
54 $tr->debug( "sqlite_master =\n", Dumper( $data ) );
56 my $schema = $tr->schema;
59 for my $rec ( @$data ) {
60 my $sql = $rec->{'sql'} or next;
64 $tr->debug( "create =\n$create\n" );
66 SQL::Translator::Parser::SQLite::parse( $tr, $create );
72 # -------------------------------------------------------------------
73 # Where man is not nature is barren.
75 # -------------------------------------------------------------------
81 Ken Y. Clark E<lt>kclark@cpan.orgE<gt>,
82 Chris Mungall E<lt>cjm@fruitfly.orgE<gt>.
86 perl(1), Parse::RecDescent, SQL::Translator::Schema.