Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 08-11-2002 16:05:13

Guest
Guest

search--case sensitive?

It seems that the search feature is case sensitive.  Is there a way to make it NOT case sensitive?

 

#2 08-11-2002 18:33:30

Adam
Member
Registered: 04-30-2002
Posts: 32

Re: search--case sensitive?

Hello,

I think it can be done in file ./cgi-bin/library/modules/ste_prod.pl

find this line:

$fd_searchstr = $q->param('searchstr');

and add below line:

$fd_searchstr =~ tr/A-Z/a-z/;

-AAJ

Offline

 

#3 08-11-2002 18:44:24

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: search--case sensitive?

Actuall that fix will just change the search string to lowercase, but will only match lowercase in the DB.  If you're using CSV or MySQL, you can do the following:

In the file: ./cgi-bin/library/modules/ste_prod.pl

Where you see the line:

my $searchopr = "LIKE";

at the top of the file, change it to:

my $searchopr = "CLIKE";

This will work for MySQL and CSV, but will blow up on MS SQL Server and PostgreSQL.  Be warned...


Nick Hendler

Offline

 

#4 08-11-2002 19:00:38

Guest
Guest

Re: search--case sensitive?


>In the file: ./cgi-bin/library/modules/ste_prod.pl
>
>Where you see the line:
>
>my $searchopr = "LIKE";
>
>at the top of the file,
>change it to:
>
>my $searchopr = "CLIKE";
>
>This will work for MySQL and
>CSV, but will blow up
>on MS SQL Server and
>PostgreSQL.  Be warned...


Thanks--that worked.

 

#5 08-11-2002 19:10:08

Adam
Member
Registered: 04-30-2002
Posts: 32

Re: search--case sensitive?

>Actuall that fix will just change
>the search string to lowercase,
>but will only match lowercase
>in the DB. 

in simple search in Perl all I need to match everything
without upper/lower case issue is using somewhere:

if ($string =~ /$_/i) {...

the `/i' means 'insensitive' but I didn't hack too deep in actual code to find
where in CCP5 is this place  :-)
(anyway with MySQL it will work different way)

Offline

 

#6 08-11-2002 19:45:20

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: search--case sensitive?

The thing is the search is executed within SQL, not in the context of an array loop.  The CLIKE method is the only way I know of within the SQL.  If we did a SELECT that returned all the rows and iterated over them in an array the other two methods would work.  But who wants all those rows in memory?


Nick Hendler

Offline

 

Board footer