From: Rafael Kitover Date: Tue, 24 Nov 2009 13:11:02 +0000 (+0000) Subject: handle un-parenthesized default numeric/integer values for some versions of MSSQL... X-Git-Tag: 0.04999_11~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8823ddfc60cd173fa8c0bd7be9810321b4c125eb;p=dbsrgits%2FDBIx-Class-Schema-Loader.git handle un-parenthesized default numeric/integer values for some versions of MSSQL as well --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm index fc93a1c..72a0d27 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm @@ -143,10 +143,11 @@ sub _extra_column_info { # strip parens $default =~ s/^\( (.*) \)\z/$1/x; - # Literal strings are in ''s, numbers are in ()s, everything else is a - # function. + # Literal strings are in ''s, numbers are in ()s (in some versions of + # MSSQL, in others they are unquoted) everything else is a function. $extra_info{default_value} = - $default =~ /^['(] (.*) [)']\z/x ? $1 : \$default; + $default =~ /^['(] (.*) [)']\z/x ? $1 : + $default =~ /^\d/ ? $default : \$default; } return \%extra_info;