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 sqlite3_bind_text. However, this means quite a lot of work for me. 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.

Thank you
Martin


Am 20.08.2014 12:03, schrieb 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 please explain this to me or point me to some documentation?
The col_a column has numeric affinity, so the string '1' is converted
into a number.  <http://www.sqlite.org/datatype3.html#affinity>

The return value of the function has NONE affinity, so no automatic
conversion happens.  <http://www.sqlite.org/datatype3.html#expraff>


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

--

*Codeswift GmbH *
Kräutlerweg 20a
A-5020 Salzburg
Tel: +49 (0) 8662 / 494330
Mob: +49 (0) 171 / 4487687
Fax: +49 (0) 3212 / 1001404
engelsch...@codeswift.com
www.codeswift.com / www.swiftcash.at

Codeswift Professional IT Services GmbH
Firmenbuch-Nr. FN 202820s
UID-Nr. ATU 50576309

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to