Issue Details (XML | Word | Printable)

Key: CORE-3164
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Pierre Yager
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Parameterized requests involving blob fields fails when connected using charset UTF8

Created: 06/Oct/10 12:08 PM   Updated: 24/Feb/11 11:08 AM
Component/s: Charsets/Collation, Engine
Affects Version/s: 2.5.0
Fix Version/s: 2.5.1, 3.0 Alpha 1

Time Tracking:
Not Specified

Environment: Firebird 2.5 x64 or Win32, Delphi 2010 client application using UIB components (from SVN trunk) or Python client application using KInterbasDb driver.
Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
create database test user 'SYSDBA' password 'masterkey' default character set UTF8;
create table TEST (WINDOW_NAME VARCHAR(100), MACRO BLOB SUB_TYPE 1);
select count(*) from TEST where WINDOW_NAME=? and MACRO starting with ?;

Give any text values you want.

If client connection uses charset UTF8, you will get this error :

Dynamic SQL Error
SQL error code = -303
arithmetic exception, numeric overflow, or string truncation
string right truncation
Incompatible column/host variable data type

If connected using an ANSI charset (WIN1252 in my test case), the query runs without error.

As Adriano said in firebird-devel (http://sourceforge.net/mailarchive/forum.php?thread_name=4CAC54AD.2040407%40gmail.com&forum_name=firebird-devel) this could be related to the fact the described parameter has a too small length.

For memory, here is the python/kinterbasdb log of a session reproducing this problem :

C:\Python26>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import kinterbasdb;
>>> kinterbasdb.init(type_conv=300)
>>> c = kinterbasdb.connect(dsn='localhost:c:\\databases\\test.fdb', user='SYSDBA', password='masterkey', charset='UTF8')
>>> cur = c.cursor();
>>> cur.execute('select count(*) from TEST where WINDOW_NAME=? and MACRO starting with ?', ('A_NAME', 'SOMETHING',))
>>> cur.fetchone()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
kinterbasdb.ProgrammingError: (-303, 'fetch:
Dynamic SQL Error\n SQL error code = -303
arithmetic exception, numeric overflow, or string truncation
string right truncation')
>>>

It seems that the problem is also in Firebird 2.1 but it doesn't raises any exception.

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Pierre Yager added a comment - 08/Oct/10 09:21 AM
I can confirm that the fix seems to work well in today's build (WI-V2.5.0.26094 Firebird 2.5). Thank you Adriano.