Interestingly, a few months ago I did try to utilize a case statement
with SQLFunctionTemplate, but failed.

Definitely agree that the assumption that the arguments will be the
same number and order is rather lacking.  There are even places in
NHibernate today where the assumption of "same number of arguments in
same order" is violated.  For example, AnsiTrimEmulationFunction and
Oracle8iDialect.  I'm not sure but it seems like those would fail to
function properly in some cases.

I also tried converting the parameters on the IQuery into named
parameters, but when calling Render the parameters were just the ?
placeholders again.  The code then fails to execute complaining there
aren't enough parameters present to fill all the slots.

It would be very useful to have a general template mechanism such as
the one Frans mentioned.

If I'm just throwing out ideas, sometimes it would be possible for the
system to optimize the query before executing.  For example,
NullSafeEquals(COLUMN, @p0) could become simply COLUMN IS NULL if @p0
was null.  That would require a mechanism to deal with caching.  I'm
not particularly worried about this query simplification, it would
just be desirable.

Is there something interesting about mapping LINQ methods?  I assumed
that you'd just map a particular C# method signature to a particular
HQL method signature and leave it in the HQL AST.  The regular HQL
function transformation mechanism would do the rest of the work of
making the SQL.

        Patrick Earl

Reply via email to