SQLite Default Timeout Value in Connection String – Explanation

csqlite

I have looked at the SQLite documentation and I can't find anything clear about the value "Default Timeout".

Looking at other websites, it seems to refer to some sort of "Connection timeout", while other sites indicate that it is more of a "Command timeout"

Some quick tests don't seem to indicate that it has anything to do with Commands.

Can anybody confirm/reference what the purpose of that value in the connection string is for?

Edit this is using the official SQLite .NET library

Best Answer

I found this out by looking at the source code: The timeout value of a command is initialized to DefaultTimeout and passed to the internal SQLite3.Prepare function.

This is used to control a loop that automatically retries statements that fail with a Locked or Busy error. When the timeout has expired (as measured by Environment.TickCount), then an exception is thrown with whatever the most recent error code was. Otherwise, it sleeps for a random amount of time (between 1 and 150 ms) and tries again.