fix a bunch of spelling errors, and add whatis entries (these are applying patches...
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Table.pm
index 50a1855..e17b236 100644 (file)
@@ -1,9 +1,7 @@
 package SQL::Translator::Schema::Table;
 
 # ----------------------------------------------------------------------
-# $Id$
-# ----------------------------------------------------------------------
-# 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,9 +47,9 @@ use Data::Dumper;
 
 use base 'SQL::Translator::Schema::Object';
 
-use vars qw( $VERSION $FIELD_ORDER );
+use vars qw( $VERSION );
 
-$VERSION = sprintf "%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/;
+$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
@@ -79,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 {
 
@@ -322,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;
 
@@ -888,7 +900,7 @@ sub field_names {
 =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;
@@ -1110,7 +1122,7 @@ sub DESTROY {
 
 =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