Search code examples
c#ado.netfirebirdfirebird-embedded

What data type should I use for variable length with German characters?


What data type should I use for variable length with German characters?

I'm not sure the following is ok.

public const string stFIELD_DEFINITIONS = " fstInfo VARCHAR(100) CHARACTER SET UNICODE_FSS, fiKeyID INTEGER PRIMARY KEY ";

"VARCHAR(x) CHARACTER SET UNICODE_FSS" is described as "fixed length" per https://firebirdsql.org/manual/migration-mssql-data-types.html.


Solution

  • VARCHAR is not fixed-length, it only has a maximum length. It looks like a copy and paste error from the entry of nchar three lines above.

    However that said, instead of UNICODE_FSS, you should use UTF8. The difference is that UNICODE_FSS is restricted to 1-3 bytes UTF-8 (the so called 'file system safe'-set), while UTF8 allows the full range. That document seems to be a bit outdated to be honest, for example the equivalent of bigint is BIGINT, not INT64, and unique identifier would be better as a CHAR(16) CHARACTER SET OCTETS together with the UUID functions