Could somebody tell me what happens after the callback function (to do with sqlite3_create_function) has run, so after it has finished processing one row? Does it return to the code line (in my case in an AciveX dll) directly after the line with sqlite3_step? Or are there other things going on first in sqlite3.dll? The problems is that if I call the user function more that once in the same SQL, eg: select XXX(field1), XXX(field2) from table1 I get a crash directly after the last run of the UDF to do with the first row. The 2 calls to the UDF are running fine, so no error message.
RBS On Mon, Oct 19, 2015 at 2:19 PM, Bart Smissaert <bart.smissaert at gmail.com> wrote: > > The "context" passed to a user defined function is not and cannot be a > "statement handle". > > Yes, you are right there. Not sure now how I thought it was a statement > handle, but this doesn't alter the problem. > Thanks in any case for correcting this mis-conception. > > RBS > > On Mon, Oct 19, 2015 at 1:40 PM, Hick Gunter <hick at scigames.at> wrote: > >> The "context" passed to a user defined function is not and cannot be a >> "statement handle". How would an aggregate function tell the difference >> between >> >> Select SUM(x) ... >> >> and >> >> Select SUM(x), SUM(y) ... >> >> if not by virtue of sqlite3_aggregate_context() returning different >> adresses? >> >> -----Urspr?ngliche Nachricht----- >> Von: sqlite-users-bounces at mailinglists.sqlite.org [mailto: >> sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von Bart >> Smissaert >> Gesendet: Montag, 19. Oktober 2015 13:49 >> An: General Discussion of SQLite Database >> Betreff: Re: [sqlite] Problem with sqlite3_create_function >> >> Still getting a crash here if I use the UDF more than once in the same >> statement: >> >> So, table with 2 integer columns and then doing: >> >> select XXX(field1), XXX(field2) from table1 >> >> causes a crash. >> >> I can see that the statement prepares fine and that the UDF gets called >> twice (for the first row), but with no error, so >> sqlite3_errmsg(lDBHandle) gives not an error, but than my application >> crashes. >> I get the following information about this if it is of any help: >> >> Problem signature: >> Problem Event Name: APPCRASH >> Application Name: EXCEL.EXE >> Application Version: 12.0.6732.5000 >> Application Timestamp: 55f969a5 >> Fault Module Name: sqlite3.dll >> Fault Module Version: 3.9.1.0 >> Fault Module Timestamp: 562138c8 >> Exception Code: c0000005 >> Exception Offset: 0005a28b >> OS Version: 6.1.7601.2.1.0.256.48 >> Locale ID: 2057 >> Additional information about the problem: >> LCID: 1033 >> Brand: Office12Crash >> skulcid: 1033 >> >> Using the UDF once in a statement is fine: >> >> select XXX(field1) from table1 >> >> One thing I noticed is that every time the UDF is called (that is only >> twice, so once for field1 then again for field2) it is with a different >> statement handle. >> Is this to be expected? >> >> >> RBS >> >> >> On Mon, Oct 19, 2015 at 1:21 AM, Bart Smissaert <bart.smissaert at gmail.com >> > >> wrote: >> >> > Actually, I can see now that the result of >> > sqlite3_extended_errcode(lDBHandle) is in fact the same as the result >> > of sqlite3_step as I get for the 3 rows 100, 100, 100, 101 so >> > SQLITE_ROW 3 times then SQLITE_DONE. >> > >> > Note sure though why this is and why I get unknown error as a result >> > of sqlite3_errmsg(lDBHandle). Should that not be: Not an error? >> > >> > In any case it does all work now. >> > >> > RBS >> > >> > >> > >> > On Mon, Oct 19, 2015 at 1:05 AM, Bart Smissaert >> > <bart.smissaert at gmail.com> >> > wrote: >> > >> >> Some progress with this. >> >> Still get an error: unknown error, Extended error code: 100, but it >> >> all runs and get the right results and no crash. >> >> Problem was I did put the result of sqlite3_step in a VB Long datatype: >> >> >> >> Dim lStepResult As Long >> >> >> >> lStepResult = sqlite3_step(lStatementHandle) >> >> >> >> Now I do instead: >> >> >> >> Dim lStepResult 'VB variant datatype >> >> >> >> >> >> RBS >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Sun, Oct 18, 2015 at 10:16 PM, Bart Smissaert < >> >> bart.smissaert at gmail.com> wrote: >> >> >> >>> > Is that binary ? Or hex ? >> >>> >> >>> Normal decimal, it is the result of >> >>> sqlite3_extended_errcode(lDBHandle) >> >>> >> >>> > Just to verify, can you download the SQLite shell tool and try to >> >>> execute the same sequence ? >> >>> >> >>> Not sure that is that simple as the code to produce the result is in >> >>> an ActiveX dll, not in sqlite3.dll. >> >>> >> >>> RBS >> >>> >> >>> On Sun, Oct 18, 2015 at 9:43 PM, Simon Slavin <slavins at bigfraud.org> >> >>> wrote: >> >>> >> >>>> >> >>>> On 18 Oct 2015, at 8:35pm, Bart Smissaert >> >>>> <bart.smissaert at gmail.com> >> >>>> wrote: >> >>>> >> >>>> > I get an error: unknown error, Extended error code: 100. >> >>>> >> >>>> Is that binary ? Or hex ? >> >>>> >> >>>> > 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. >> >>>> >> >>>> Just to verify, can you download the SQLite shell tool and try to >> >>>> execute the same sequence ? >> >>>> >> >>>> Simon. >> >>>> _______________________________________________ >> >>>> sqlite-users mailing list >> >>>> sqlite-users at mailinglists.sqlite.org >> >>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-user >> >>>> s >> >>>> >> >>> >> >>> >> >> >> > >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users at mailinglists.sqlite.org >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >> >> >> ___________________________________________ >> Gunter Hick >> Software Engineer >> Scientific Games International GmbH >> FN 157284 a, HG Wien >> Klitschgasse 2-4, A-1130 Vienna, Austria >> Tel: +43 1 80100 0 >> E-Mail: hick at scigames.at >> >> This communication (including any attachments) is intended for the use of >> the intended recipient(s) only and may contain information that is >> confidential, privileged or legally protected. Any unauthorized use or >> dissemination of this communication is strictly prohibited. If you have >> received this communication in error, please immediately notify the sender >> by return e-mail message and delete all copies of the original >> communication. Thank you for your cooperation. >> >> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users at mailinglists.sqlite.org >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >> > >