Igor,
>I'm not sure where you are seeing this. The collation function doesn't >have a sqlite3* parameter No, of course you're right (surprised ? ;-) ): I was doing more things than my personal stack could hold. Sorry for that. Great age, slow multitask... >SQLite doesn't seem prepared to handle the case of a collation function >failing. When this happens, to maintain database integrity, any >transaction in progress should be rolled back immediately. You should be >able to do that with sqlite3_interrupt, or you could instruct the >calling code in some way to do that. But _this_ is the problem! How can I safely signal anyhow the "client" program that something is turning in turmoil under the water? I'm building a loadable extension and I have no clue which program will run over my head. The only layer to which I can report is the SQLite core (itself as a .lib, most of the times). From what I've read from sqlite3_interrupt, it should be reserved to application code and used with great care. >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" (?). 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. BTW while wandering in the 3.6.18 amalgamation source looking at how allocation failures are handled, I found a number of sqlite3_malloc whose return values are used (written to) head first without prior checking against 0. It may be safe to do so in certain situations but it doesn't sound like a good idea in general. It's also quite possible that there's no provision in the relevant code to report malloc failures, just like when collation run. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users