Jay Sprenkle wrote:
>> Jay, thank you very much man! That answers a lot. And it showed me that
>> I was not checking the SQLITE_LOCKED case.
>>
>> But, from what I can see, if your database is busy or locked you just
>> stop your program execution, or you will end this function WITHOUT
>> running neither sqlite3_finalize nor sqlite3_close. Either way you will
>> have a memory leak and this is not a good thing when you're running an
>> daemon (my case).
>>
>> What if you put an loop = false instead of the throw at the 'default'
>> case? Do you have to you use sqlite3_interrupt before sqlite3_finalize?
>
> This code was for a benchmark so I wasn't careful to check for locking
> and do good error recovery. You're correct, and all your suggestions
> should be put in.  You'll have to decide what's an appropriate error
> response for your daemon.
>
> I usually use the assumption none of the applications using the database
> will keep it locked for long periods. So retrying for a small time
> after a lock return
> works well for me.
>
That's what I think as well.
But, when you say 'all your suggestions' are you talking about
sqlite3_interrupt too?

Best r.
Daniel Colchete

Reply via email to