Permalink
Browse files

EmulatedLengthSubstringFunction.cs: Strengthen syntax with extra para…

…meters around the start parameter placed inside the generated length parameter.
  • Loading branch information...
1 parent ab70924 commit 5f79ad18d51b573127c6c40213f18ed60f7f2c1f @oskarb oskarb committed Mar 13, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/NHibernate/Dialect/Function/EmulatedLengthSubstringFunction.cs
View
2 src/NHibernate/Dialect/Function/EmulatedLengthSubstringFunction.cs
@@ -35,7 +35,7 @@ public override SqlString Render(IList args, ISessionFactoryImplementor factory)
if (args.Count == 2)
{
// Have the DB calculate the length argument itself.
- var lengthArg = new SqlString("len(", args[0], ") + 1 - ", args[1]);
+ var lengthArg = new SqlString("len(", args[0], ") + 1 - (", args[1], ")");
args = new[] { args[0], args[1], lengthArg };
// Future possibility: Some databases, e.g. MSSQL, allows the length

0 comments on commit 5f79ad1

Please sign in to comment.