From: Ken Youens-Clark Date: Wed, 8 Oct 2003 22:37:59 +0000 (+0000) Subject: Fixed bug that wasn't maintaining table order. X-Git-Tag: v0.04~102 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b727fc08127611b5f886ad72f53abd7e31dc78e0;p=dbsrgits%2FSQL-Translator.git Fixed bug that wasn't maintaining table order. --- diff --git a/lib/SQL/Translator/Parser/SQLite.pm b/lib/SQL/Translator/Parser/SQLite.pm index 2f81efe..e2c70b7 100644 --- a/lib/SQL/Translator/Parser/SQLite.pm +++ b/lib/SQL/Translator/Parser/SQLite.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::SQLite; # ------------------------------------------------------------------- -# $Id: SQLite.pm,v 1.2 2003-10-04 01:16:39 kycl4rk Exp $ +# $Id: SQLite.pm,v 1.3 2003-10-08 22:37:59 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -154,7 +154,7 @@ like-op::= use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -556,9 +556,11 @@ sub parse { warn Dumper( $result ) if $DEBUG; my $schema = $translator->schema; - my @tables = sort { - $result->{ $a }->{'order'} <=> $result->{ $b }->{'order'} - } keys %{ $result->{'tables'} }; + my @tables = + map { $_->[1] } + sort { $a->[0] <=> $b->[0] } + map { [ $result->{'tables'}{ $_ }->{'order'}, $_ ] } + keys %{ $result->{'tables'} }; for my $table_name ( @tables ) { my $tdata = $result->{'tables'}{ $table_name };