Sqlite how to.

Hi guys i’m building an app using sqlite module , but i’m struggling to understand how can i use it like a function.

i’m opening the database connection in my mainview and creating tabs

var sqlite = require('SQLite');
var db = sqlite.open("Park.sqlite");
db.execute("create table if not exists Settings (Walkthrough VARCHAR(50) NOT NULL, Geolocation VARCHAR(50) NOT NULL, Camera VARCHAR(50) NOT NULL, Notification VARCHAR(50) NOT NULL, Token VARCHAR(50) NOT NULL, PRIMARY KEY (Walkthrough))");
db.execute("create table if not exists Place (address VARCHAR(50) NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY (address))")
db.execute("create table if not exists driverProfileDto (deposit VARCHAR(50) NOT NULL, driverBankingInformationStatus VARCHAR(50) NOT NULL, driverCriminalRecordStatus VARCHAR(50) NOT NULL, driverHomeAddressProofStatus VARCHAR(50) NOT NULL, driverLicenceStatus VARCHAR(50) NOT NULL, driverNationalIdDocStatus VARCHAR(50) NOT NULL, firstName VARCHAR(50) NOT NULL, lastName VARCHAR(50) NOT NULL, login VARCHAR(50) NOT NULL, nbWarning DOUBLE NOT NULL, phoneNumber VARCHAR(50) NOT NULL, points DOUBLE NOT NULL, professionEnum VARCHAR(50) NOT NULL, siretNumber VARCHAR(50) NOT NULL, siretStatus VARCHAR(50) NOT NULL, statusEnum VARCHAR(50) NOT NULL, PRIMARY KEY (deposit))")

then i have a sql service file with some function , so i can call them everywhere in my app.

var sqlite = require('SQLite');
var db = sqlite.open("Park.sqlite");

function SaveSettings(Walkthrough, Geolocation, Camera, Notification, Token){
  return new Promise(function(resolve, rejec){
    db.execute("insert into Settings values (?, ?, ?, ?, ?)", Walkthrough, Geolocation, Camera, Notification, Token);

function loadSettings() {
  return new Promise(function(resolve, reject){
    var r = db.query("select * from Settings");

module.exports = {
  loadSettings: loadSettings,
  SaveSettings: SaveSettings

But every time i save something , and try to retrieve it , i have an empty value

Hi prince,

you will need to provide a complete reproduction if you want more eyes on the issue at hand.

Aside from that, have you tried to add some debugging throughout the app? If I were you, I would console.log() everything at every step and figure out where it fails (if it does).

nothing fails
a complete reproduction can be found here

TypeError: db.excute is not a function because of this line in lib/sql.js:

db.excute("insert into Settings values(?,?,?,?,?)", params, update, params1, update1, update2);

It has to say db.execute (you missed an “e”). Please also note that “add some debugging throughout the app”, means I expect you to do so - in this case, adding a .catch() block to the promises did the trick. It’s unfortunately hard for me to attempt to help you if you do not follow my directions.

Here’s your new save() function for front.ux:

  function save(){
    database.SaveValues(true, true, true, true, "hahaha" ).then(function(results){
    }).catch(function(e) {
      console.log("error: " + e);