FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » fud30_group_cache table, shouldn't it be a view?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: fud30_group_cache table, shouldn't it be a view? [message #167347 is a reply to message #167262] Sat, 09 June 2012 10:03 Go to previous messageGo to previous message
NeXuS is currently offline  NeXuS
Messages: 121
Registered: July 2010
Location: South Korea
Karma:
Senior Member
Contributing Core Developer
I am about to patch the source tree, I would just have a few other heads check my view formulation

-- GROUP LEADERS 
SELECT gm.user_id, gr.resource_id, gm.group_id, 
    BIT_OR( gm.group_members_opt ) AS group_cache_opts
  FROM fud30_group_members gm 
  INNER JOIN fud30_group_resources gr
    ON gr.group_id=gm.group_id
  WHERE ( gm.group_members_opt>=65536 )
    AND ( gm.group_members_opt & 65536 ) > 0
    AND ( gm.group_members_opt & 131072 )
  GROUP BY user_id, resource_id, group_id
UNION
-- GROUP MEMBERS 
SELECT gm.user_id, gr.resource_id, gr.group_id, 
    BIT_AND( gm.group_members_opt ) AS group_cache_opts
  FROM fud30_group_members AS gm    
  INNER JOIN fud30_group_resources AS gr
    ON gr.group_id=gm.group_id
  WHERE ( gm.group_members_opt>=65536 )
    AND ( gm.group_members_opt & 65536 ) > 0
  GROUP BY user_id, resource_id, group_id;


By the way, the result generated by the statement above is different from fud30_group_cache: in fud30_group_cache, group_id is always 0, here it is set properly. I am not sure this is the correct behaviour, though, since the key of the caching seems to be (user_id, resource_id) independently of the group_id.

P.S. I am pretty sure this works for MySQL, but the syntax might need to be changed for other engines

[Updated on: Sat, 09 June 2012 10:10]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: upgrade.php and q_bitand()
Next Topic: Backup bug
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 14:52:34 GMT 2024

Total time taken to generate the page: 0.04546 seconds