rationalize with ciarang's pgsql changes

darcs-hash:20080916214134-84dde-ba11f44676d876cf0f29773c60fa95676ad07ebd.gz
This commit is contained in:
Evan Prodromou 2008-09-16 17:41:34 -04:00
parent b57182a8ef
commit 809c4a9d31

View File

@ -150,13 +150,18 @@ class User extends DB_DataObject
function noticesWithFriends($offset=0, $limit=20) { function noticesWithFriends($offset=0, $limit=20) {
$notice = new Notice(); $notice = new Notice();
$notice->query('SELECT notice.* ' . $query='SELECT notice.* ' .
'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' . 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' .
'WHERE subscription.subscriber = ' . $this->id . ' ' . 'WHERE subscription.subscriber = ' . $this->id . ' ' .
'ORDER BY created DESC, notice.id DESC ' . 'ORDER BY created DESC, notice.id DESC ';
'LIMIT ' . $offset . ', ' . $limit); if(common_config('db','type')=='pgsql') {
$query=$query . 'LIMIT ' . $limit . ' OFFSET ' . $offset;
} else {
$query=$query . 'LIMIT ' . $offset . ', ' . $limit;
}
$notice->query($query);
return $notice; return $notice;
} }