Re: [sqlite] Destruction callback for sqlite3_aggregate_context

2008-11-20 Thread Florian Weimer
* Florian Weimer:

>> On Nov 19, 2008, at 9:59 PM, Florian Weimer wrote:
>>
>>> In order to avoid a resource leak, I think I need some sort of
>>> callback when the memory allocated by sqlite3_aggregate_context is
>>> freed by SQLite.
>>>
>>> As far as I can see, it is not guaranteed that the xFinal function
>>> specified in sqlite3_create_function will be called in all cases, so
>>> this is not the right place to free data referenced by the aggregate
>>> context.
>>
>> It is guaranteed that the xFinal callback will be called in all cases.
>
> Good.  I checked that it's called when sqlite3_interrupt() is invoked,
> so for my purposes, it should be fine.

However, in both cases (sqlite3_interrupt and sqlite3_result_error), I
only get an SQLITE_ERROR with the default error message back from
SQLite.  I think we've discussed this before. 8-/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Destruction callback for sqlite3_aggregate_context

2008-11-19 Thread Florian Weimer
* Dan:

> On Nov 19, 2008, at 9:59 PM, Florian Weimer wrote:
>
>> In order to avoid a resource leak, I think I need some sort of
>> callback when the memory allocated by sqlite3_aggregate_context is
>> freed by SQLite.
>>
>> As far as I can see, it is not guaranteed that the xFinal function
>> specified in sqlite3_create_function will be called in all cases, so
>> this is not the right place to free data referenced by the aggregate
>> context.
>
> It is guaranteed that the xFinal callback will be called in all cases.

Good.  I checked that it's called when sqlite3_interrupt() is invoked,
so for my purposes, it should be fine.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Destruction callback for sqlite3_aggregate_context

2008-11-19 Thread Igor Tandetnik
Florian Weimer <[EMAIL PROTECTED]> wrote:
> As far as I can see, it is not guaranteed that the xFinal function
> specified in sqlite3_create_function will be called in all cases

http://sqlite.org/c3ref/create_function.html

"For an aggregate SQL function created using 
sqlite3_create_function(D,X,N,E,P,0,S,L) the finalizer function L shall 
always be invoked exactly once if the step function S is called one or 
more times."

Igor Tandetnik 



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


Re: [sqlite] Destruction callback for sqlite3_aggregate_context

2008-11-19 Thread Dan

On Nov 19, 2008, at 9:59 PM, Florian Weimer wrote:

> In order to avoid a resource leak, I think I need some sort of
> callback when the memory allocated by sqlite3_aggregate_context is
> freed by SQLite.
>
> As far as I can see, it is not guaranteed that the xFinal function
> specified in sqlite3_create_function will be called in all cases, so
> this is not the right place to free data referenced by the aggregate
> context.

It is guaranteed that the xFinal callback will be called in all cases.

Dan.

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


[sqlite] Destruction callback for sqlite3_aggregate_context

2008-11-19 Thread Florian Weimer
In order to avoid a resource leak, I think I need some sort of
callback when the memory allocated by sqlite3_aggregate_context is
freed by SQLite.

As far as I can see, it is not guaranteed that the xFinal function
specified in sqlite3_create_function will be called in all cases, so
this is not the right place to free data referenced by the aggregate
context.

What can I do instead?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users