Merge branch 'patch-1' of https://github.com/dsteinbrunner/sql-translator
Dagfinn Ilmari Mannsåker [Sat, 14 Sep 2013 16:29:52 +0000 (17:29 +0100)]
Closes #34

27 files changed:
lib/SQL/Translator.pm
lib/SQL/Translator/Diff.pm
lib/SQL/Translator/Filter/Globals.pm
lib/SQL/Translator/Manual.pod
lib/SQL/Translator/Parser/SQLite.pm
lib/SQL/Translator/Parser/XML/SQLFairy.pm
lib/SQL/Translator/Producer/ClassDBI.pm
lib/SQL/Translator/Producer/DiaUml.pm
lib/SQL/Translator/Producer/GraphViz.pm
lib/SQL/Translator/Producer/Latex.pm
lib/SQL/Translator/Producer/MySQL.pm
lib/SQL/Translator/Producer/PostgreSQL.pm
lib/SQL/Translator/Producer/SQLite.pm
lib/SQL/Translator/Producer/TT/Base.pm
lib/SQL/Translator/Producer/TT/Table.pm
lib/SQL/Translator/Producer/TTSchema.pm
lib/SQL/Translator/Producer/XML.pm
lib/SQL/Translator/Producer/XML/SQLFairy.pm
lib/SQL/Translator/Schema.pm
lib/SQL/Translator/Schema/Constraint.pm
lib/SQL/Translator/Schema/Field.pm
lib/SQL/Translator/Schema/Role/Extra.pm
lib/SQL/Translator/Schema/Table.pm
lib/SQL/Translator/Types.pm
lib/Test/SQL/Translator.pm
script/sqlt-diagram
script/sqlt-graph

index 916f80b..3847b5a 100644 (file)
@@ -959,7 +959,7 @@ analogously to C<producer_type> and C<producer_args>
 
 =head2 filters
 
-Set or retreive the filters to run over the schema during the
+Set or retrieve the filters to run over the schema during the
 translation, before the producer creates its output. Filters are sub
 routines called, in order, with the schema object to filter as the 1st
 arg and a hash of options (passed as a list) for the rest of the args.
