Subject Re: SV: [firebird-support] ODBC queries with parameters failing
Author Kurt Fitzner
On 28/02/2013 5:45 AM, Poul Dige wrote:
>
> I don't know if this will solve your problem but usually you use
> variable names as parameters, e.g.
>
>
> select col1 from table 1 where col1 = :myparameter
>
Thanks for the suggestion. Very few ODBC drivers support named
parameters. Most of them require a question mark as a placeholder. The
Firebird driver is no exception.

I have determined that the problem isn't with the use of parameters.
It's with testing a parameter against NULL. For example, the following
statements work:

select col1 from table1 where col1 = ?
select col1 from table1 where (col1 = ? and ? = 1)
select col1 from table1 where (col1 = ? and ? = 'test')

But what I really want, doesn't work:

select col1 from table1 where (col 1 = ? and ? is not null)
select col1 from table1 where (col 1 = ? or ? is null)

So I can test a column against a parameter, and I can test a parameter
against a value, but what I need is to test a column against a parameter
unless the parameter is null. And for some reason I can't test a
parameter to see if it's null.

This really has me stumped, and I'm wondering if it's a bug in the ODBC
driver, as I cannot for the life of me see why it would be a problem.
The Jaybird JDBC works just fine on the same query. It's so sluggish,
though, I really need ODBC to work.

Kurt.



[Non-text portions of this message have been removed]