Using the latest SQLite, 3.9.1, running on Windows 7.
Created a simple SQLite UDF with sqlite3_create_function and that function
only sets the result as a fixed integer value, 123.
The function is registered fine, so no error.
I call this function XXX.

Have a table like this:
CREATE TABLE FUNCTION_TEST([FIELD1] INTEGER, [FIELD2] TEXT)

and insert some data, only 3 rows:

INSERT INTO FUNCTION_TEST Values(1, 'A')"
INSERT INTO FUNCTION_TEST Values(2, 'B')"
INSERT INTO FUNCTION_TEST Values(3, 'C')"

All this is fine as well, so no errors.

I then run this SQL:
SELECT
FIELD1,
XXX(FIELD1)
FROM FUNCTION_TEST
limit 1

The statement prepares fine (sqlite3_prepare16_v2) but after the first
sqlite3_step
I get an error: unknown error, Extended error code: 100.
I do get the results though and these are fine: 1, 123, but obviously I
can't go further
(if I left the limit 1 off) and in fact I get an application crash, that is
Excel crashes, as I
am running this from VBA via a VB6 ActiveX dll.

Running this SQL instead is all fine:

SELECT
XXX(FIELD1)
FROM FUNCTION_TEST

and this is fine as well:

SELECT FIELD1, FIELD2 FROM FUNCTION_TEST
UNION ALL
SELECT XXX(FIELD1), FIELD2 FROM FUNCTION_TEST

I do understand that most likely the problem is somewhere in my VB6 code,
but I can't see it and maybe somebody can shed some light on this from the
SQLite side.


RBS

Reply via email to