index c291ce4..d8d6503 100644 (file)
@@ -381,7 +381,7 @@ sub diff_table_constraints {
 sub diff_table_fields {
   my ($self, $src_table, $tar_table) = @_;
 
-  # List of ones ew've renamed from so we dont drop them
+  # List of ones we've renamed from so we don't drop them
   my %renamed_source_fields;
 
   for my $tar_table_field ( $tar_table->get_fields ) {
@@ -442,7 +442,7 @@ sub diff_table_options {
     my ($a_name, undef, $b_name, undef) = ( %$a, %$b );
     $a_name cmp $b_name;
   };
-  # Need to sort the options so we dont get supruious diffs.
+  # Need to sort the options so we don't get spurious diffs.
   my (@src_opts, @tar_opts);
   @src_opts = sort $cmp $src_table->options;
   @tar_opts = sort $cmp $tar_table->options;
@@ -471,7 +471,7 @@ SQL::Translator::Diff - determine differences between two schemas
 =head1 DESCRIPTION
 
 Takes two input SQL::Translator::Schemas (or SQL files) and produces ALTER
-statments to make them the same
+statements to make them the same
 
 =head1 SNYOPSIS
 
@@ -572,7 +572,7 @@ I.e. the hash might look something like the following:
 
 C<preprocess_schema> is called by the Diff code to allow the producer to
 normalize any data it needs to first. For example, the MySQL producer uses
-this method to ensure that FK contraint names are unique.
+this method to ensure that FK constraint names are unique.
 
 Basicaly any changes that need to be made to produce the SQL file for the
 schema should be done here, so that a diff between a parsed SQL file and (say)
index d4dbfda..497e40f 100644 (file)
@@ -104,7 +104,7 @@ sub filter {
         $schema->drop_table($gtbl);
     }
 
-    # Add globalis to tables
+    # Add globals to tables
     foreach my $tbl ( $schema->get_tables ) {
 
         foreach my $new_fld ( @global_fields ) {
index d9e0381..4be28b9 100644 (file)
@@ -129,7 +129,7 @@ comma-separated file to an SQLite database, do the following:
 
   $ sqlt -f xSV --fs ',' -t SQLite foo.csv > foo-sqlite.sql
 
-Additionally, there is a non-SQL represenation of relational schemas namely
+Additionally, there is a non-SQL representation of relational schemas namely
 XML.  Additionally, the only XML supported is our own version;  however, it
 would be fairly easy to add an XML parser for something like the TorqueDB
 (http://db.apache.org/torque/) project.  The actual parsing of XML should be
@@ -148,7 +148,7 @@ operation performed by SQLFairy, so it may behoove you to serialize a
 parsed schema if you need to perform repeated conversions.  For
 example, as part of a build process the author converts a MySQL schema
 first to YAML, then to PostgreSQL, Oracle, SQLite and Sybase.
-Additionally, a variety of documention in HTML and images is produced.
+Additionally, a variety of documentation in HTML and images is produced.
 This can be accomplished like so:
 
   $ sqlt -f MySQL -t YAML schema-mysql.sql > schema.yaml
index 459f203..ddc9ea4 100644 (file)
@@ -737,7 +737,7 @@ sub parse {
 1;
 
 # -------------------------------------------------------------------
-# All wholsome food is caught without a net or a trap.
+# All wholesome food is caught without a net or a trap.
 # William Blake
 # -------------------------------------------------------------------
 
index 5cc37d1..7f54f39 100644 (file)
@@ -44,7 +44,7 @@ tags then the order the tags appear in the XML will be used.
 =head2 default_value
 
 Leave the attribute out all together to use the default in L<Schema::Field>.
-Use empty quotes or 'EMPTY_STRING' for a zero lenth string. 'NULL' for an
+Use empty quotes or 'EMPTY_STRING' for a zero length string. 'NULL' for an
 explicit null (currently sets default_value to undef in the
 Schema::Field obj).
 
@@ -58,14 +58,14 @@ Doesn't take any extra parser args at the moment.
 
 =head1 LEGACY FORMAT
 
-The previous version of the SQLFairy XML allowed the attributes of the the
+The previous version of the SQLFairy XML allowed the attributes of the
 schema objects to be written as either xml attributes or as data elements, in
 any combination. While this allows for lots of flexibility in writing the XML
 the result is a great many possible XML formats, not so good for DTD writing,
 XPathing etc! So we have moved to a fixed version described in
 L<SQL::Translator::Producer::XML::SQLFairy>.
 
-This version of the parser will still parse the old formats and emmit warnings
+This version of the parser will still parse the old formats and emit warnings
 when it sees them being used but they should be considered B<heavily
 depreciated>.
 
index f7994c9..4d26ee4 100644 (file)
@@ -106,7 +106,7 @@ sub produce {
         };
 
         #
-        # Primary key may have a differenct accessor method name
+        # Primary key may have a different accessor method name
         #
 #        if ( my $constraint = $table->primary_key ) {
 #            my $field = ( $constraint->fields )[0];
index 9c7fa96..187bd61 100644 (file)
@@ -22,7 +22,7 @@ SQL::Translator::Producer::DiaUml -
 Currently you will get one class (with the a table
 stereotype) generated per table in the schema. The fields are added as
 attributes of the classes and their datatypes set. It doesn't currently set any
-of the relationships. It doesn't do any layout, all the classses are in one big
+of the relationships. It doesn't do any layout, all the classes are in one big
 stack. However it is still useful as you can use the layout tools in Dia to
 automatically arrange them horizontally or vertically.
 
@@ -64,7 +64,7 @@ Mark Addison E<lt>grommit@users.sourceforge.netE<gt>.
 
 =head1 TODO
 
-* Add the foriegn keys from the schema as UML relations.
+* Add the foreign keys from the schema as UML relations.
 
 * Layout the classes.
 
index c6c9c4d..59529f0 100644 (file)
@@ -113,7 +113,7 @@ constraints)
 
 =item * show_fields (DEFAULT: true)
 
-If set to a true value, the names of the colums in a table will
+If set to a true value, the names of the columns in a table will
 be displayed in each table's node
 
 =item * show_fk_only
index f196ecd..87369c2 100644 (file)
@@ -22,7 +22,7 @@ SQL::Translator::Producer::Latex -
 Currently you will get one class (with the a table
 stereotype) generated per table in the schema. The fields are added as
 attributes of the classes and their datatypes set. It doesn't currently set any
-of the relationships. It doesn't do any layout, all the classses are in one big
+of the relationships. It doesn't do any layout, all the classes are in one big
 stack. However it is still useful as you can use the layout tools in Dia to
 automatically arrange them horizontally or vertically.
 
index 1f8c541..6c06caa 100644 (file)
@@ -69,11 +69,11 @@ compatibility.
 
 =item B<table.mysql_charset>, B<table.mysql_collate>
 
-Set the tables default charater set and collation order.
+Set the tables default character set and collation order.
 
 =item B<field.mysql_charset>, B<field.mysql_collate>
 
-Set the fields charater set and collation order.
+Set the fields character set and collation order.
 
 =back
 
@@ -129,7 +129,7 @@ my %translate  = (
 );
 
 #
-# Column types that do not support lenth attribute
+# Column types that do not support length attribute
 #
 my @no_length_attr = qw/
   date time timestamp datetime year
@@ -213,7 +213,7 @@ sub preprocess_schema {
 
             # Normalize constraint names here.
             my $c_name = $c->name;
-            # Give the constraint a name if it doesn't have one, so it doens't feel
+            # Give the constraint a name if it doesn't have one, so it doesn't feel
             # left out
             $c_name   = $table->name . '_fk' unless length $c_name;
 
@@ -876,7 +876,7 @@ sub batch_alter_table {
   my ($table, $diff_hash, $options) = @_;
 
   # InnoDB has an issue with dropping and re-adding a FK constraint under the
-  # name in a single alter statment, see: http://bugs.mysql.com/bug.php?id=13741
+  # name in a single alter statement, see: http://bugs.mysql.com/bug.php?id=13741
   #
   # We have to work round this.
 
index bcfcb6f..5f898ac 100644 (file)
@@ -831,7 +831,7 @@ sub alter_field
                        $to_field->name)
         if ( !defined $new_default && defined $old_default );
 
-    # add geometry column and contraints
+    # add geometry column and constraints
     push @out, add_geometry_column($to_field) if is_geometry($to_field);
     push @out, add_geometry_constraints($to_field) if is_geometry($to_field);
 
index 2cccce2..103c2de 100644 (file)
@@ -464,7 +464,7 @@ sub batch_alter_table {
   my %temp_table_fields;
   do {
     local $table->{name} = $table_name . '_temp_alter';
-    # We only want the table - dont care about indexes on tmp table
+    # We only want the table - don't care about indexes on tmp table
     my ($table_sql) = create_table($table, {no_comments => 1, temporary_table => 1});
     push @sql,$table_sql;
 
index 9c86f86..8155ff5 100644 (file)
@@ -205,7 +205,7 @@ The template to use, return a file name or a scalar ref of TT
 source, or an L<IO::Handle>. See L<Template> for details, as the return from
 this is passed on to it's C<produce> method.
 
-The default implimentation uses the producer arg C<ttfile> as a filename to read
+The default implementation uses the producer arg C<ttfile> as a filename to read
 the template from. If the arg isn't there it will look for a C<__DATA__> section
 in the class, reading it as template source if found. Returns undef if both
 these fail, causing the produce call to fail with a 'no template!' error.
@@ -220,7 +220,7 @@ by default, but see L<tt_default_vars> for the variables you get for free.
 =head2 tt_default_vars
 
 Return a hash-ref of the default vars given to the template.
-You wouldn't normally over-ride this, just inherit the default implimentation,
+You wouldn't normally over-ride this, just inherit the default implementation,
 to get the C<translator> & C<schema> variables, then over-ride L<tt_vars> to add
 your own.
 
@@ -243,7 +243,7 @@ The L<SQL::Translator> object.
 WARNING: This method is Experimental so may change!
 
 Called with the L<SQL::Translator::Schema> object and should return one (it
-doesn't have to be the same one) that will become the C<schema> varibale used
+doesn't have to be the same one) that will become the C<schema> variable used
 in the template.
 
 Gets called from tt_default_vars.
@@ -266,7 +266,7 @@ Return the L<SQL::Translator> object.
 
 =head2 schema
 
-Return the L<SQL::Translator::Schema> we are translating. This is equivilent
+Return the L<SQL::Translator::Schema> we are translating. This is equivalent
 to C<< $tt_producer->translator->schema >>.
 
 =head2 run
@@ -277,7 +277,7 @@ produced text.
 =head2 args
 
 Util wrapper method around C<< TT::Base->translator->producer_args >> for
-(mostley) readonly access to the producer args. How it works depends on the
+(mostly) readonly access to the producer args. How it works depends on the
 number of arguments you give it and the context.
 
  No args - Return hashref (the actual hash in Translator) or hash of args.
index 9b952da..1b9ec68 100644 (file)
@@ -65,7 +65,7 @@ Here's a brief example of what the template could look like:
 
 See F<t/data/template/table.tt> for a more complete example.
 
-You can also set any of the options used to initiallize the Template
+You can also set any of the options used to initialize the Template
 object by adding them to your producer_args. See Template Toolkit docs
 for details of the options.
 
@@ -82,7 +82,7 @@ If you set C<mk_files> and its additional options the producer will
 write a separate file for each table in the schema. This is useful for
 producing things like HTML documentation where every table gets its
 own page (you could also use TTSchema producer to add an index page).
-Its also particulary good for code generation where you want to
+Its also particularly good for code generation where you want to
 produce a class file per table.
 
 =head1 OPTIONS
@@ -123,12 +123,12 @@ where we want to write our output. One of "skip", "die", "replace",
 B<replace> - Over-write the existing file with the new one, clobbering
 anything already there.
 
-B<skip> - Leave the origional file as it was and don't write the new
+B<skip> - Leave the original file as it was and don't write the new
 version anywhere.
 
 B<die> - Die with an existing file error.
 
-B<insert> - Insert the generated output into the file bewteen a set of
+B<insert> - Insert the generated output into the file between a set of
 special comments (defined by the following options.) Any code between
 the comments will be overwritten (ie the results from a previous
 produce) but the rest of the file is left alone (your custom code).
@@ -246,7 +246,7 @@ sub write_file {
         }
     }
 
-    my ($dir) = $file =~ m!^(.*)/!; # Want greedy, eveything before the last /
+    my ($dir) = $file =~ m!^(.*)/!; # Want greedy, everything before the last /
    if ( $dir and not -d $dir and $pargs->{mk_file_dir} ) { mkpath($dir); }
 
     debug "Writing to $file\n";
@@ -263,7 +263,7 @@ sub insert_code {
     my $cstart = $pargs->{insert_comment_start} || "SQLF_INSERT_START";
     my $cend   = $pargs->{insert_comment_end}   || "SQLF_INSERT_END";
 
-    # Slurp in the origional file
+    # Slurp in the original file
     open ( FILE, "<", "$file") or die "Error opening file $file : $!\n";
     local $/ = undef;
     my $orig = <FILE>;
@@ -290,7 +290,7 @@ Mark Addison E<lt>grommit@users.sourceforge.netE<gt>.
 =head1 TODO
 
 - Some tests for the various on exists options (they have been tested
-implicitley through use in a project but need some proper tests).
+implicitly through use in a project but need some proper tests).
 
 - More docs on code generation strategies.
 
index 45bbd6d..3b01147 100644 (file)
@@ -57,7 +57,7 @@ See F<t/data/template/basic.tt> for a more complete example.
 The template will also get the set of extra variables given as a hashref via the
 C<tt_vars> producer arg.
 
-You can set any of the options used to initiallize the Template object by
+You can set any of the options used to initialize the Template object by
 adding a tt_conf producer_arg. See Template Toolkit docs for details of
 the options.
 (Note that the old style of passing this config directly in the producer args
index ff7151b..584690f 100644 (file)
@@ -10,7 +10,7 @@ SQL::Translator::Producer::XML - Alias to XML::SQLFairy producer
 
 Previous versions of SQL::Translator included an XML producer, but the
 namespace has since been further subdivided.  Therefore, this module is
-now just just an alias to the XML::SQLFairy producer.
+now just an alias to the XML::SQLFairy producer.
 
 =head1 SEE ALSO
 
index 132d9c3..446b60e 100644 (file)
@@ -126,7 +126,7 @@ Default is 2, set to 0 to turn off indenting.
 
 =head1 LEGACY FORMAT
 
-The previous version of the SQLFairy XML allowed the attributes of the the
+The previous version of the SQLFairy XML allowed the attributes of the
 schema objects to be written as either xml attributes or as data elements, in
 any combination. The old producer could produce attribute only or data element
 only versions. While this allowed for lots of flexibility in writing the XML
@@ -330,7 +330,7 @@ sub xml_obj_children {
 
 #
 # Takes an XML::Writer, Schema::* object and list of method names
-# and writes the obect out as XML. All methods values are written as attributes
+# and writes the object out as XML. All methods values are written as attributes
 # except for the methods listed in @MAP_AS_ELEMENTS which get written as child
 # data elements.
 #
@@ -350,7 +350,7 @@ sub xml_obj {
     my @meths              = @{ $args{'methods'} };
     my $empty_tag          = 0;
 
-    # Use array to ensure consistant (ie not hash) ordering of attribs
+    # Use array to ensure consistent (ie not hash) ordering of attribs
     # The order comes from the meths list passed in.
     my @tags;
     my @attr;
index 1006904..efa5bda 100644 (file)
@@ -655,14 +655,14 @@ sub make_natural_joins {
 
 =head2 make_natural_joins
 
-Creates foriegn key relationships among like-named fields in different
+Creates foreign key relationships among like-named fields in different
 tables.  Accepts the following arguments:
 
 =over 4
 
 =item * join_pk_only
 
-A True or False argument which determins whether or not to perform
+A True or False argument which determines whether or not to perform
 the joins from primary keys to fields of the same name in other tables
 
 =item * skip_fields
index d726aa5..79c1e73 100644 (file)
@@ -80,7 +80,7 @@ around BUILDARGS => sub {
 
 Get or set whether the constraint is deferrable.  If not defined,
 then returns "1."  The argument is evaluated by Perl for True or
-False, so the following are eqivalent:
+False, so the following are equivalent:
 
   $deferrable = $field->deferrable(0);
   $deferrable = $field->deferrable('');
index d8680cb..c918b54 100644 (file)
@@ -43,13 +43,13 @@ use overload
 
 use DBI qw(:sql_types);
 
-# Mapping from string to sql contstant
+# Mapping from string to sql constant
 our %type_mapping = (
   integer => SQL_INTEGER,
   int     => SQL_INTEGER,
 
   smallint => SQL_SMALLINT,
-  bigint => 9999, # DBI doesn't export a constatn for this. Le suck
+  bigint => 9999, # DBI doesn't export a constant for this. Le suck
 
   double => SQL_DOUBLE,
 
@@ -154,7 +154,7 @@ has default_value => ( is => 'rw' );
 
 =head2 extra
 
-Get or set the field's "extra" attibutes (e.g., "ZEROFILL" for MySQL).
+Get or set the field's "extra" attributes (e.g., "ZEROFILL" for MySQL).
 Accepts a hash(ref) of name/value pairs to store;  returns a hash.
 
   $field->extra( qualifier => 'ZEROFILL' );
@@ -258,7 +258,7 @@ sub _build_is_foreign_key {
 
 Get or set whether the field can be null.  If not defined, then
 returns "1" (assumes the field can be null).  The argument is evaluated
-by Perl for True or False, so the following are eqivalent:
+by Perl for True or False, so the following are equivalent:
 
   $is_nullable = $field->is_nullable(0);
   $is_nullable = $field->is_nullable('');
index 1dfd7a1..ff46785 100644 (file)
@@ -25,7 +25,7 @@ use Sub::Quote qw(quote_sub);
 
 =head2 extra
 
-Get or set the objects "extra" attibutes (e.g., "ZEROFILL" for MySQL fields).
+Get or set the objects "extra" attributes (e.g., "ZEROFILL" for MySQL fields).
 Call with no args to get all the extra data.
 Call with a single name arg to get the value of the named extra attribute,
 returned as a scalar. Call with a hash or hashref to set extra attributes.
index 5e69f86..789b9a1 100644 (file)
@@ -741,7 +741,7 @@ add to the fields of an existing PK (and will unique the field names).
 Returns the C<SQL::Translator::Schema::Constraint> object representing
 the primary key.
 
-These are eqivalent:
+These are equivalent:
 
   $table->primary_key('id');
   $table->primary_key(['name']);
index 208139e..f2cdb03 100644 (file)
@@ -17,7 +17,7 @@ SQL::Translator::Types - Type checking functions
 
 =head1 DESCRIPTIONS
 
-This module exports fuctions that return coderefs suitable for L<Moo>
+This module exports functions that return coderefs suitable for L<Moo>
 C<isa> type checks.
 Errors are reported using L<SQL::Translator::Utils/throw>.
 
index a2b0bcf..6caef98 100644 (file)
@@ -600,7 +600,7 @@ does field_ok run? Can then use these to set up the test plan easily.
 
 =item Test skipping
 
-As the test subs wrap up lots of tests in one call you can't skip idividual
+As the test subs wrap up lots of tests in one call you can't skip individual
 tests only whole sets e.g. a whole table or field.
 We could add skip_* items to the test hashes to allow per test skips. e.g.
 
index 61c3ff3..da1a6db 100755 (executable)
@@ -63,7 +63,7 @@ This can prove too permissive, however, as you probably don't want a
 field called "name" to be considered a foreign key, so you could
 include it in the "skip" option, and all fields called "name" will be
 excluded from natural joins.  A more efficient method, however, might
-be to simply deduce the foriegn keys from primary keys to other fields
+be to simply deduce the foreign keys from primary keys to other fields
 named the same in other tables.  Use the "natural-join-pk" option
 to achieve this.
 
index d4a5003..324ccb3 100755 (executable)
@@ -81,9 +81,9 @@ This can prove too permissive, however, as you probably don't want a
 field called "name" to be considered a foreign key, so you could
 include it in the "skip" option, and all fields called "name" will be
 excluded from natural joins.  A more efficient method, however, might
-be to simply deduce the foriegn keys from primary keys to other fields
+be to simply deduce the foreign keys from primary keys to other fields
 named the same in other tables.  Use the "natural-join-pk" option
-to acheive this.
+to achieve this.
 
 If the schema defines foreign keys, then the graph produced will be
 directed showing the direction of the relationship.  If the foreign