Re: wildcard Query (Read-Attribute in EOModel)
Re: wildcard Query (Read-Attribute in EOModel)
- Subject: Re: wildcard Query (Read-Attribute in EOModel)
- From: email@hidden
- Date: Wed, 10 Nov 2010 10:09:39 -0500
Hi Ken and everyone :-)
Farrukh's
solution is ok but as he also pointed out, it is "in-memory"
and will only work on small data sets.
Amedeo's solution is "memory-stable"
but requires a schema change and data duplication / synchronization (on
edits).
Here's another solution:
Consider adding an attribute to your
EOModel called "huntForWildcard". In the "custom formatting"
of the "Advanced Attribute Inspector" check it as "read
only" and add something clever to the "Read:" text field
to fetch the data. If you are on Oracle you could use a "decode"
or a "translate" function.
Consider putting this in your "Read:"
field (if on Oracle):
translate(%P, '*', '#')
You can test this out with a raw query
to understand what it is doing:
select translate('dav*d','*','#') from
dual;
The "%P" is important. It
lets EOF know what column to pull from. Be sure that when you model the
attribute the column you give is the same as the one you want to query
the wildcard on.
Of course other databases have functionality
similar to Oracle but the syntax will be different. You still need the
"%P" and follow a similar formula.
Now the beauty is that you have very
minimal raw SQL and now can use EOF and your queries like you want. In
the case above you would now search for the "#" character instead
of an asterisk when you search on this new column.
Advantages: Memory stable, no data duplication
/ synchronization, Feels very EOF like once you make your "huntForWildard"
attribute.
-- Aaron _______________________________________________
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