2012/3/12 Richard Brown <[email protected]>:
> This seems like a limitation of Firebird, rather than NH or Linq.  Shouldn't
> we just ignore this test on Firebird?

Firebird supports two-argument substring, so it seems a shame if the
linq provider obstructs this by insisting on creating a third
argument. So in a way I think this is LINQ trying to work around an
HQL limitation.


Concerning making HQL always support the two-argument form, things
seem to look rather good. For the dialects which does not already
support this:

MSSQL (all versions, it seems): Always requires three arguments, but
the third argument can be larger than the length of the remainder of
the string, i.e. Int32.MaxValue.

MySql: Actually supports ANSI substring(), so the dialect should just
be corrected.

DB2: I suspect the current dialect's substring doesn't work at all
because DB2 requires a weird fourth argument, which I think the
dialect can insert as a constant. Other than that it should use ANSI
substring, which supports optional length.

Ingres: “Ingres 2006 SQL reference guide”: Supports substring(str from
loc [for len])

SybaseASE15Dialect: This seems to be the only question mark. The third
argument is not optional, and there is no statement what happens if
the length is "oversized". This can be worked around by having the
dialect construct a third argument from len(first_argument) - start.


In summary: all dialects can be made to support two-argument substring
with little work.

/Oskar

Reply via email to