CaseInsensitiveComparison BUG with VARCHAR Key

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for DB2
Post Reply
dantesbr
Posts: 2
Joined: Mon 15 Jun 2015 17:12

CaseInsensitiveComparison BUG with VARCHAR Key

Post by dantesbr » Wed 28 Oct 2015 19:13

I have this same issue but in dotConnect for DB2: http://forums.devart.com/viewtopic.php? ... Comparison

I'm using:
  • Devart dotConnect for DB2 Pro v1.8.622 (22-Oct-15)
  • .NET 4.5
  • EF 6.1.3
  • DB2 9.7
Best regards,

Silvio C

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: CaseInsensitiveComparison BUG with VARCHAR Key

Post by Shalex » Fri 30 Oct 2015 17:46

Thank you for your report. We are investigating the issue. Please specify the additional information:
1) the exact text of the error and its call stack
2) the generated SQL (turn on dbMonitor)

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: CaseInsensitiveComparison BUG with VARCHAR Key

Post by Shalex » Tue 03 Nov 2015 15:37

We still cannot reproduce the described issue. Please specify the additional information:
1) the exact text of the error and its call stack
2) the generated SQL (turn on dbMonitor)

dantesbr
Posts: 2
Joined: Mon 15 Jun 2015 17:12

Re: CaseInsensitiveComparison BUG with VARCHAR Key

Post by dantesbr » Thu 12 Nov 2015 20:02

Shalex wrote:We still cannot reproduce the described issue. Please specify the additional information:
1) the exact text of the error and its call stack
2) the generated SQL (turn on dbMonitor)
1) the text, in portuguese: [IBM][DB2/NT64] SQL0440N No function by the name "TOUPPER" of type "FUNCTION" having compatible arguments.

Code: Select all

System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> Devart.Data.DB2.DB2Exception: ERROR [42884] [IBM][DB2/NT64] SQL0440N  No function by the name "TOUPPER" of type "FUNCTION" having compatible arguments.
   em Devart.Data.DB2.c.i()
   em Devart.Data.DB2.DB2Command.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
   em Devart.Data.DB2.DB2Command.ExecuteNonQuery()
   em Devart.Common.Entity.dg.ExecuteNonQuery()
   em Devart.Data.DB2.Entity.v.f()
   em System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<NonQuery>b__0(DbCommand t, DbCommandInterceptionContext`1 c)
   em System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   em System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand command, DbCommandInterceptionContext interceptionContext)
   em System.Data.Entity.Internal.InterceptableDbCommand.ExecuteNonQuery()
   em System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
   em System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
   --- Fim do rastreamento de pilha de exceções internas ---
   em System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
   em System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<Update>b__2(UpdateTranslator ut)
   em System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func`2 updateFunction)
   em System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
   em System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__35()
   em System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   em System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
   em System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass2a.<SaveChangesInternal>b__27()
   em System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   em System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
   em System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
   em System.Data.Entity.Internal.InternalContext.SaveChanges()
   --- Fim do rastreamento de pilha de exceções internas ---
   em System.Data.Entity.Internal.InternalContext.SaveChanges()
   em System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
   em System.Data.Entity.DbContext.SaveChanges()
   em Abp.EntityFramework.AbpDbContext.SaveChanges() 
   em Brain.CRM.RapidWebDev.EntityFramework.BrainDbContext.SaveChanges() 
   em Brain.CRM.RapidWebDev.EntityFramework.BrainDbContext.<>c__DisplayClass9.<funcGetNewCode>b__7() 
2) my code execute this:

Code: Select all

db.Set<ATDIC01080>().FirstOrDefault(x => x.NA_SEQN == tableName) => SELECT 
"Extent1".NA_SEQN,
"Extent1".CO_SITU,
"Extent1".DT_INSR,
"Extent1".CO_USER_INSR,
"Extent1".DT_LAST_UPDT,
"Extent1".CO_USER_LAST_UPDT,
"Extent1".ID_INFO_SYST,
"Extent1".NU_INCR_BYNU,
"Extent1".NU_LAST_NUMB
FROM DB2ADMIN.ATDIC01080 "Extent1"
WHERE (UPPER("Extent1".NA_SEQN)) = (UPPER('MSPRO98022'))
FETCH FIRST 1 ROWS ONLY
and then, try to perform a update:

Code: Select all

var seqn = Convert.ToInt32(atdic01080.NU_LAST_NUMB + atdic01080.NU_INCR_BYNU);
atdic01080.NU_LAST_NUMB = seqn;
atdic01080.DT_LAST_UPDT = DateTime.Now;
db.SaveChanges(); => UPDATE DB2ADMIN.ATDIC01080
   SET DT_LAST_UPDT = TIMESTAMP('2015-11-12 16:42:52'), NU_LAST_NUMB = 1691147
 WHERE (ToUpper(NA_SEQN)) = (ToUpper('MSPRO98022'))
the migration of this table:

Code: Select all

CreateTable(
    "DB2ADMIN.ATDIC01080",
    c => new
        {
            NA_SEQN = c.String(nullable: false, maxLength: 15, unicode: false),
            CO_SITU = c.String(nullable: false, maxLength: 5, unicode: false),
            DT_INSR = c.DateTime(nullable: false),
            CO_USER_INSR = c.String(nullable: false, maxLength: 20, unicode: false),
            DT_LAST_UPDT = c.DateTime(nullable: false),
            CO_USER_LAST_UPDT = c.String(nullable: false, maxLength: 20, unicode: false),
            ID_INFO_SYST = c.String(nullable: false, maxLength: 1, fixedLength: true, unicode: false),
            NU_INCR_BYNU = c.Decimal(nullable: false, precision: 18, scale: 2),
            NU_LAST_NUMB = c.Decimal(nullable: false, precision: 18, scale: 2),
        })
    .PrimaryKey(t => t.NA_SEQN);

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: CaseInsensitiveComparison BUG with VARCHAR Key

Post by Shalex » Fri 13 Nov 2015 14:05

Thank you for the additional information. We have reproduced the issue. We will notify you when the problem is fixed.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: CaseInsensitiveComparison BUG with VARCHAR Key

Post by Shalex » Thu 26 Nov 2015 15:27

The bug with applying config.QueryOptions.CaseInsensitiveComparison for non SELECT queries is fixed in the newest (1.8.644) build of dotConnect for DB2: http://forums.devart.com/viewtopic.php?f=52&t=32833.

Post Reply