Odds and Ends
Now that you have been introduced to all the day-to-day functions you'll use when working with SQLite, the following is a collection of functions that more or less stand on their own. The first of these functions relates back to the beginning of the chapter when I discussed how SQLite handles locking during writes to a table within the database. Although generally it is not necessary, SQLite can be instructed to give up attempting to write to a database after a certain time interval set by the sqlite_busy_timeout() function whose syntax is as follows:
$db is the database handle resource and $time is the time (in milliseconds) to wait for a database to become unlocked before returning a SQLITE_BUSY error. By default, SQLite will wait a maximum of 60 seconds (60,000 milliseconds) before returning an error. Setting the $time value to zero will instruct SQLite to wait indefinitely for the database to be unlocked.
Although mostly applicable to situations where your PHP scripts must be functional on a variety of systems, the SQLite extension provides two functions to assist you in determining whether the version SQLite installed is sufficient for your script's need. These two functions are sqlite_libversion(), which returns the version of the SQLite library being used, and sqlite_libencoding(), which returns the encoding of the underlying SQLite library (which can be either ISO-8859-1 or UTF-8). Neither of these two functions requires any parameters.