SQL bug in serendipity_event_entrypaging

Found a bug? Tell us!!
Post Reply
ads
Regular
Posts: 93
Joined: Sun Oct 29, 2006 11:39 am

SQL bug in serendipity_event_entrypaging

Post by ads »

The plugin "serendipity_event_entrypaging" contains a small glitch:

Code: Select all

                $querystring = "SELECT
                                    e.id, e.title, e.timestamp
                                FROM
                                    {$serendipity['dbPrefix']}entries e
                                WHERE
                                    {$cond['compare2']}
                                ORDER BY RAND()
                                LIMIT  1";
The "RAND()" must be "RANDOM()" for databases other than MySQL.

In plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php is a bugfix available:

Code: Select all

            if ($db ==  'mysql' || $db == 'mysqli') {
                $sql_order = "ORDER BY RAND()";
            } else {
                // SQLite and PostgreSQL support this, hooray.
                $sql_order = "ORDER BY RANDOM()";
            }
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: SQL bug in serendipity_event_entrypaging

Post by garvinhicking »

Hi!

Thanks a lot, fix committed.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply