Subject | Bug in V2.6.5 on parameterized query? |
---|---|
Author | Harald Binkle |
Post date | 2011-08-30T14:58:25Z |
Hi,
I'm using V2.6.5 with .NET 3.5.
I've got a simple query like:
SELECT * FROM MailObject WHERE MailBody like '%123456%'
MailBody is a column of type "Blob SUB_TYPE BINARY".
The query is composed using parameters in the "FbCommand":
using (command = new FbCommand("SELECT * FROM MailObject WHERE MailBody like @SearchText", connection))
{
FbParameter param = new FbParameter();
param.ParameterName = "@SearchText";
param.Value = "%123456%";
command.Parameters.Add(param);
...
Executing this command results in an "IscException":
arithmetic exception, numeric overflow, or string truncation string right truncation
at FirebirdSql.Data.Common.DbValue.GetBytes() in X:\Lib.NET\Firebird ADO.net\NETProvider_2.6.5\source\FirebirdSql\Data\Common\DbValue.cs:Zeile 255.
at FirebirdSql.Data.Client.Common.XsqldaMarshaler.MarshalManagedToNative(Charset charset, Descriptor descriptor) in X:\Lib.NET\Firebird ADO.net\NETProvider_2.6.5\source\FirebirdSql\Data\Client\Common\XsqldaMarshaler.cs:Zeile 118.
at FirebirdSql.Data.Client.Native.FesStatement.Execute() in X:\Lib.NET\Firebird ADO.net\NETProvider_2.6.5\source\FirebirdSql\Data\Client\Native\FesStatement.cs:Zeile 355.
Because of the check:
case DbDataType.VarChar:
if (this.Field.Charset.IsOctetsCharset)
{
return (byte[])this.value;
}
else
{
string svalue = this.GetString();
if ((this.Field.Length % this.Field.Charset.BytesPerCharacter) == 0 &&
svalue.Length > this.Field.CharCount)
{
throw new IscException(new[] { IscCodes.isc_arith_except, IscCodes.isc_string_truncation });
}
This only happens when the search string within the "%" is longer than 5 chars.
Any idea how to fix this?
Greetings
Harry
________________________________
----------------------------------------------------
JAM Software GmbH
Geschäftsführer: Joachim Marder
Max-Planck-Str. 22 * 54296 Trier * Germany
Tel: 0651-145 653 -0 * Fax: 0651-145 653 -29
Handelsregister Nr. HRB 4920 (AG Wittlich) http://www.jam-software.de
[Non-text portions of this message have been removed]
I'm using V2.6.5 with .NET 3.5.
I've got a simple query like:
SELECT * FROM MailObject WHERE MailBody like '%123456%'
MailBody is a column of type "Blob SUB_TYPE BINARY".
The query is composed using parameters in the "FbCommand":
using (command = new FbCommand("SELECT * FROM MailObject WHERE MailBody like @SearchText", connection))
{
FbParameter param = new FbParameter();
param.ParameterName = "@SearchText";
param.Value = "%123456%";
command.Parameters.Add(param);
...
Executing this command results in an "IscException":
arithmetic exception, numeric overflow, or string truncation string right truncation
at FirebirdSql.Data.Common.DbValue.GetBytes() in X:\Lib.NET\Firebird ADO.net\NETProvider_2.6.5\source\FirebirdSql\Data\Common\DbValue.cs:Zeile 255.
at FirebirdSql.Data.Client.Common.XsqldaMarshaler.MarshalManagedToNative(Charset charset, Descriptor descriptor) in X:\Lib.NET\Firebird ADO.net\NETProvider_2.6.5\source\FirebirdSql\Data\Client\Common\XsqldaMarshaler.cs:Zeile 118.
at FirebirdSql.Data.Client.Native.FesStatement.Execute() in X:\Lib.NET\Firebird ADO.net\NETProvider_2.6.5\source\FirebirdSql\Data\Client\Native\FesStatement.cs:Zeile 355.
Because of the check:
case DbDataType.VarChar:
if (this.Field.Charset.IsOctetsCharset)
{
return (byte[])this.value;
}
else
{
string svalue = this.GetString();
if ((this.Field.Length % this.Field.Charset.BytesPerCharacter) == 0 &&
svalue.Length > this.Field.CharCount)
{
throw new IscException(new[] { IscCodes.isc_arith_except, IscCodes.isc_string_truncation });
}
This only happens when the search string within the "%" is longer than 5 chars.
Any idea how to fix this?
Greetings
Harry
________________________________
----------------------------------------------------
JAM Software GmbH
Geschäftsführer: Joachim Marder
Max-Planck-Str. 22 * 54296 Trier * Germany
Tel: 0651-145 653 -0 * Fax: 0651-145 653 -29
Handelsregister Nr. HRB 4920 (AG Wittlich) http://www.jam-software.de
[Non-text portions of this message have been removed]