Personally I didn't understand which is the function you are needing.
Can you explain a usecase ?

In criteria base queries with a property compared to a parameter that
function is unneeded... perhaps you are thinking something else than
EqOrNullExpression... I'll wait your explication.

On Sat, Aug 28, 2010 at 4:02 PM, Patrick Earl <[email protected]> wrote:

> Solution #1 (duplicate positional parameters based on template
> contents) looks to be somewhat complicated to implement.
> Solution #2 (manipulate HQL AST and parameter list) doesn't work for
> ICriteria / QueryOver.
> Solution #3 (replace positional parameters with named) seems
> potentially viable.
>
> I have two "big" questions:
>
> 1.  Are there cases where positional parameters are required, or is it
> reasonable to always pre-process positional parameters into named
> parameters?  Along with this, what kind of parameters do the criteria
> API and Linq generate?  Are they always named parameters?
> 2.  Why is it required that the type of a null parameter is known.  In
> other words, why is it necessary to call SetParameter with a type
> overload?  Is there any way to say "put NULL in the DB query and
> disregard the type?"
>
> I'll do some digging, but if anyone knows this stuff off-hand, that'd
> be great to know.
>
>        Patrick Earl
>
> On Aug 28, 2:55 am, Patrick Earl <[email protected]> wrote:
> > I'm interested in implementing a function to duplicate the behavior of
> > "IS NOT DISTINCT FROM" on SQL Server.  On PostgreSQL, I'd simply use ?
> > 1 IS NOT DISTINCT FROM ?2 as the function template.  On SQL Server
> > though, the template involves repeating the same argument: (?1 IS NULL
> > AND ?2 IS NULL) OR (?1 IS NOT NULL AND ?2 IS NOT NULL AND ?1 = ?2)
> >
> > Unfortunately, when used with positional parameters, the function
> > template is not processed correctly.  The system duplicates the ?
> > within the query, but it doesn't add another copy of the parameter to
> > the parameter list.  Here are some possible techniques for dealing
> > with this issue:
> >
> > 1.  Create another interface like ISQLParameterizedFunction that
> > allows modification of the parameter list as well.
> > 2.  Allow dialects to access the HQL AST and parameter list and modify
> > them directly.
> > 3.  Replace the positional parameters with named parameters.
> >
> > Sadly, I'm too tired for my brain to work properly.  I just wanted to
> > get these thoughts out there to see if anyone had any feedback or work-
> > arounds.
> >
> >         Patrick Earl
>



-- 
Fabio Maulo

Reply via email to