(un-jeopardied)

Wagner-David wrote, on Friday, March 02, 2001 13:08
: steve silvers [mailto:[EMAIL PROTECTED]] wrote
: > Say I search on (perl and oracle).
: >
: > if ($query->{Find} =~ /and/i) {
: >     Run my sql statement ie: perl and oracle
: > }
: >
: > if ($query->{Find} =~ /or/i) {
: >     Run my sql statement ie: perl or oracle
: > }
: >
: > Does anyone have a good routine to take (perl and oracle), get 
: > rid of the 
: > white space before and, get rid of and, get rid of the white 
: > space after and
: >
: > then just have:
: >
: > if ($query->{Find} =~ /and/i) {
: >     $sql = "SELECT bla, bla FROM table";
: >        $sql.= ' WHERE ';
: >        $sql.= " column LIKE ";
: >        $sql.= "perl AND column LIKE oracle";
: > }
:       I believe you would want as part of the check for and or or to be
: \sand\s , \sor\s otherwise if a word has or like word or and, your check
: would give incorrect hits.  
: 
:       Are you limited only to two(ie, perl or oracle) or could 
: it be more?
: I think you want to take the case of more than 2 but less than 
: some number
: which may cause too much overhead(ie 10 items within or/and may take a
: performance hit).
: 
:       you could do a split(/\s+and\s+/, $query->{Find}) and same 
: thing for
: or.

I'd split on or first to preserve algebraic precedence (assuming there
are no parentheses) of and over or.

Joe

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]
 
          Carleton Inc.   http://www.carletoninc.com
          219.243.6040 ext. 300    fax: 219.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to