PostgreSQL - some more fixes to make queries compatible with both databases. (submitted by oxygene)
This commit is contained in:
parent
a5f1124830
commit
2133d5a4e7
@ -79,7 +79,7 @@ class PostnoticeAction extends Action
|
|||||||
}
|
}
|
||||||
$notice = Notice::staticGet('uri', $notice_uri);
|
$notice = Notice::staticGet('uri', $notice_uri);
|
||||||
if (!$notice) {
|
if (!$notice) {
|
||||||
$notice = Notice::saveNew($remote_profile->id, $content, 'omb', false, 0, $notice_uri);
|
$notice = Notice::saveNew($remote_profile->id, $content, 'omb', false, null, $notice_uri);
|
||||||
if (is_string($notice)) {
|
if (is_string($notice)) {
|
||||||
common_server_serror($notice, 500);
|
common_server_serror($notice, 500);
|
||||||
return false;
|
return false;
|
||||||
|
@ -186,12 +186,12 @@ class TwittersettingsAction extends ConnectSettingsAction
|
|||||||
|
|
||||||
$current_user = common_current_user();
|
$current_user = common_current_user();
|
||||||
|
|
||||||
$qry = 'SELECT user.* ' .
|
$qry = 'SELECT "user".* ' .
|
||||||
'FROM subscription ' .
|
'FROM subscription ' .
|
||||||
'JOIN user ON subscription.subscribed = user.id ' .
|
'JOIN "user" ON subscription.subscribed = "user".id ' .
|
||||||
'JOIN foreign_link ON foreign_link.user_id = user.id ' .
|
'JOIN foreign_link ON foreign_link.user_id = "user".id ' .
|
||||||
'WHERE subscriber = %d ' .
|
'WHERE subscriber = %d ' .
|
||||||
'ORDER BY user.nickname';
|
'ORDER BY "user".nickname';
|
||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
|
|
||||||
|
@ -410,8 +410,8 @@ function jabber_broadcast_notice($notice)
|
|||||||
"ON $UT.id = notice_inbox.user_id " .
|
"ON $UT.id = notice_inbox.user_id " .
|
||||||
'WHERE notice_inbox.notice_id = ' . $notice->id . ' ' .
|
'WHERE notice_inbox.notice_id = ' . $notice->id . ' ' .
|
||||||
'AND notice_inbox.source = 2 ' .
|
'AND notice_inbox.source = 2 ' .
|
||||||
'AND user.jabber is not null ' .
|
"AND $UT.jabber is not null " .
|
||||||
'AND user.jabbernotify = 1 ');
|
"AND $UT.jabbernotify = 1 ");
|
||||||
|
|
||||||
while ($user->fetch()) {
|
while ($user->fetch()) {
|
||||||
if (!array_key_exists($user->id, $sent_to)) {
|
if (!array_key_exists($user->id, $sent_to)) {
|
||||||
|
@ -688,7 +688,7 @@ function common_relative_profile($sender, $nickname, $dt=null)
|
|||||||
$recipient = new Profile();
|
$recipient = new Profile();
|
||||||
// XXX: use a join instead of a subquery
|
// XXX: use a join instead of a subquery
|
||||||
$recipient->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$sender->id.' and subscribed = id)', 'AND');
|
$recipient->whereAdd('EXISTS (SELECT subscribed from subscription where subscriber = '.$sender->id.' and subscribed = id)', 'AND');
|
||||||
$recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND');
|
$recipient->whereAdd("nickname = '" . trim($nickname) . "'", 'AND');
|
||||||
if ($recipient->find(true)) {
|
if ($recipient->find(true)) {
|
||||||
// XXX: should probably differentiate between profiles with
|
// XXX: should probably differentiate between profiles with
|
||||||
// the same name by date of most recent update
|
// the same name by date of most recent update
|
||||||
@ -698,7 +698,7 @@ function common_relative_profile($sender, $nickname, $dt=null)
|
|||||||
$recipient = new Profile();
|
$recipient = new Profile();
|
||||||
// XXX: use a join instead of a subquery
|
// XXX: use a join instead of a subquery
|
||||||
$recipient->whereAdd('EXISTS (SELECT subscriber from subscription where subscribed = '.$sender->id.' and subscriber = id)', 'AND');
|
$recipient->whereAdd('EXISTS (SELECT subscriber from subscription where subscribed = '.$sender->id.' and subscriber = id)', 'AND');
|
||||||
$recipient->whereAdd('nickname = "' . trim($nickname) . '"', 'AND');
|
$recipient->whereAdd("nickname = '" . trim($nickname) . "'", 'AND');
|
||||||
if ($recipient->find(true)) {
|
if ($recipient->find(true)) {
|
||||||
// XXX: should probably differentiate between profiles with
|
// XXX: should probably differentiate between profiles with
|
||||||
// the same name by date of most recent update
|
// the same name by date of most recent update
|
||||||
|
Loading…
Reference in New Issue
Block a user