On 20/02/2024 20:20, Luciano Rodrigues Nunes Mendes wrote:
> I am using Firebird
ADO.NET <
http://ADO.NET> data provider v10.0.0 to
> communicate with the server, but the issue also happens with FlameRobin
> using fbclient.dll v3.0.11.
>
> I believe I need to use Charset=UTF8 in the connection string because
> this is the database's default charset and there are some table columns
> using UTF8, although the vast majority of table columns in this database
> are WIN1252, correct?
The default character set technically is irrelevant for that decision,
as that only specifies what character set a string column will use if
you don't specify one explicitly when creating it.
However, if most of your columns are UTF8, then yes, using UTF8 as the
connection character set, or NONE if the driver supports using the
actual character set, is the way to go (unless you only store the
WIN1252 subset of characters in the those columns).
> Under these conditions, as I understand it, any VARCHAR WIN1252 column
> with more than 8191 characters, the best way to work around it is to
> cast it to BLOB TEXT before the query, correct?
Any column defined as VARCHAR(n) or CHAR(n) with n > 8191, the actual
character count has no influence on this error. And yes, casting to BLOB
TEXT is the only workaround if you cannot structurally modify the
database to replace those columns with VARCHAR(8191).
> Could I use charset=NONE in the connection string to update WIN1252 and
> UTF8 columns without data loss?
Yes, that should work. If I recall correctly, the Firebird
ADO.NET
provider implements the right character set behaviour when connecting
with character set NONE (though I would recommend you double-check
this), but do make sure to that you have no string columns that have
character set NONE specified, otherwise you may logically corrupt data
in those columns by using multiple/different character set encodings
when reading and writing data.
I'm not sure if FlameRobin does the right thing to be honest.
Mark
--
Mark Rotteveel