Bug if use Replace with parameter
---------------------------------

                 Key: DNET-840
                 URL: http://tracker.firebirdsql.org/browse/DNET-840
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 6.1.0.0
         Environment: win64, fb3.0.1
            Reporter: jack128
            Assignee: Jiri Cincura


script to create db:

CREATE DATABASE 
'localhost:C:\Data\TEMP_3ED4BB49-EE30-4D79-8038-EBC5C24C536D.FDB'
USER 'SYSDBA' PASSWORD 'masterkey';

create table TempTable (caption varchar(255));

insert into TempTable values('1'); 
commit;

test:
        static void Main(string[] args)
        {
            var filename = 
@"C:\Data\Temp_3ED4BB49-EE30-4D79-8038-EBC5C24C536D.fdb";
 
            var connectionString = new FbConnectionStringBuilder
            {
                UserID = "SYSDBA",
                Password = "masterkey",
                Database = filename,
            }.ConnectionString;

            using (var conn = new FbConnection(connectionString))
            {
                conn.Open();
                using (var command = conn.CreateCommand())
                {
                    const string sql = @"select * from TempTable t where 
t.caption like Replace(@p, '~', '~~')"; // this query does not return row, 
although should
                    //const string sql = @"select * from TempTable t where 
t.caption like @p"; // this query returns row as expected

                    command.CommandText = sql;
                    var p = command.CreateParameter();
                    p.ParameterName = "p";
                    p.Value = "1";
                    command.Parameters.Add(p);

                    using (var reader = command.ExecuteReader())
                    {
                        if (!reader.Read())
                            throw new Exception("1 row should be returned");
                    }
                }
            }
        }


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

        

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to