• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
using SUBQUERY to remove nulls
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using SUBQUERY to remove nulls


  • Subject: using SUBQUERY to remove nulls
  • From: Roland King <email@hidden>
  • Date: Wed, 05 Jun 2013 21:50:28 +0800

I have a property, 'meaning' on my objects in a core data model. It's optional. I need to find all the meanings which contain a certain string (not terribly efficient but a fairly rare search).

I started out with this predicate

	[ NSPredicate predicateWithFormat:@"meaning CONTAINS %@", searchString ];

but it crashes with a EXC_BAD_ACCESS deep down in the SQLLite execution trying to evaluate CFStringGetLength on a zero pointer. My assumption here is that it's finding an object with a null meaning, so I want to filter them out. So I tried

	[ NSPredicate predicateWithFormat:@"( meaning != NULL ) AND ( meaning CONTAINS %@ )", searchString ];

and a few variants thereof, but they crash the same way, leading me to think perhaps both parts of the AND are evaluated whether or not the first part succeeds, ie not like C's guaranteed shortcut, and perhaps I shouldn't expect it to be.

I could split this into two, and will try that, but I was trying to figure out how to use the SUBQUERY() syntax to do it in one. The documentation is a little weak on this, does anyone have some serious NSPredicate skills and knows how to do it?





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: using SUBQUERY to remove nulls
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: TECConvertText returns an unknown result code
  • Next by Date: Re: Layout on Mini is broken
  • Previous by thread: Re: Layout on Mini is broken
  • Next by thread: Re: using SUBQUERY to remove nulls
  • Index(es):
    • Date
    • Thread