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

Parameterized requests involving blob fields fails when connected using charset UTF8 [CORE3164] #3539

Closed
firebird-issue-importer opened this issue Oct 6, 2010 · 8 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Oct 6, 2010

Submitted by: Pierre Yager (pierrey)

Is related to QA445

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.

Commits: 4ba1897 05a37a0

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

Confirmed for 2.5.0 (WI-V2.5.0.26074):
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
(instead of output N = 8 for second record)

Seems to be related to core-3353 -- see comments in .fbt

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 6, 2010

Modified by: Pierre Yager (pierrey)

description: create database test user 'SYSDBA' password 'masterkey' default character set UTYF8;
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.

I client connection is 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

Is 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.

=>

create database test user 'SYSDBA' password 'masterkey' default character set UTYF8;
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.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 6, 2010

Modified by: @pmakowski

assignee: Adriano dos Santos Fernandes [ asfernandes ]

description: create database test user 'SYSDBA' password 'masterkey' default character set UTYF8;
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.

=>

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.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 6, 2010

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.1 [ 10333 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 8, 2010

Commented by: Pierre Yager (pierrey)

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.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 24, 2011

Modified by: @pcisar

Link: This issue is related to QA445 [ QA445 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 27, 2015

Modified by: @pavel-zotov

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

QA Status: Done successfully

Test Details: Confirmed for 2.5.0 (WI-V2.5.0.26074):
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
(instead of output N = 8 for second record)

Seems to be related to core-3353 -- see comments in .fbt

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 25, 2015

Commented by: @pcisar

Test created.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 25, 2015

Modified by: @pcisar

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

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

Successfully merging a pull request may close this issue.

None yet
2 participants