Domanda

in FireRobin, I'm trying to create a View that contains Cyrillic letters in it:

CREATE VIEW "CyrillicView" (PRIM)
AS 
SELECT 
  PRIM
FROM ROYALTY
WHERE 
  (ROYALTY.PRIM = 'Кириллица');

Unfortunately, it results in the Error:

Message: isc_dsql_execute2 failed

SQL Message : -607 This operation is not defined for system tables.

Engine Code : 335544351 Engine Message : unsuccessful metadata update STORE RDB$RELATIONS failed Malformed string

When I replace Cyrillic letters with latin ones everything works just fine. Also, I've noticed that when I run only SELECT statement from the code above - it works fine even with Cyrillic letters in it.

I tryed to connect to FireBird using UTF-8 charset and even successfully created a View with cyrillic letters. But it was useless, because, when I am connecting with "NONE" charset (the right one) then the view does not return any rows at all. I've checked the view creation code and it looks like so:

CREATE VIEW CYR (PRIM)
AS 
SELECT 
  PRIM
FROM ROYALTY
WHERE 
  (ROYALTY.PRIM = 'Кириллица')

While connecting with NONE charset (the right one) with FireRobin:

  • Can write working SELECT queries with cyrillic letters
  • Can't create Views using cyrillic letters
  • Can create Views without cyrillic letters
  • Views that were created while connected with UTF-8 and contain cyrillic letters return nothing

While connecting with UTF-8 charset (the wrong one) with FIreRibon: - Can create Views with cyrillic letters (that actually don't return any values) - All columns with NONE charset contain no values in the results

Maybe someone can suggest what I can do here? Can I somehow specify in the where clause not to ruion my encoding? Maybe, in Firebird there is a special symbol, like in SQL Server I can put before Uncode strings like so:

CREATE VIEW CYR (PRIM)
AS 
SELECT 
  PRIM
FROM ROYALTY
WHERE 
  (ROYALTY.PRIM = N'Кириллица')

Additional info:

  • Firebird 2.5.2
  • Database charset is NONE
  • All database's columns' charest are NONE
È stato utile?

Soluzione

The problem stems from your use of NONE as the database default, column and connection character set. It essentially means 'no character set, use whatever bytes sent as is'. For the basic ASCII set this will usually work fine. For other characters it can lead to all kinds of weird problems.

For your view definition you can probably get it to work by explicitly casting the column to a character set with Cyrillic characters (win1251), and by using the character set introducer for the literal:

Cast(theColumn as varchar(100) character set win1251) = _win1251 '<cyrillic chars>'

Better yet would be to use an explicit character set for your database default, columns and connection. With explicit character sets, firebird will convert for you between character sets, if possible.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top