Re: [sqlite] Question about coalesce and data types

2014-08-21 Thread Keith Medcalf
>Is there a way to write my own coalesce-Function (or indeed any >function) so that its result has an affinity? The documentation of the >sqlite3_result_* family of functions suggests not. No. But you can cast the result to whatever type you wish: cast(coalesce(a, 5) as TEXT) and it will

Re: [sqlite] Question about coalesce and data types

2014-08-21 Thread Martin Engelschalk
Am 21.08.2014 11:39, schrieb Clemens Ladisch: Martin Engelschalk wrote: It seems the solution is to actually pass all bind variable values by their appropriate sqlite3_bind_* - function instead of just using sqlite3_bind_text. However, this means quite a lot of work for me. Isn't it also work

Re: [sqlite] Question about coalesce and data types

2014-08-21 Thread Clemens Ladisch
Martin Engelschalk wrote: > It seems the solution is to actually pass all bind variable values by > their appropriate sqlite3_bind_* - function instead of just using > sqlite3_bind_text. However, this means quite a lot of work for me. Isn't it also work for you to converting your values to text?

Re: [sqlite] Question about coalesce and data types

2014-08-21 Thread Martin Engelschalk
Hello Clemens, thank you for your answer; i understand now why the where - condition returns 'false'. Also, the effect is independent of the function used. It seems the solution is to actually pass all bind variable values by their appropriate sqlite3_bind_* - function instead of just using

Re: [sqlite] Question about coalesce and data types

2014-08-20 Thread Clemens Ladisch
Martin Engelschalk wrote: > create table TestTable (col_a numeric); > insert into TestTable (col_a) values (1); > > retrieve the row, as expected: > > select * from TestTable where col_a = '1'; > > do not retrieve the row: > > select * from TestTable where coalesce(col_a, 5) = '1' > > Can someone

[sqlite] Question about coalesce and data types

2014-08-20 Thread Martin Engelschalk
Hello list, I checked the coalesce function and observed the follwoing results: I create a simple table with one column and one row: create table TestTable (col_a numeric); insert into TestTable (col_a) values (1); commit; The following statements retrieve the row, as expected: select *