SELECT * FROM `oc_share` WHERE ( ( `item_type` = ? ) OR ( `item_type` = ? ) ) AND ( ( `share_type` = ? ) OR ( `share_type` = ? ) OR ( `share_type` = ? ) ) AND ( ( `uid_owner` = ? ) OR ( `uid_initiator` = ? ) ) AND ( `file_source` IN (...) ) ORDER BY `id` ASC