Add missing quote function to SQLServer producer
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Generator / DDL / SQLServer.pm
index 7d82eef..2141999 100644 (file)
@@ -1,7 +1,17 @@
 package SQL::Translator::Generator::DDL::SQLServer;
 
+=head1 NAME
+
+SQL::Translator::Generator::DDL::SQLServer - A Moo based MS SQL Server DDL
+generation engine.
+
+=head1 DESCRIPTION
+
+I<documentation volunteers needed>
+
+=cut
+
 use Moo;
-use SQL::Translator::Generator::Utils;
 use SQL::Translator::Schema::Constants;
 
 with 'SQL::Translator::Generator::Role::Quote';
@@ -29,11 +39,6 @@ sub _build_type_map {
    }
 }
 
-has sizeless_types => (
-   is => 'ro',
-   builder => '_build_sizeless_types',
-);
-
 sub _build_sizeless_types {
    +{ map { $_ => 1 }
          qw( tinyint smallint int integer bigint text bit image datetime ) }
@@ -48,15 +53,6 @@ sub field {
       $self->field_default($field),
 }
 
-sub field_type_size {
-   my ($self, $field) = @_;
-
-   ($field->size && !$self->sizeless_types->{$field->data_type}
-      ? '(' . $field->size . ')'
-      : ''
-   )
-}
-
 sub field_autoinc { ( $_[1]->is_auto_increment ? 'IDENTITY' : () ) }
 
 sub primary_key_constraint {
@@ -93,7 +89,7 @@ sub unique_constraint_multiple {
   'CREATE UNIQUE NONCLUSTERED INDEX ' .
    $self->unique_constraint_name($constraint) .
    ' ON ' . $self->quote($constraint->table->name) . ' (' .
-   join( ', ', $constraint->fields ) . ')' .
+   join( ', ', map $self->quote($_), $constraint->fields ) . ')' .
    ' WHERE ' . join( ' AND ',
     map $self->quote($_->name) . ' IS NOT NULL',
     grep { $_->is_nullable } $constraint->fields ) . ';'
@@ -245,3 +241,18 @@ sub schema {
 
 1;
 
+=head1 AUTHORS
+
+See the included AUTHORS file:
+L<http://search.cpan.org/dist/SQL-Translator/AUTHORS>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2012 the SQL::Translator L</AUTHORS> as listed above.
+
+=head1 LICENSE
+
+This code is free software and may be distributed under the same terms as Perl
+itself.
+
+=cut