Does anyone know of a Perl function or package that can take a 
user-inputted string (like from a search form on web page) and turn it into 
proper SQL.

Something that might be able to deal with quoting, parenthesis and use of 
AND and OR.  Perhaps also + and - syntax.

For example, if a user entered:

("long ago" AND "far away") OR "before I sleep"

It would turn it into:

SELECT id, field FROM MyTable WHERE (field LIKE '%long ago%' AND filed LIKE 
'%far away%') OR (field LIKE '%before I sleep%');


....tangentially, I'm interested in learning more about what sort of search 
syntax is common.  That is, what is the best searching syntax scheme to use 
that will maximize my user's ability to use it without having to read a 
help page on it first.  I suspect most web users know little about how 
parenthesis and boolean operators work.  So, what behavior do most users 
expect from a web search?  ...AND of all the search terms?  OR?  ...OR 
FULLTEXT style sorted by RELEVANCE?

Thanks in advance for any comments.

-bill


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to