Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The parameterized exception does not accept not ASCII characters as parameter [CORE4160] #4487

Closed
firebird-automations opened this issue Aug 4, 2013 · 15 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @sim1984

c:\Program Files\Firebird\Firebird_3_0>chcp 1251
Текущая кодовая страница: 1251

c:\Program Files\Firebird\Firebird_3_0>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> SET NAMES WIN1251;
SQL> CREATE DATABASE 'localhost/3051:d:\interbasedata\3.0\db1.fdb' USER 'SYSDBA' PASSWORD 'masterkey' DEFAULT CHARACTER
SET WIN1251;
SQL> CONNECT 'localhost/3051:d:\interbasedata\3.0\db1.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
Commit current transaction (y/n)?y
Committing.
Database: 'localhost/3051:d:\interbasedata\3.0\db1.fdb', User: SYSDBA
SQL> select 'мама' as d from rdb$database;

D

мама

SQL> recreate exception e_incorrect_value 'Некорректное значение @1';
SQL> set term ^;
SQL> execute block
CON> as
CON> begin
CON> exception e_incorrect_value using('abc');
CON> end^
Statement failed, SQLSTATE = HY000
exception 1
-E_INCORRECT_VALUE
-Некорректное значение abc
SQL> execute block
CON> as
CON> begin
CON> exception e_incorrect_value using('абв');
CON> end^
Statement failed, SQLSTATE = HY000
exception 1
-E_INCORRECT_VALUE
-Некорректное значение абв // this is bug
SQL>

Commits: de80219 FirebirdSQL/fbt-repository@6f48d5c

====== Test Details ======

Test implemented using UTF8 in order to check multiple languages.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Just to confirm - was a connection charset also set to WIN1251?

@firebird-automations
Copy link
Collaborator Author

Commented by: @sim1984

Yes. Charset connection as WIN1251

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @sim1984

description: recreate exception e_incorrect_value 'Некорректное значение @1';

execute block
as
begin
exception e_incorrect_value using('abc');
end

E_INCORRECT_VALUE.
Некорректное значение abc.

It's correct

execute block
as
begin
exception e_incorrect_value using('абв');
end

E_INCORRECT_VALUE.
Некорректное значение абв.

It's incorrect

=>

Use CONNECT or CREATE DATABASE to specify a database
SQL> connect 'localhost/3051:test' user 'sysdba' password 'masterkey';
Database: 'localhost/3051:test', User: sysdba
SQL> shell chcp 1251;
Текущая кодовая страница: 1251
SQL> set names win1251;
SQL> select 'мама' as d from rdb$database;

D

мама

SQL>recreate exception e_incorrect_value 'Некорректное значение @1';
SQL> set term ^;
SQL>execute block
CON>as
CON>begin
CON>exception e_incorrect_value using('abc');
CON>end^
Statement failed, SQLSTATE = HY000
exception 1
-E_INCORRECT_VALUE
-Некорректное значение abc
SQL>execute block
CON>as
CON>begin
CON>exception e_incorrect_value using('абв');
CON>end^
Statement failed, SQLSTATE = 22000
Malformed string

summary: Exceptions with parameters distort not ASCII characters => The parameterized exception doesn't accept a line from not ASCII characters as parameter

@firebird-automations
Copy link
Collaborator Author

Modified by: @sim1984

summary: The parameterized exception doesn't accept a line from not ASCII characters as parameter => The parameterized exception does not accept not ASCII characters as parameter

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

First thing is SET NAMES has no value after database connection is stablished. Do you say that "Charset connection as WIN1251" has done before the connection?

Second, exceptions and non-ascii strings is a nobscure area, because exception text in metadata uses NONE charset.

It's a pity, but unfortunately previous proposal to fix this had not an agreement nor a counter proposal.

@firebird-automations
Copy link
Collaborator Author

Commented by: @sim1984

I changed the bug description. The error all the same is, but now it other kind.

@firebird-automations
Copy link
Collaborator Author

Modified by: @sim1984

description: Use CONNECT or CREATE DATABASE to specify a database
SQL> connect 'localhost/3051:test' user 'sysdba' password 'masterkey';
Database: 'localhost/3051:test', User: sysdba
SQL> shell chcp 1251;
Текущая кодовая страница: 1251
SQL> set names win1251;
SQL> select 'мама' as d from rdb$database;

D

мама

SQL>recreate exception e_incorrect_value 'Некорректное значение @1';
SQL> set term ^;
SQL>execute block
CON>as
CON>begin
CON>exception e_incorrect_value using('abc');
CON>end^
Statement failed, SQLSTATE = HY000
exception 1
-E_INCORRECT_VALUE
-Некорректное значение abc
SQL>execute block
CON>as
CON>begin
CON>exception e_incorrect_value using('абв');
CON>end^
Statement failed, SQLSTATE = 22000
Malformed string

=>

c:\Program Files\Firebird\Firebird_3_0>chcp 1251
Текущая кодовая страница: 1251

c:\Program Files\Firebird\Firebird_3_0>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> SET NAMES WIN1251;
SQL> CREATE DATABASE 'localhost/3051:d:\interbasedata\3.0\db1.fdb' USER 'SYSDBA' PASSWORD 'masterkey' DEFAULT CHARACTER
SET WIN1251;
SQL> CONNECT 'localhost/3051:d:\interbasedata\3.0\db1.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
Commit current transaction (y/n)?y
Committing.
Database: 'localhost/3051:d:\interbasedata\3.0\db1.fdb', User: SYSDBA
SQL> select 'мама' as d from rdb$database;

D

мама

SQL> recreate exception e_incorrect_value 'Некорректное значение @1';
SQL> set term ^;
SQL> execute block
CON> as
CON> begin
CON> exception e_incorrect_value using('abc');
CON> end^
Statement failed, SQLSTATE = HY000
exception 1
-E_INCORRECT_VALUE
-Некорректное значение abc
SQL> execute block
CON> as
CON> begin
CON> exception e_incorrect_value using('абв');
CON> end^
Statement failed, SQLSTATE = HY000
exception 1
-E_INCORRECT_VALUE
-Некорректное значение абв // this is bug
SQL>

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

> " // this is bug "

This is what I told you about charset of exceptions. It's well know thing.

@firebird-automations
Copy link
Collaborator Author

Commented by: @sim1984

Why exceptions don't use UNICODE_FSS as it is done by stored procedures?

If the parameterized exceptions work as they work now (distorting not ASCII characters coming from parameters), their significance considerably decreases.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

I've fixed it as is possible now.

It will work correctly when the stored exception encoding matches the connection charset.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 2 [ 10560 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @sim1984

I confirm. Bug fixed.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

Test Details: Test implemented using UTF8 in order to check multiple languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants