Hi,
On Mon, 29 Oct 2012 13:01:57 +0200 Vitaliy Aleksandrov
<vitalik.voip(a)gmail.com> wrote:
Have you found the way to run SELECT COUNT(*) ?
I use kamailio 3.2.4 with sqlite 3.7.5-1 and it crashes on such
queries too.
As a workaround I use $dbr(res=>rows) with "SELECT some_field FROM
table" query, but the bug is really exists.
I think I know why the crash happens. And it's easy to "workaround".
However, I'm not sure what would be the proper fix for this. It seems
that sqlite does not support reporting the column type for computed
fields.
This implies that the db_sqlite driver cannot deduce the proper return
value type either (I will likely just hard code it to INT now).
However, this means that other kind of expressions - e.g. string
manipulations - will not work then.
I guess we should first try decltype if available and fall back to
first row column type. However, this will fail too if the first row has
NULL value for the column.
The fundamental problem is that Kamailio DB API expects the driver to
return stored type - which on sqlite is not fixed.
Will try to get something sketched up soonish.
-Timo