From: Peter Rabbitson Date: Wed, 2 Jun 2010 09:55:48 +0000 (+0000) Subject: Do not use 2**32 directly - causes %u differences between 32 and 64bit X-Git-Tag: v0.08122~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e9657379908899b73ff92948a4cd19b6f875e10f;p=dbsrgits%2FDBIx-Class.git Do not use 2**32 directly - causes %u differences between 32 and 64bit --- diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index e6df357..500ce54 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -33,6 +33,9 @@ BEGIN { } } +# the "oh noes offset/top without limit" constant +sub __max_int { 0xFFFFFFFF }; + # Tries to determine limit dialect. # diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 1eec464..17cb769 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1937,7 +1937,7 @@ sub _select_args { } elsif (defined $attrs->{offset}) { # MySQL actually recommends this approach. I cringe. - $attrs->{rows} = 2**32; + $attrs->{rows} = $sql_maker->__max_int; } my @limit; diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index 13ea644..3c6e911 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -162,7 +162,7 @@ sub _select_args_to_query { $self->throw_exception( 'An ordered subselect encountered - this is not safe! Please see "Ordered Subselects" in DBIx::Class::Storage::DBI::MSSQL ') unless $attrs->{unsafe_subselect_ok}; - my $max = 2 ** 32; + my $max = $self->sql_maker->__max_int; $sql =~ s/^ \s* SELECT \s/SELECT TOP $max /xi; }