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.