nspredicate - How do I filter NSMetadataQuery -
i trying create nsmetadataquery
predicate. @ point may want gather videos icloud may have @ point images. don't want else, search videos or search images. not both @ same time.
i have created code:
cfstringref whattofilter = kuttypeimage; if (self.filtertype == kkindvideo) { whattofilter = kuttypevideo; } nspredicate *predtype = [nspredicate predicatewithformat:@"(%k == %@)", nsmetadataitemcontenttypekey, whattofilter]; nsmetadataquery *newquery = [[nsmetadataquery alloc] init]; [newquery setsearchscopes:@[nsmetadataqueryubiquitousdocumentsscope]]; newquery.predicate = predtype;
as add predicate newquery
gives me 0 results.
what correct syntax query? don't tell me predicate not working nsmetadataquery
, because sort not working either.
the best way create correct nsmetadataquery
predicate use finder's query expression editor, so:
then save smart folder , get info on resulting folder:
the relevant spotlight query syntax is, in instance: "(kmditemusertags == 'assets'cd)"
... (ignore _kmditemgroupid
subexpression, attribute names beginning underscores not public api.)
finally, let nspredicate
figure out how wants query string rewritten:
let predicate = nspredicate(frommetadataquerystring: "(kmditemusertags == 'assets'cd)")
For deleting data, we simply use the delete command of MySQL.
ReplyDeleteBut if we want to delete data of the referenced table automatically while we delete data from the parent table so for that we use the MySQL cascade feature.
Suppose I have 2 tables.
1- Parent
2- Child
And I want to delete referenced data from the child automatically if I delete data from the parent table. So for this, we use ON DELETE cascade of MySQL.
Checkout complete example on
https://www.javadream.in/mysql-cascade-on-delete-and-on-update-cascade-example/