return array();
}
- $sql .= ' ORDER BY image_uploaded_date DESC LIMIT ' . (int)$limit;
+ $sql .= ' ORDER BY image_uploaded_date DESC';
+ if ($limit > 0) {
+ $GLOBALS['ansel_db']->setLimit((int)$limit);
+ }
$query = $this->_db->prepare($sql);
if ($query instanceof PEAR_Error) {
throw new Ansel_Exception($query);
}
$sql .= 'GROUP BY tn.tag_id, tag_name ORDER BY total DESC';
if ($limit > 0) {
- $sql .= ' LIMIT ' . (int)$limit;
+ $GLOBALS['ansel_db']->setLimit((int)$limit);
}
+
$results = $GLOBALS['ansel_db']->queryAll($sql, null, MDB2_FETCHMODE_ASSOC, true);
foreach ($results as $id => $taginfo) {
$results[$id]['tag_name'] = Horde_String::convertCharset(
WHERE tags.tag IN ($tagList)
GROUP BY matches.object_id
HAVING num_common_tags >= $threshold
- ORDER BY num_common_tags DESC
- LIMIT 0, $max_objects
- ";
+ ORDER BY num_common_tags DESC";
- $rs = $db->Execute($sql) or die("Syntax Error: $sql, Error: " . $db->ErrorMsg());
+ $this->_db->addLimitOffset($sql, array('limit' => $max_objects));
+ $rs = $this->_db->Execute($sql) or die("Syntax Error: $sql, Error: " . $this->_db->ErrorMsg());
while (!$rs->EOF) {
$retarr[] = array (
'object_id' => $rs->fields['object_id'],
$rs->MoveNext();
}
- return $retarra;
+ return $retarr;
}
/**
implode(', ', $filter));
}
- $query = sprintf('SELECT sentmail_recipient, count(*) AS sentmail_count FROM %s WHERE sentmail_who = %s AND sentmail_success = 1%s GROUP BY sentmail_recipient ORDER BY sentmail_count DESC LIMIT %d',
+ $query = sprintf('SELECT sentmail_recipient, count(*) AS sentmail_count FROM %s WHERE sentmail_who = %s AND sentmail_success = 1%s GROUP BY sentmail_recipient ORDER BY sentmail_count DESC',
$this->_params['table'],
$this->_db->quote($GLOBALS['registry']->getAuth()),
- $where,
- $limit);
+ $where);
/* Execute the query. */
try {
+ $this->_db->addLimitOffset($sql, array('limit' => $limit));
return $this->_db->selectValues($query);
} catch (Horde_Db_Exception $e) {
throw new IMP_Exception($e);
. $this->prefix . ' AS n WHERE l.lang = ? AND n.id = l.id AND n.status = ? ORDER BY n.publish DESC LIMIT 0, '
. ($minimize ? '100' : '500');
- $result = $this->db->query($sql, array($GLOBALS['registry']->preferredLang(), News::CONFIRMED));
+ $result = $this->db->limitQuery($sql, 0, ($minimize ? '100' : '500'), array($GLOBALS['registry']->preferredLang(), News::CONFIRMED));
if ($result instanceof PEAR_Error) {
return $result;
}