X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FSchema%2FTable.pm;h=3e02c4352aff6b917f321fb550aa9484318cf8f1;hb=f4b8e04b825168484da452b5a8492b0ab4adb853;hp=e1bac58069f11daff03eead6b85822807fb8caf2;hpb=da5a1bae10b18456fedc2707f0361274e6c68a17;p=dbsrgits%2FSQL-Translator.git diff --git a/lib/SQL/Translator/Schema/Table.pm b/lib/SQL/Translator/Schema/Table.pm index e1bac58..3e02c43 100644 --- a/lib/SQL/Translator/Schema/Table.pm +++ b/lib/SQL/Translator/Schema/Table.pm @@ -1,9 +1,7 @@ package SQL::Translator::Schema::Table; # ---------------------------------------------------------------------- -# $Id: Table.pm,v 1.37 2007-10-24 10:55:44 schiffbruechige Exp $ -# ---------------------------------------------------------------------- -# Copyright (C) 2002-4 SQLFairy Authors +# Copyright (C) 2002-2009 SQLFairy Authors # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -49,10 +47,9 @@ use Data::Dumper; use base 'SQL::Translator::Schema::Object'; -use vars qw( $VERSION $FIELD_ORDER ); - -$VERSION = sprintf "%d.%02d", q$Revision: 1.37 $ =~ /(\d+)\.(\d+)/; +use vars qw( $VERSION ); +$VERSION = '1.59'; # Stringify to our name, being careful not to pass any args through so we don't # accidentally set it to undef. We also have to tweak bool so the object is @@ -80,6 +77,20 @@ Object constructor. =cut +sub new { + my $class = shift; + my $self = $class->SUPER::new (@_) + or return; + + $self->{_order} = { map { $_ => 0 } qw/ + field + /}; + + return $self; +} + + + # ---------------------------------------------------------------------- sub add_constraint { @@ -323,7 +334,7 @@ existing field, you will get an error and the field will not be created. $self->error( $field_class->error ); } - $field->order( ++$FIELD_ORDER ); + $field->order( ++$self->{_order}{field} ); # We know we have a name as the Field->new above errors if none given. my $field_name = $field->name; @@ -1111,7 +1122,7 @@ sub DESTROY { =head1 AUTHORS -Ken Y. Clark Ekclark@cpan.orgE, +Ken Youens-Clark Ekclark@cpan.orgE, Allen Day Eallenday@ucla.eduE. =cut