Subject Re: [firebird-support] Bug with character " Ñ "
Author Helen Borrie
At 09:21 PM 20/05/2005 -0500, you wrote:
>Hi,
>
>I program with VB6 and FB 1.5.2 Superserver + ADO
>
>I pass this SQL:
>
> Dim strSQL As String
>
> strSQL = "Select (NU_ANIO_TRAM) AS Año, (NU_TRAM) AS Tramite,
>(DE_CLIE) as RazSocial, (NU_RUC) as RUC, (FE_LEGA) AS Legaliz,
>(NU_SECU_REGI) as NumRegis, (NU_SECU_FOLI) as Folios From H_TRAM_LEGA_LIBR"
>
>and receipt this error:
>
>"Error -2147217887 The ODBC controler not admit the properties"
>
>When I change the strSQL for:
>
> strSQL = "Select (NU_ANIO_TRAM) AS *Anio*, (NU_TRAM) AS Tramite,
>(DE_CLIE) as RazSocial, (NU_RUC) as RUC, (FE_LEGA) AS Legaliz,
>(NU_SECU_REGI) as NumRegis, (NU_SECU_FOLI) as Folios From H_TRAM_LEGA_LIBR"
>
>the query return the correct data, is a bug with the Spanish character "
>Ñ " ???
>
>In this case is very important, because the translate of word "Año"
>into english is "Year"

What you are encountering here is the restriction that unquoted object
identifiers are restricted to the US ASCII alphanumeric character set range
(excluding most punctuation characters, also). So "ñ" is an illegal character.

Firebird supports the SQL standard that allows you to create identifiers
containing illegal characters, by defining the identifier inside double
quotes.

Since I'm not all that familiar with VB's rules about escaping literal
quotemarks in strings, I'll show here just the SQL statement:

Select (NU_ANIO_TRAM) AS "Año", (NU_TRAM) AS Tramite,
(DE_CLIE) as RazSocial, (NU_RUC) as RUC, (FE_LEGA) AS Legaliz,
(NU_SECU_REGI) as NumRegis, (NU_SECU_FOLI) as Folios From H_TRAM_LEGA_LIBR

The characters in the identifier are forced case-sensitive, so "Año"
exists, while "AÑo" does not. f you refer to this identifier in your client
code, the reference must also include the double quotes. I'll give an
ObjectPascal example:

MyIntVar := Query1.FieldByName('"Año"').AsInteger ;

It's up to you work out how your VB code deals with the double-quotes.

./heLen