Skip to content

Commit efed80d

Browse files
committed
Enable some tests involving substring() for Firebird, as it should now work (following fix for NH-3587, related to NH-3409).
1 parent 8f5d3c2 commit efed80d

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

src/NHibernate.Test/Hql/HQLFunctions.cs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,16 @@ public void SubStringTwoParameters()
253253

254254
// In the where clause.
255255
hql = "from Animal a where substring(a.Description, 4) = 'def'";
256-
var result = (Animal)s.CreateQuery(hql).UniqueResult();
256+
var result = (Animal) s.CreateQuery(hql).UniqueResult();
257257
Assert.AreEqual("abcdef", result.Description);
258258

259259
// With parameters and nested function calls.
260-
if (!(Dialect is FirebirdDialect)) // Firebird only supports integer literals for start (and length).
261-
{
262-
hql = "from Animal a where substring(concat(a.Description, ?), :start) = 'deffoo'";
263-
result = (Animal) s.CreateQuery(hql)
264-
.SetParameter(0, "foo")
265-
.SetParameter("start", 4)
266-
.UniqueResult();
267-
Assert.AreEqual("abcdef", result.Description);
268-
}
260+
hql = "from Animal a where substring(concat(a.Description, ?), :start) = 'deffoo'";
261+
result = (Animal) s.CreateQuery(hql)
262+
.SetParameter(0, "foo")
263+
.SetParameter("start", 4)
264+
.UniqueResult();
265+
Assert.AreEqual("abcdef", result.Description);
269266
}
270267
}
271268

@@ -295,12 +292,6 @@ public void SubString()
295292
Assert.AreEqual("abcdef", result.Description);
296293

297294

298-
if (Dialect is FirebirdDialect)
299-
{
300-
// Firebird only supports integer literals for start (and length).
301-
return;
302-
}
303-
304295
// Following tests verify that parameters can be used.
305296

306297
hql = "from Animal a where substring(a.Description, 2, ?) = 'bcd'";

src/NHibernate.Test/Linq/FunctionTests.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,19 @@ where NHibernate.Test.Linq.FunctionTests.SqlMethods.Like(e.FirstName, "Ma%et")
4747
[Test]
4848
public void SubstringFunction2()
4949
{
50-
if (Dialect is FirebirdDialect)
51-
Assert.Ignore("Firebird before 2.0 only support integer literals for substring() - NH generates parameters.");
52-
5350
var query = (from e in db.Employees
54-
where e.FirstName.Substring(0, 2) == "An"
55-
select e).ToList();
51+
where e.FirstName.Substring(0, 2) == "An"
52+
select e).ToList();
5653

5754
Assert.That(query.Count, Is.EqualTo(2));
5855
}
5956

6057
[Test]
6158
public void SubstringFunction1()
6259
{
63-
if (Dialect is FirebirdDialect)
64-
Assert.Ignore("Firebird before 2.0 only support integer literals for substring() - NH generates parameters.");
65-
6660
var query = (from e in db.Employees
67-
where e.FirstName.Substring(3) == "rew"
68-
select e).ToList();
61+
where e.FirstName.Substring(3) == "rew"
62+
select e).ToList();
6963

7064
Assert.That(query.Count, Is.EqualTo(1));
7165
Assert.That(query[0].FirstName, Is.EqualTo("Andrew"));

0 commit comments

Comments
 (0)