package SQL::Translator::Schema::Table;
# ----------------------------------------------------------------------
-# $Id: Table.pm 1440 2009-01-17 16:31:57Z jawnsy $
-# ----------------------------------------------------------------------
# Copyright (C) 2002-2009 SQLFairy Authors
#
# This program is free software; you can redistribute it and/or
use base 'SQL::Translator::Schema::Object';
-use vars qw( $VERSION $FIELD_ORDER );
+use vars qw( $VERSION );
-$VERSION = '1.99';
+$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
=cut
+sub new {
+ my $class = shift;
+ my $self = $class->SUPER::new (@_)
+ or return;
+
+ $self->{_order} = { map { $_ => 0 } qw/
+ field
+ /};
+
+ return $self;
+}
+
+
+
# ----------------------------------------------------------------------
sub add_constraint {
$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;
=head2 field_names
Read-only method to return a list or array ref of the field names. Returns undef
-or an empty list if the table has no fields set. Usefull if you want to
+or an empty list if the table has no fields set. Useful if you want to
avoid the overload magic of the Field objects returned by the get_fields method.
my @names = $constraint->field_names;
=head1 AUTHORS
-Ken Y. Clark E<lt>kclark@cpan.orgE<gt>,
+Ken Youens-Clark E<lt>kclark@cpan.orgE<gt>,
Allen Day E<lt>allenday@ucla.eduE<gt>.
=cut