Subject | Re: [firebird-support] BLOB SUB_TYPE 1 + using CONTAINING with LC_TYPE=WIN1250 |
---|---|
Author | Helen Borrie |
Post date | 2010-03-22T08:01:42Z |
At 06:55 AM 20/03/2010, you wrote:
SELECT * FROM T1 WHERE BLBFIELD CONTAINING
(cast ((:PARAMVALUE) as varchar(50) character set UTF8 collate name_of_collation))
Note the extra set of brackets around the parameter placeholder.
Is this Delphi you are working with? or PSQL? If neither, then the named parameter syntax won't work. It would need to be:
SELECT * FROM T1 WHERE BLBFIELD CONTAINING
(cast ((?) as varchar(50) character set UTF8 collate name_of_collation))
>Hello, I have a problem:If you can limit the length of the input parameter, you could try the following:
>
>FB 2.0.3, ODS 11
>
>I have a BLOB SUB_TYPE 1 CHARSET UTF8 field. Data are stored in UTF8 format. In client application (IBX) I'm using connection Params:
>
>LC_TYPE=WIN1250
>
>Question: is there a way to execute such a query:
>
>SELECT * FROM T1 WHERE BLBFIELD CONTAINING :PARAMVALUE
>
>passing string in UTF format ? Or how to disable conversion (I guess there is a conversion WIN1250 -> UTF8) passing param value ?
>
>If I drop
>
>LC_TYPE=WIN1250
>
>from connection params, query works fine.
>
>
>There is something else. Previously the column was declared as:
>
>BLBFIELD BLOB SUB_TYPE 1 CHARSET WIN1250
>
>later we decided to store in that column values in UTF8 format. After that I make some alters:
>
>ALTER TABLE T1 ADD BLBFIELD_N BLOB SUB_TYPE 1 CHARSET NONE
>
>UPDATE T1 SET BLBFIELD_N = BLBFIELD -- transfer UTF8 values into _N field
>
>ALTER TABLE T1 DROP BLBFIELD
>
>ALTER TABLE T1 ADD BLBFIELD BLOB SUB_TYPE 1 CHARSET UTF8
>
>UPDATE T1 SET BLBFIELD = BLBFIELD_N -- transfer UTF8 values into original column, but with correct CHARSET. I need correct charset for using CONTAINIG clause.
>
>After that alter I was trying to execute such query:
>
>SELECT * FROM T1 WHERE BLBFIELD CONTAINING :PARAMVALUE COLLATE UTF8
>
>but FB returns error like 'collation is not definied for WIN1250 charset' - but the column is not WIN1250 any more ? What is wrong ?
SELECT * FROM T1 WHERE BLBFIELD CONTAINING
(cast ((:PARAMVALUE) as varchar(50) character set UTF8 collate name_of_collation))
Note the extra set of brackets around the parameter placeholder.
Is this Delphi you are working with? or PSQL? If neither, then the named parameter syntax won't work. It would need to be:
SELECT * FROM T1 WHERE BLBFIELD CONTAINING
(cast ((?) as varchar(50) character set UTF8 collate name_of_collation))