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

Silent truncation when using utf8 parameters and utf8 client character set encoding [CORE2615] #3025

Closed
firebird-automations opened this issue Sep 3, 2009 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Bill Oliver (verbguy)

Is related to QA415

Attachments:
utftest.cpp

Inserting a too-long string value using an input parameter, with UTF8 client character set encoding, produces silent truncation. Should produce a truncation error. Confirmed by Adriano.

I'm connecting to database using client character set of UTF8. I have one
table, TEST, created like this:

CREATE TABLE test (c CHAR(10) CHARACTER SET UTF8);

I prepare this statement:

INSERT INTO test VALUES (?)

I attempt to insert a value of '012345679012345' into the column. There are
15 characters, so I expect a truncation error and no data inserted.

If I connect with client character set of NONE, I get the error, as I
expect.

If I connect with client character set of UTF8, then I get no error. But the
data *is* truncated. Why no error? That does not seem right, but maybe it is
something I forget to do??

Here is problem using encoding of UTF8

bb04s6401:/r/sanyo.unx.sas.com/vol/vol10/u101/bioliv> ./utftest UTF8

beginning test ./utftest..., encoding is UTF8

done!
bb04s6401:/r/sanyo.unx.sas.com/vol/vol10/u101/bioliv> isql fbtest.fdb
Database: fbtest.fdb
SQL> select * from test;

C

1234567890

SQL>

Here it is with encoding of NONE (no records are inserted)

bb04s6401:/r/sanyo.unx.sas.com/vol/vol10/u101/bioliv> ./utftest NONE

beginning test ./utftest..., encoding is NONE

arithmetic exception, numeric overflow, or string truncation
-string right truncation
bb04s6401:/r/sanyo.unx.sas.com/vol/vol10/u101/bioliv> isql fbtest.fdb
Database: fbtest.fdb
SQL> select * from test;
SQL>

To reproduce this, (1) create a database "fbtest.fdb" in current directory,
(2) create table test as above, (3) run "utftest UTF8" for UTF8 encoding,
and "utftest NONE" for NONE.

Here is my compilation line on S64

CC -g -m64 -I/u/bioliv/firebird2h1/gen/firebird/include
tftest.cpp -L$FIREBIRD/lib -lfbembed -o utftest

test case attached.

Commits: c8a6620

@firebird-automations
Copy link
Collaborator Author

Commented by: Bill Oliver (verbguy)

test case demonstrating the problem

@firebird-automations
Copy link
Collaborator Author

Modified by: Bill Oliver (verbguy)

Attachment: utftest.cpp [ 11495 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.5 RC1 [ 10362 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA415 [ QA415 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pmakowski

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: Done successfully

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