getSubscribers and getSubscriptions were not handling the case where limit=null correctly

This commit is contained in:
Craig Andrews 2009-11-16 00:19:19 -05:00
parent b843ea6c4a
commit 6470ccd1b8

View File

@ -310,11 +310,13 @@ class Profile extends Memcached_DataObject
'AND subscription.subscribed != subscription.subscriber ' . 'AND subscription.subscribed != subscription.subscriber ' .
'ORDER BY subscription.created DESC '; 'ORDER BY subscription.created DESC ';
if ($offset>0 && !is_null($limit)){
if (common_config('db','type') == 'pgsql') { if (common_config('db','type') == 'pgsql') {
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
} else { } else {
$qry .= ' LIMIT ' . $offset . ', ' . $limit; $qry .= ' LIMIT ' . $offset . ', ' . $limit;
} }
}
$profile = new Profile(); $profile = new Profile();
@ -333,6 +335,7 @@ class Profile extends Memcached_DataObject
'AND subscription.subscribed != subscription.subscriber ' . 'AND subscription.subscribed != subscription.subscriber ' .
'ORDER BY subscription.created DESC '; 'ORDER BY subscription.created DESC ';
if ($offset>0 && !is_null($limit)){
if ($offset) { if ($offset) {
if (common_config('db','type') == 'pgsql') { if (common_config('db','type') == 'pgsql') {
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
@ -340,6 +343,7 @@ class Profile extends Memcached_DataObject
$qry .= ' LIMIT ' . $offset . ', ' . $limit; $qry .= ' LIMIT ' . $offset . ', ' . $limit;
} }
} }
}
$profile = new Profile(); $profile = new Profile();