Can't vardump the results of Zotero.DB.queryAsync

已查看 6 次
跳至第一个未读帖子

Emiliano Heyns

未读,
2017年8月3日 08:30:222017/8/3
收件人 zotero-dev
When try to call Zotero.Utilities.varDump on a row from Zotero.DB.queryAsync, I get

zotero(1)(+0000009): TypeError: can't convert symbol to string

    get@chrome://zotero/content/xpcom/db.js:671:14
    varDump@chrome://zotero/content/xpcom/utilities.js:1419:17

Dan Stillman

未读,
2017年8月3日 12:07:322017/8/3
收件人 zoter...@googlegroups.com
Yeah, that doesn't work anymore, unfortunately. It's a limitation of
Mozilla's asynchronous SQLite APIs. It's possible it could be made to
show values by numerical index, but if I recall correctly, getting the
column names of the result set to display a proper object wasn't
possible anymore — they have to be explicitly requested, because we just
end up with a mozIStorageRow [1] now.


[1]
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/MozIStorageRow

Emiliano Heyns

未读,
2017年8月3日 12:53:002017/8/3
收件人 zoter...@googlegroups.com
Can I detect in code I have one of these? 

--
You received this message because you are subscribed to a topic in the Google Groups "zotero-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/zotero-dev/2ULr5hbLkx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to zotero-dev+unsubscribe@googlegroups.com.
To post to this group, send email to zoter...@googlegroups.com.
Visit this group at https://groups.google.com/group/zotero-dev.
For more options, visit https://groups.google.com/d/optout.

Dan Stillman

未读,
2017年8月3日 15:46:452017/8/3
收件人 zoter...@googlegroups.com
On 8/3/17 6:52 PM, Emiliano Heyns wrote:
Can I detect in code I have one of these?

No, that's internal to the DB layer. queryAsync() returns a Proxy object. This just doesn't work in 5.0. It's a minor inconvenience for debugging, but given that you're passing the SQL statement to begin with and know what the fields are, it should be a pretty minor issue.
回复全部
回复作者
转发
0 个新帖子