Getting started
This guide will help you to get started with SQLite functionalities of SQL-Tools package.
Importing the library
To use the functionality of sqlite
package of SQL-Tools
we first have to import the module as a sub-module from the SQL-Tools
package. This can be done very easily by writing the following code:
In this way, all the functionalities of sqlite
package get imported into your program. Now, we can use any function of the package.
Working with databases
Connecting the database
To work with any database we fist have to connect it to the sqlite driver of SQL-Tools. Without specifying the database we cannot use any function of sqlite
. Here's is a quick code to help you out in connecting the database:
We can also connect multiple databases at a time to work simultaneously with them by providing an array of database names.
Verifying the connection
To verify that we are successfully connected or not after above step is to, we use the constants package of SQL-Tools
. This package contains all the values that is used by the package to work upon with the databases.
Don't change any value inside the constants
package, it can cause the library to malfunction.
We can do this as follows:
Disconnecting the database
It's a good practice to disconnect the databases that're not in use in our program. So, to disconnect the connect database(s):
We can also disconnect multiple database at a time by providing an array of database names:
We can also disconnect all the databases at a time by providing no argument to the function:
SQLite specific constants
__dbSqlite__
: Used to store the connected database names.
Last updated
Was this helpful?