Greetings,
I store text data in windows-1251 encoding in my pgSQL database
and when I execute SQL command like
SELECT title, firstname, lastname, description FROM stuff
WHERE title LIKE '%<keyword>%' AND firtsname LIKE '%<keyword>%'
AND lastname LIKE '%<keyword>%' AND description LIKE '%<keyword>%'
the response comes really quick, but if I want case independent
search, I should convert, using my own PHP3 function, both search
field and keyword to low case just becouse PostgreSQL by itself
doesn't know how to convert characters in windows-1251 encoding
to low case. And response time grows from 0:07 to 1:10!
Is there any solution? May be stored procedures (that doesn't
require to recompile pgSQL)? Thank you in advance!!!
P.S.: as far as I know there is no locale for windows-1251 and,
unfortunately, I can't store data in koi8-r whose locale present
in almost all UNIX'es.
Mentioned above function:
function lower($str)
{
$length = strlen($str);
for ($i = 0; $i < $length; ++$i)
{
$sym = ord($str[$i]);
if (($sym > 34 && $sym < 60) || ($sym > 191 && $sym < 224))
$str[$i] = chr($sym + 32);
}
return $str;
}
--
BEST WISHES, Dmitry
Webmaster, DeltaCube Studio
http://www.deltacube.com/