Use dba_driver.php::db_getfunc()

This commit is contained in:
DM42.Net (Matt Dent) 2019-01-11 07:35:12 -05:00
parent 6791b05a40
commit caf2c0a6c4

View File

@ -12,16 +12,6 @@ class Queue {
require_once('include/items.php'); require_once('include/items.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
switch (DBTYPE_ACTIVE) {
case DBTYPE_MYSQL:
$sqlrandfunc = "RAND()";
break;
case DBTYPE_POSTGRESQL:
$sqlrandfunc = "RANDOM()";
break;
}
if($argc > 1) if($argc > 1)
$queue_id = $argv[1]; $queue_id = $argv[1];
else else
@ -71,6 +61,8 @@ class Queue {
// the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once // the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once
// or twice a day. // or twice a day.
$sqlrandfunc = db_getfunc('rand');
$r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1", $r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
db_utcnow() db_utcnow()
); );