diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-09-16 17:41:34 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-09-16 17:41:34 -0400 |
commit | 809c4a9d31421b224c9479747a3cbe0955f01223 (patch) | |
tree | 8ac629be8b692b3a81ff567b71f4a8a25e2a5ae6 | |
parent | b57182a8efd306ea0e8891785412990fbc256c36 (diff) |
rationalize with ciarang's pgsql changes
darcs-hash:20080916214134-84dde-ba11f44676d876cf0f29773c60fa95676ad07ebd.gz
-rw-r--r-- | classes/User.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/classes/User.php b/classes/User.php index cef4769f3..65e01e799 100644 --- a/classes/User.php +++ b/classes/User.php @@ -150,13 +150,18 @@ class User extends DB_DataObject function noticesWithFriends($offset=0, $limit=20) { $notice = new Notice(); - - $notice->query('SELECT notice.* ' . - 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' . - 'WHERE subscription.subscriber = ' . $this->id . ' ' . - 'ORDER BY created DESC, notice.id DESC ' . - 'LIMIT ' . $offset . ', ' . $limit); - + + $query='SELECT notice.* ' . + 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' . + 'WHERE subscription.subscriber = ' . $this->id . ' ' . + 'ORDER BY created DESC, notice.id DESC '; + if(common_config('db','type')=='pgsql') { + $query=$query . 'LIMIT ' . $limit . ' OFFSET ' . $offset; + } else { + $query=$query . 'LIMIT ' . $offset . ', ' . $limit; + } + $notice->query($query); + return $notice; } |