[ 
http://tracker.firebirdsql.org/browse/DNET-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jiri Cincura reopened DNET-124:
-------------------------------


Reopened for better fix.

> Long VARCHAR parameters in where clause reported as "string truncation"
> -----------------------------------------------------------------------
>
>                 Key: DNET-124
>                 URL: http://tracker.firebirdsql.org/browse/DNET-124
>             Project: .NET Data provider
>          Issue Type: Bug
>          Components: ADO.NET Provider
>    Affects Versions: 2.0.1
>         Environment: WIndows XP, firebird engine 2.01, visual studio 2005 
>            Reporter: St?phane Claret
>            Assignee: Jiri Cincura
>            Priority: Critical
>             Fix For: 2.5.0 Beta 1
>
>
> Hello,
> Let's consider this simple table : 
> -------------------------------------------
> CREATE TABLE DEVISE (
>        CODE_DEVISE Char(3) NOT NULL COLLATE ES_ES_CI_AI,
>        NOM_DEVISE Varchar(20) NOT NULL COLLATE ES_ES_CI_AI,
>        CONSTRAINT PK_DEVISE PRIMARY KEY (CODE_DEVISE)
> );
> INSERT INTO DEVISE (code_devise, nom_devise) VALUES (chg, "test");
> -------------------------------------------
> Now if you try to execute the following code in a c# program
> --------------------------------------------
> FbCommand fb = conex.CreateCommand();
> fb.CommandText = "SELECT *  FROM DEVISE WHERE  DEVISE.CODE_DEVISE LIKE 
> 'chg%'";
> FbDataReader reader = fb.ExecuteReader();
> reader.Read();
> --------------------------------------------
> It works perfectly, (1 row returned ) 
> But now, if you try to execute the same sql statement but by using a 
> parameter in the WHERE Clause instead of a constant value :
> --------------------------------------------
> FbCommand fb = conex.CreateCommand();
> fb.CommandText = "SELECT *  FROM DEVISE WHERE  DEVISE.CODE_DEVISE LIKE 
> @devise1";
> fb.Parameters.Add("@devise1", "chg%");
> FbDataReader reader = fb.ExecuteReader();
> reader.Read();
> --------------------------------------------
> fb.ExecuteReader raises a  numeric overflow / String truncation exception, 
> most probably because the length of  "chg%" (4 chars) exceeds the size of the 
> code_devise column ( CHAR(3) ).
> I think that the lenght of string parameters should not be so strictly 
> enforced when they are used in a WHERE clause because it produces unwanted 
> behavior and prevent execution of statements which are actually correct.
> Regards

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to