home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / next / programm / 6081 < prev    next >
Encoding:
Text File  |  1992-09-09  |  2.0 KB  |  63 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!spool.mu.edu!umn.edu!bru!newsman
  3. From: roder@mayo.edu (Mark N. Roder)
  4. Subject: DBKit- Trying to get a SQL function in a query
  5. Message-ID: <1992Sep9.194037.14018@bmw.mayo.edu>
  6. Sender: newsman@bmw.mayo.edu (/home/bmw/usenet)
  7. Reply-To: roder@mayo.edu(Mark N. Roder)
  8. Organization: Mayo Foundation, Rochester MN. Campus
  9. Date: Wed, 9 Sep 92 19:40:37 GMT
  10. Lines: 51
  11.  
  12.  
  13.  
  14.     I am trying to find a easy answer to the following problem.  I am  
  15. doing a phone-book type application and want to use the SQL function  
  16. soundex to do fuzzy type of searchs on last name.
  17.  
  18.     I (will) have a trigger to create a soundex value in the table  
  19. whenever a insert/update is done.  We will call that field sl, with the  
  20. name field being name.  The type of query I want to do is like this:
  21.     SELECT name FROM entries
  22.     WHERE sl LIKE SOUNDEX('looking_for_this_name')
  23.  
  24. How can I do this with DBKit?.  
  25.  
  26.     The way I look at it, there is 2 different ways to approach this.
  27.  
  28.     1) try to get a value back from a SQL function.  I can then use  
  29. that in the building of the qualifier.  In looking at the docs, the  
  30. evaluateString: method would do the trick, but I don't know how to get the  
  31. value back from that.  I can do the following from withn isql:
  32. > 1> SELECT SOUNDEX('Anderson')
  33. > 2> go
  34. >        
  35. >  ----- 
  36. >  A536  
  37. > (1 row affected)
  38. > 1> 
  39.     Now, If I send it that string using evaluateString, how do I get  
  40. the value back?   This would also be nice in finding things like MAX, MIN,  
  41. AVG,etc
  42.  
  43.  
  44.     2) Have some way of building the qualifier that has something like  
  45. the following:
  46. sprintf(buff,"SOUNDEX('%s')")
  47. dbQualifier = [[DBQualifier allocFromZone:[self zone] ] 
  48.                 initForEntity:[dbModule entity]
  49.                 fromDescription:"%@ LIKE %XXX", SoundsLike,buff];
  50.                     ^^^^^^ don't know 
  51.  
  52.     Has anybody solved this (probably simple) problem already?  
  53.  
  54. Thanks for the help
  55.  
  56.  
  57. --
  58. Mark Roder
  59. NeXT Consultant, Mayo Foundation
  60. NeXT Mail:     roder@mayo.edu
  61. phone:        (507) 284-5306
  62.