Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 90af257

Browse files
author
Oleg Nadymov
committed
Fix for ParseTokens
1 parent 629d145 commit 90af257

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/ServiceStack.OrmLite/OrmLiteUtils.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,9 @@ public static List<string> ParseTokens(this string expr)
10241024
if (endPos == -1)
10251025
endPos = expr.Length;
10261026

1027-
to.Add(expr.Substring(pos, endPos - pos).Trim());
1027+
var arg = expr.Substring(pos, endPos - pos).Trim();
1028+
if (!string.IsNullOrEmpty(arg))
1029+
to.Add(arg);
10281030

10291031
pos = endPos;
10301032
continue;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using NUnit.Framework;
2+
3+
namespace ServiceStack.OrmLite.Tests
4+
{
5+
[TestFixture]
6+
public class OrmLiteUtilsTests
7+
: OrmLiteTestBase
8+
{
9+
[Test]
10+
public void ParseTokens()
11+
{
12+
var sql =
13+
@"(CASE WHEN NOT (((""table_1"".""_display_name"") is null or (""table_1"".""_display_name"") = '')) THEN (""table_1"".""_display_name"") ELSE ""table_1"".""_name"" END) + ""tabel_2"".""_name""";
14+
var tokens = OrmLiteUtils.ParseTokens(sql);
15+
16+
Assert.AreEqual(1, tokens.Count);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)