query has no results in plugin, has results in sqlite clients

9 views
Skip to first unread message

Emiliano Heyns

unread,
Oct 17, 2021, 4:50:24 PM10/17/21
to zotero-dev
I'm trying to find all collections that have a (direct) attachment named "asreview.csv" using this query:

  SELECT ci.collectionID, MAX(i.itemID) as itemID
  FROM items i
  JOIN itemAttachments ia ON i.itemID = ia.itemID AND ia.parentItemID IS NULL
  JOIN itemData id ON i.itemID = i.itemID
  JOIN itemDataValues idv ON idv.valueID = id.valueID AND idv.value = 'asreview.csv'
  JOIN fields f on f.fieldID = id.fieldID AND f.fieldName = 'title'
  JOIN collectionItems ci ON i.itemID = ci.itemID
  GROUP BY ci.collectionID

If I run this query on zotero.sqlite using the sqlite3 client, I'm getting one result as I expected, but when I run the same query in my plugin, I'm getting `undefined` (and not an empty array BTW) from Zotero.DB.queryAsync. I can see Zotero is running the query, and it's ran after Zotero.Schema.schemaUpdatePromise clears. Any pointers? The DB is at https://gist.github.com/28460e68156b89b82e6cc00e1792adde should it be needed.
Reply all
Reply to author
Forward
0 new messages