home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!spool.mu.edu!umn.edu!bru!newsman
- From: roder@mayo.edu (Mark N. Roder)
- Subject: DBKit- Trying to get a SQL function in a query
- Message-ID: <1992Sep9.194037.14018@bmw.mayo.edu>
- Sender: newsman@bmw.mayo.edu (/home/bmw/usenet)
- Reply-To: roder@mayo.edu(Mark N. Roder)
- Organization: Mayo Foundation, Rochester MN. Campus
- Date: Wed, 9 Sep 92 19:40:37 GMT
- Lines: 51
-
-
-
- I am trying to find a easy answer to the following problem. I am
- doing a phone-book type application and want to use the SQL function
- soundex to do fuzzy type of searchs on last name.
-
- I (will) have a trigger to create a soundex value in the table
- whenever a insert/update is done. We will call that field sl, with the
- name field being name. The type of query I want to do is like this:
- SELECT name FROM entries
- WHERE sl LIKE SOUNDEX('looking_for_this_name')
-
- How can I do this with DBKit?.
-
- The way I look at it, there is 2 different ways to approach this.
-
- 1) try to get a value back from a SQL function. I can then use
- that in the building of the qualifier. In looking at the docs, the
- evaluateString: method would do the trick, but I don't know how to get the
- value back from that. I can do the following from withn isql:
- > 1> SELECT SOUNDEX('Anderson')
- > 2> go
- >
- > -----
- > A536
- >
- > (1 row affected)
- > 1>
- Now, If I send it that string using evaluateString, how do I get
- the value back? This would also be nice in finding things like MAX, MIN,
- AVG,etc
-
-
- 2) Have some way of building the qualifier that has something like
- the following:
- sprintf(buff,"SOUNDEX('%s')")
- dbQualifier = [[DBQualifier allocFromZone:[self zone] ]
- initForEntity:[dbModule entity]
- fromDescription:"%@ LIKE %XXX", SoundsLike,buff];
- ^^^^^^ don't know
-
- Has anybody solved this (probably simple) problem already?
-
- Thanks for the help
-
-
- --
- Mark Roder
- NeXT Consultant, Mayo Foundation
- NeXT Mail: roder@mayo.edu
- phone: (507) 284-5306
-