Let me see if I understand this correctly: So calling sqlite3_busy_time() allows you sleep for a max of N ms if the database is busy. Basically this function polls for you? When the database is free, it will return with SQLITE_DONE or SQLITE_ROW?
What happens if the database never gets free? Will sqlite3_busy_timeout() just return SQLITE_BUSY? On 9/23/05, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > Doug Hanks wrote: > > Can someone please explain to me, in laymen's terms, what > > sqlite3_busy_timeout() is used for? > > > >> This routine sets a busy handler that sleeps for a while when a > >> table is locked. The handler will sleep multiple times until at > >> least "ms" milliseconds of sleeping have been done. After "ms" > >> milliseconds of sleeping, the handler returns 0 which causes > >> sqlite3_exec() to return SQLITE_BUSY. > > > > Perhaps an example with an explaination is in order? > > Suppose you are trying to perform a select, but there's an update > currently in progress. Without sqlite3_busy_timeout or explicit busy > handler, your operation will fail immediately with SQLITE_BUSY. But if > you set up sqlite3_busy_timeout, SQLite will automatically retry your > operation several times before erroring out. Hopefully the writing > transaction completes before the timeout has expired, and your select is > allowed to proceed. > > Igor Tandetnik > > -- - Doug Hanks = dhanks(at)gmail(dot)com