按附件名搜索
var query = Gloda.newQuery(Gloda.NOUN_MESSAGE);
query.attachmentTypes();
query.attachmentNamesMatch(AttachName);
gloda.js
_bindAttribute: function gloda_ns_bindAttr(aAttrDef, aSubjectNounDef)
datastore.js
queryFromQuery: function gloda_ds_queryFromQuery(aQuery, aListener,
原来的查询语句 查单个字查不出来
//查附件名关键字: 功
SELECT * FROM messages INNER JOIN messagesText ON messages.id = messagesText.rowid WHERE (id IN (SELECT messageID FROM messageAttributes WHERE (attributeID = 49) INTERSECT SELECT docid FROM messagesText WHERE attachmentNames MATCH ?) AND +deleted = 0 AND +folderID IS NOT NULL AND +messageKey IS NOT NULL) ARGS: 功
//查询所有附件:
SELECT * FROM messages INNER JOIN messagesText ON messages.id = messagesText.rowid WHERE (id IN (SELECT messageID FROM messageAttributes WHERE (attributeID = 49)) AND +deleted = 0 AND +folderID IS NOT NULL AND +messageKey IS NOT NULL) ARGS:
修改后的查询语句 :
SELECT * FROM messages INNER JOIN messagesText ON messages.id = messagesText.rowid WHERE (id IN (SELECT messageID FROM messageAttributes WHERE (attributeID = 49) INTERSECT SELECT docid FROM messagesText WHERE attachmentNames like '%功%') AND +deleted = 0 AND +folderID IS NOT NULL AND +messageKey IS NOT NULL) ARGS: