From: Rafael Kitover Date: Mon, 10 May 2010 18:59:21 +0000 (-0400) Subject: fix operator precedence X-Git-Tag: 0.07000~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=268cc2469d1405a421e64ff487c0f18d7d8ba9a1;p=dbsrgits%2FDBIx-Class-Schema-Loader.git fix operator precedence --- diff --git a/Changes b/Changes index 6e09f58..474cc95 100644 --- a/Changes +++ b/Changes @@ -6,9 +6,10 @@ Revision history for Perl extension DBIx::Class::Schema::Loader - better type info for Oracle - preliminary Informix support - unregister dropped sources on rescan - - added 'preserve_case' option with support for SQLite, mysql, MSSQL and - Firebird/InterBase; removed the MSSQL 'case_sensitive_collation' and - the Firebird/InterBase 'unquoted_ddl' options in favor of it. + - added 'preserve_case' option with support for SQLite, mysql, MSSQL, + SQLAnywhere and Firebird/InterBase; removed the MSSQL + 'case_sensitive_collation' and the Firebird/InterBase 'unquoted_ddl' + options in favor of it. - support CamelCase table names and column names (in case-preserving mode) at the v7 naming level - rewrite datetime default functions as \'CURRENT_TIMESTAMP' where diff --git a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm index ed69925..0be5f1a 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm @@ -130,7 +130,7 @@ sub _columns_info_for { $info->{is_auto_increment} = 1; } - if (eval { lc ${ $info->{default_value} } }||'' eq 'current timestamp') { + if ((eval { lc ${ $info->{default_value} } }||'') eq 'current timestamp') { ${ $info->{default_value} } = 'current_timestamp'; delete $info->{size}; } diff --git a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm index 1b9ce7d..ee6d18a 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm @@ -276,7 +276,7 @@ wHERE table_name = @{[ $dbh->quote($table) ]} AND column_name = @{[ $dbh->quote( $default =~ /^['(] (.*) [)']\z/x ? $1 : $default =~ /^\d/ ? $default : \$default; - if (eval { lc ${ $info->{default_value} } }||'' eq 'getdate()') { + if ((eval { lc ${ $info->{default_value} } }||'') eq 'getdate()') { ${ $info->{default_value} } = 'current_timestamp'; } } diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index 59c34f1..1bfb32b 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -231,7 +231,7 @@ AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIK $info->{original}{data_type} = 'binary_double'; } - if (eval { lc(${ $info->{default_value} }) eq 'sysdate' }) { + if ((eval { lc(${ $info->{default_value} }) }||'') eq 'sysdate') { $info->{original}{default_value} = $info->{default_value}; my $current_timestamp = 'current_timestamp'; diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm index 5547653..0ed3070 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm @@ -228,7 +228,7 @@ EOF } # alias now() to current_timestamp for deploying to other DBs - if (eval { lc ${ $info->{default_value} }||'' eq 'now()' }) { + if ((eval { lc ${ $info->{default_value} }||'') eq 'now()' }) { # do not use a ref to a constant, that breaks Data::Dump output ${$info->{default_value}} = 'current_timestamp'; } diff --git a/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm b/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm index fb73578..00fa615 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm @@ -105,7 +105,7 @@ EOF delete $info->{default_value} if ref($info->{default_value}) eq 'SCALAR' && ${ $info->{default_value} } eq 'NULL'; - if (eval { lc ${ $info->{default_value} } }||'' eq 'current timestamp') { + if ((eval { lc ${ $info->{default_value} } }||'') eq 'current timestamp') { ${ $info->{default_value} } = 'current_timestamp'; } } diff --git a/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm b/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm index af8c3a0..57b5202 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm @@ -82,7 +82,7 @@ sub _columns_info_for { } while (my ($col, $info) = each %$result) { - if (eval { ${ $info->{default_value} } }||'' eq 'CURRENT_TIMESTAMP') { + if ((eval { ${ $info->{default_value} } }||'') eq 'CURRENT_TIMESTAMP') { ${ $info->{default_value} } = 'current_timestamp'; } }