LLBLGen 5.3 truncation detection feature/breaking-change

Posts   
 
    
ansu
User
Posts: 4
Joined: 17-Oct-2017
# Posted on: 30-Oct-2017 08:51:31   

Hi,

After upgrading our LLBLGen project to version 5.3 we have noticed the breaking change that is related to your small change (truncation detection) introduced in v5.3 (v5.3 – what’s new release notes https://www.llblgen.com/Documentation/5.3/LLBLGen%20Pro%20RTF/whatsnew.htm).

"Field compare value predicate now detects value truncation for variable string typed parameters. If it detects truncation, it will emit "1=0" instead of the actual predicate, followed by a comment to make the predicate result in 0 rows. Value truncation occurs if the DbParameter's Value property is set to a value which has a length longer than the 'size' property. The size property of the parameter is set to the length of the field compared against. So if you compare a varchar(20) typed field F to a string with length 25, you'll get 1=0 instead of the comparison of the first 20 chars of the string with the field, which could lead to matches which are unintentional."

We have couple of tables where we use varchar(max)/nvarchar(max) columns upon which we have built queries and predicates with FieldComparePredicate. It seems to us that the truncation detection is somehow automatic on those columns too, since we always get 1=0 instead of the comparision of the string with the field. This was working smoothly untlil the v5.3 upgrade and it introduced the breaking change for us.

Could you please explain us whether you have plans to fix it (in near time) or what’s your recommendation to tackle this problem.

Check attachment please. Thanks

Attachments
Filename File size Added on Approval
1.png 34,172 30-Oct-2017 08:51.40 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 30-Oct-2017 09:48:13   

Reproduced. It occurs on (n)varchar(max) fields as they get a length set to -1 but the check is too simple (it checks only for < length, should also check for > 0).

Fixing...

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 30-Oct-2017 11:25:24   

Fixed in hotfix 5.3.1. Nuget prerelease packages are available with this fix as well as an updated installer.

Frans Bouma | Lead developer LLBLGen Pro