Subject | Re: [Firebird-Java] Re: BLOB sub_type 1 and character endcoding |
---|---|
Author | Helen Borrie |
Post date | 2003-12-06T11:02:45Z |
At 10:14 AM 6/12/2003 +0000, you wrote:
SQL language, you can do
--with parameters
insert into charset_table (col1, col2)
values (cast (? as varchar(10) character set WIN1252),
cast (? as varchar(10) character set NONE));
--with your literals in variables ('scuse the non_java-ish concatenation
syntax, but you get the idea..)
YourSQLString = "insert into charset_table(col1, col2) values(_WIN1252" + Var1
+ ", _NONE " + Var2
Helen
>Rick,I don't doubt that's correct for the Java driver, but, making use of the
>
> > Those of you more knowledgeable than I am about this please read
> > this and correct me where I'm wrong. I'll add this to the FAQ.
>
>Excellent explanation! I have just a few comments to make picture more
>complete.
>
> > With Firebird the character encoding of the text data stored in the
> > database is set when the database is created. That applies to the
> > char and varchar columns, and type 1 blobs (text blobs). You can
> > override the default charset for columns with the appropriate SQL
> > commands when the columns are created.
>
> > Be careful if you do this or
> > you may end up with two columns in the same table that you can't
> > read with the same connection.
>
>The only situation when this problem can happen that comes to my mind
>is when you have table with columns that have "NONE" character set and
>some other character set ("UNICODE_FSS", "WIN1252", etc). As Rick
>described, server tries to convert characters from the encoding
>specified for the column into the encoding specified for connection.
>"NONE" character set allows only one-way conversion: from <any> to
>"NONE". In this case server simply returns you bytes written in the
>database. So if you have table
>
>CREATE TABLE charset_table(
> col1 VARCHAR(10) CHARACTER SET WIN1252,
> col2 VARCHAR(10) CHARACTER SET NONE
>)
>
>you will not be able to modify both columns in the same SQL statement,
>and it does not matter whether you use "NONE", "WIN1252" or
>"UNICODE_FSS" for the connection.
SQL language, you can do
--with parameters
insert into charset_table (col1, col2)
values (cast (? as varchar(10) character set WIN1252),
cast (? as varchar(10) character set NONE));
--with your literals in variables ('scuse the non_java-ish concatenation
syntax, but you get the idea..)
YourSQLString = "insert into charset_table(col1, col2) values(_WIN1252" + Var1
+ ", _NONE " + Var2
Helen