package SQL::Translator::Producer::SQLServer;
# -------------------------------------------------------------------
-# $Id: SQLServer.pm,v 1.6 2007-01-15 19:18:45 duality72 Exp $
+# $Id$
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $WARN $VERSION ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/;
$DEBUG = 1 unless defined $DEBUG;
use Data::Dumper;
my $list = $extra{'list'} || [];
# \todo deal with embedded quotes
my $commalist = join( ', ', map { qq['$_'] } @$list );
- my $seq_name;
if ( $data_type eq 'enum' ) {
my $check_name = mk_name(
#
my $default = $field->default_value;
if ( defined $default ) {
- $field_def .= sprintf( ' DEFAULT %s',
- ( $field->is_auto_increment && $seq_name )
- ? qq[nextval('"$seq_name"'::text)] :
- ( $default =~ m/null/i ) ? 'NULL' : "'$default'"
+ SQL::Translator::Producer->_apply_default_value(
+ \$field_def,
+ $default,
+ [
+ 'NULL' => \'NULL',
+ ],
);
}
-
+
push @field_defs, $field_def;
}
$output .= "--\n-- View: $name\n--\n\n" unless $no_comments;
my $text = $_->sql();
$text =~ s/\r//g;
- $output .= $text;
+ $output .= "$text\nGO\n";
}
# Text of procedure already has the 'create procedure' stuff
$output .= "--\n-- Procedure: $name\n--\n\n" unless $no_comments;
my $text = $_->sql();
$text =~ s/\r//g;
- $output .= $text;
+ $output .= "$text\nGO\n";
}
# Warn out how we messed with the names.