Implements a "cursor like" interface between SQLite and Bash using coprocess.
Implements asynchronous communication between Bash and SQLite. The database manager runs in parallel as coprocess of Bash. Only one SQLite's instance is started per script execution and data sent and received by file descriptors.
There are few functions that implements communication between Bash and SQLite.
Creates a coprocess to access SQLite database.
Use: sqlite_connect "sqlite database filename"
Example:
sqlite_connect "./db/database.db"Kills SQLite coprocess.
Use: sqlite_disconnect
Fetches one line of query result and sends it to STDOUT.
Use: sqlite_fetch
Example:
sqlite_fetch | while read LINE; do
echo "${LINE}"
doneSends a query to database.
Use: sqlite_query "SQL query"
Example:
sqlite_query "select id,name,address,phone from phonebook"Prints debug messages if SQLITE_DEBUG variable is set in 'true'.
Use: sqlite_debug "debug message"
Example:
sqlite_debug "Fetching record..."To more information take a look at example.sh, it contains an example of
how to use this library.