Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: commits

[8488] Fuck you, MySQL.

 

 

Bricolage commits RSS feed   Index | Next | Previous | View Threaded


theory at bricolage

Mar 11, 2009, 11:39 AM

Post #1 of 1 (463 views)
Permalink
[8488] Fuck you, MySQL.

Revision: 8488
Author: theory
Date: 2009-03-11 11:39:24 -0700 (Wed, 11 Mar 2009)
ViewCVS: http://viewsvn.bricolage.cc/?rev=8488&view=rev

Log Message:
-----------
Fuck you, MySQL.

Modified Paths:
--------------
bricolage/trunk/lib/Bric/Changes.pod
bricolage/trunk/lib/Bric/Util/DBD/mysql.pm
bricolage/trunk/lib/Bric/Util/DBI.pm
bricolage/trunk/lib/Bric/Util/Event.pm

Modified: bricolage/trunk/lib/Bric/Changes.pod
===================================================================
--- bricolage/trunk/lib/Bric/Changes.pod 2009-03-11 18:16:49 UTC (rev 8487)
+++ bricolage/trunk/lib/Bric/Changes.pod 2009-03-11 18:39:24 UTC (rev 8488)
@@ -297,6 +297,11 @@
The "Related Story" popup now properly closes in Camino when a "relate" or
"un-relate" link is clicked. [David]

+=item *
+
+A call to C<list()> or C<lookup()> in L<Bric::Util::Event|Bric::Util::Event>
+with an "Offset" parameter but no "Limit" now works properly on MySQL. [David]
+
=back

=head1 VERSION 1.11.1 (2008-10-03)

Modified: bricolage/trunk/lib/Bric/Util/DBD/mysql.pm
===================================================================
--- bricolage/trunk/lib/Bric/Util/DBD/mysql.pm 2009-03-11 18:16:49 UTC (rev 8487)
+++ bricolage/trunk/lib/Bric/Util/DBD/mysql.pm 2009-03-11 18:39:24 UTC (rev 8488)
@@ -56,7 +56,7 @@
use constant DBH_ATTR => ( );

# This is the maximum for LIMIT rowcount in MySQL
-use constant LIMIT_DEFAULT => " 18446744073709551615 ";
+use constant LIMIT_DEFAULT => '18446744073709551615';

##############################################################################
# Inheritance

Modified: bricolage/trunk/lib/Bric/Util/DBI.pm
===================================================================
--- bricolage/trunk/lib/Bric/Util/DBI.pm 2009-03-11 18:16:49 UTC (rev 8487)
+++ bricolage/trunk/lib/Bric/Util/DBI.pm 2009-03-11 18:39:24 UTC (rev 8488)
@@ -814,7 +814,7 @@
$order\n};

# LIMIT OFFSET compatibility measure for MySQL
- $limit = LIMIT_DEFAULT if $offset and !$limit;
+ $limit = LIMIT_DEFAULT if DBD_TYPE eq 'mysql' and $offset and !$limit;
$sql .= qq{ LIMIT $limit\n} if $limit && $limit =~ /^\d+$/;
$sql .= qq{ OFFSET $offset\n} if $offset && $offset =~ /^\d+$/;
return \$sql;

Modified: bricolage/trunk/lib/Bric/Util/Event.pm
===================================================================
--- bricolage/trunk/lib/Bric/Util/Event.pm 2009-03-11 18:16:49 UTC (rev 8487)
+++ bricolage/trunk/lib/Bric/Util/Event.pm 2009-03-11 18:39:24 UTC (rev 8488)
@@ -1415,6 +1415,11 @@
}
my $offset = '';
if (exists $params->{Offset}) {
+ if (DBD_TYPE eq 'mysql' && !$limit) {
+ # Fuck you, MySQL.
+ push @limits, LIMIT_DEFAULT;
+ $limit = 'LIMIT ?';
+ }
push @limits, delete $params->{Offset};
$offset = 'OFFSET ?';
}

Bricolage commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.