Jean-Christophe Deschamps wrote:
>> It would be best, of course, to write your collation function in
>> such a way that it can't fail.
>
> Certainly, in a perfect world, but I'm afraid I forcably need small
> chunks of memory, whose allocation could possibly fail "ungracefully"
> (?).

Can't you preallocate sufficient memory at the time the collation is 
created?

> Of course what I've done for now is pass a null pointer to companion
> routines, which ignore null context (don't invoke
> sqlite3_result_error_nomem(context) in case context is 0).  Most
> probably this won't hurt much just because you never need to sort 1Gib
> strings with complex collation.  But if you do it by mistake, then
> it's an unavoidable crash with possible consequences.

It seems to me that, rather than tricking SQLite into crashing, it would 
be more straightforward to just call abort().

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to