• 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
Re: caseInsensitiveLike unknown operator exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: caseInsensitiveLike unknown operator exception


  • Subject: Re: caseInsensitiveLike unknown operator exception
  • From: Lachlan Deck <email@hidden>
  • Date: Tue, 7 Oct 2008 18:16:40 +1100

Hi Nathan,

(ccing dev list)

On 02/10/2008, at 9:32 AM, Nathan Hadfield wrote:

Lachlan,

Thanks very much. I've fixed the code as you suggested.

I'm afraid we have several other uses of qualifierWithQualifierFormat() that I'll probably have to fix as well, but fortunately with the Wonder ERXQ class it's nearly as simple and readable as using the format string. The advantage of compile safety is probably worth the effort anyway.

Certainly makes it simpler to find problems. Sometimes you can overlook simple spelling mistakes in strings.


I know it's a moot question, but I'm curious--any ideas as to what might have caused the failure to recognize 'caseInsensitiveLike' as an operator?

I really wouldn't know without testing it. I suspect that it's either confused by the locale with the bare string you've supplied or what's in your email doesn't match the previously wrong implementation ;-)


Do you think something about their using a Turkish locale could cause this?

That's quite possible.

On Sep 27, 2008, at 6:21 AM, Lachlan Deck wrote:

On 27/09/2008, at 7:21 AM, Nathan Hadfield wrote:

A client ran into this exception when performing a fetch with this qualifier: "((deleted=0) or (deleted=nil)) and (accountId=1) and (username caseInsensitiveLike %@)":

Unknown operator:<class com.webobjects.foundation.NSSelector (methodName=caseInsensitiveLike)>

Try using EOKeyValueQualifier (which gives you compile safety) rather than qualifierWithQualifierFormat.
Also try not exposing foreign keys unless you really need to.


public User getUserForLoginId( String loginId, int loginType, Preference aPreference ) {

NSMutableArray andQuals = new NSMutableArray();
andQuals .addObject( EOQualifier.qualifierWithQualifierFormat( "(deleted = 0) or (deleted = nil)", null ) );
if( aPreference != null )
andQuals .addObject( EOQualifier.qualifierWithQualifierFormat( "accountId = " + aPreference.account().id(), null ) );
if( loginType == USERNAME_LOGIN )
andQuals .addObject( EOQualifier.qualifierWithQualifierFormat( "username caseInsensitiveLike %@", new NSArray( loginId ) ) );

andQuals.addObject( new EOOrQualifier( new NSArray( new Object[] {
new EOKeyValueQualifier( User.DELETED_KEY, EOQualifier.QualifierOperatorEqual, 0 ),
new EOKeyValueQualifier( User.DELETED_KEY, EOQualifier.QualifierOperatorEqual, NullValue )
} ) );
if ( aPreference != null )
andQuals.addObject( new EOKeyValueQualifier( User.ACCOUNT_KEY, EOQualifier.QualifierOperatorEquals, aPreference.account() ) );
if ( loginType == USERNAME_LOGIN )
andQuals.addObject( new EOKeyValueQualifier( User.USERNAME_KEY, EOQualifier.QualifierOperatorCaseInsensitiveLike, loginId ) );

EOQualifier qual = new EOAndQualifier( andQuals );

EOFetchSpecification fetchSpec = new EOFetchSpecification( "User", qual, null );
fetchSpec.setRefreshesRefetchedObjects( true );


NSArray matchingUsers = ec.objectsWithFetchSpecification( fetchSpec );

with regards, --

Lachlan Deck



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden



with regards, --

Lachlan Deck



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: mysql AUTO_INCREMENT
  • Next by Date: [Meeting] Toronto Area Cocoa and WebObjects Developer Group - October 21
  • Previous by thread: Re: Incorrectly Parsed Form Values in WOContext
  • Next by thread: [Meeting] Toronto Area Cocoa and WebObjects Developer Group - October 21
  • Index(es):
    • Date
    • Thread