Chapter 3. Driver options

Your application has to initialize libdbi drivers by setting some driver options with the dbi_conn_set_option() and the dbi_conn_set_option_numeric() library functions. The sqlite driver supports the following options:

dbname

The name of the database you want to work with. As a SQLite database corresponds to one file in your filesystem, dbname can be any legal filename. If the database/file doesn't exist when you first try to access it, SQLite will create it on the fly.

It is important to understand that the full path of the database is composed of sqlite3_dbdir and dbname. Therefore dbname should not contain the full path of a file, but just the name.

sqlite3_dbdir

This is the directory that contains all sqlite databases. Use the full path please.

Note: It is necessary to keep all sqlite databases in one directory to make it possible to list all existing databases through the libdbi API. However, you are free to open more than one connection simultaneously, each one using a different setting of sqlite3_dbdir.

sqlite3_timeout

The design of SQLite3 does not allow fully concurrent access by two clients. However, if the timeout is larger than zero, the second client will wait for the given amount of time for the first client to release its lock, if necessary. If the timeout is set to zero, the second client will return immediately, indicating a busy status. The numerical value of this option specifies the timeout in milliseconds.