Forum .LRN Q&A: Attachments problem and fix

Collapse
Posted by Deds Castillo on
The current CVS checkout of attachments contains a query file named www/index.xql. The problem arises when you have several attachments for a single object. The page will barf with a "query returned too many rows". Fix would be to choose the appropriate attachment on query. So we change:

select live_revision from cr_items, attachments where cr_items.item_id = attachments.item_id and attachments.object_id = :object_id

to:

select live_revision from cr_items, attachments where cr_items.item_id = attachments.item_id and attachments.object_id = :object_id and attachments.item_id = :attachment_id

Collapse
Posted by Don Baccus on
Looks like a good catch and the correct fix, good job!
Collapse
Posted by Arjun Sanyal on
deds: patch applied. thank you!