Questions tagged [node-sqlite3]

`node-sqlite3` is an asynchronous, non-blocking SQLite3 bindings module for Node.js.

More info:

278 questions
2
votes
2 answers

Return array of ids from sqlite3 database using node-sqlite3

I want to build an array of ids from a sqlite query using the node-sqlite3 library. const sqlite3 = require('sqlite3') const db = new sqlite3.Database('./db/database-name.db') let ids = () => { let sql = `select id from users;` let result = [] …
Richard
  • 2,226
  • 2
  • 19
  • 35
2
votes
4 answers

Import CSV file in node-sqlite3

I'm using the npm sqlite3 package in my web application for a mock-up restaurant. When my local server is started I'm creating a menuItems table: var db = new sqlite3.Database(':memory:'); db.serialize(function() { db.run('CREATE TABLE menuItems…
natn2323
  • 1,983
  • 1
  • 13
  • 30
2
votes
0 answers

How to obtain and use the result of an asynchronous function which resides inside a synchronous one?

I'll try to explain this as briefly as possible but the question is long (I know). I have to show you the structure of the code so you can understand why I need to do what I am hopelessly trying to! I'm working on an Electron/AngularJS project which…
2
votes
1 answer

Update SQLite database without restarting application

I have an NodeJS application that run on a production server with forever. That application use a third-party SQLite database which is updated every morning with a script triggered by a cron, who download the db from an external FTP to the server. I…
TGrif
  • 5,725
  • 9
  • 31
  • 52
2
votes
1 answer

Can't use sqlite in electron renderer process: "Cannot read property '_handle' of undefined"

I'm trying to use node-sqlite3 in an electron app, but in the app window, I'm getting the following error in the chrome console: Uncaught TypeError: Cannot read property '_handle' of undefined at file:///[...]/assets/js/bundle.js:38727:15 at…
vmarquet
  • 2,384
  • 3
  • 25
  • 39
2
votes
0 answers

Electron.remote.require('sqlite3') query performance 5x slower, callback 500x slower

I'm using Electron w/ webpack and try to add sqlite3 to the mix. See stripped down test project I came accross two possible solutions. When I require('sqlite3') in index.html and create a global variable referencing the database, I can query the db…
passerby
  • 1,807
  • 19
  • 26
2
votes
1 answer

callback failed to run after sqlite statment.all query

In the following function, I have attempted to run an statment.all query in sqlite3. however the function ends without ever running the callback function. I cannot pinpoint the problem even after a thorough debug and few experiments. The strangest…
Shimon k
  • 21
  • 3
2
votes
0 answers

how to require node-sqlite3 with sqlcipher support

I've got a package that requires the node-sqlite3 package. However, it also requires that node-sqlite3 be built with sqlcipher support, or my package will fail to function correctly. I am installing node-sqlite3 using: export…
Michael
  • 9,060
  • 14
  • 61
  • 123
2
votes
1 answer

sqlite3 db.close() called before db.serialized() finishes

i have a sqlite3 nested query case. Was hoping to push each query result to a json array and return it back. But always get "Error: SQLITE_MISUSE: Database handle is closed" for the 2nd select call. Seems the db.close() gets called before the 2nd…
user3552178
  • 2,719
  • 8
  • 40
  • 67
1
vote
0 answers

i want sqlite3.node file of version 83 from nod.js v8.3

My node application is currently running in node version 8.3. I am getting above error of missing \node-v83-win32-x64\node_sqlite3.node' module in node_modules. When i try to install the same by running npm install --save sqlite3. I am getting below…
Sameer
  • 11
  • 3
1
vote
0 answers

`SQLITE_RANGE: column index out of range` while trying to full-text search SQLite database

I'm trying to use the sqlite3 package to perform a full text search of an SQLite database. To do this, I have made the following function: const searchDb = (query, column, callback) => { const sql = `DROP TABLE IF EXISTS urls_fts; CREATE…
Nick
  • 85
  • 8
1
vote
2 answers

Issue with async SQLite statement execution wrapper functions

I am having an issue executing an SQL statement immediately after creating and populating a table. I think the record does not exist, because the creation query does not finish in time. If I pass false for my clean flag (in createDatabaseFromSQL),…
Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
1
vote
1 answer

sqlite3 with docker throws MODULE_NOT_FOUND error

My node application works on my local(MacOS), but it does not work if I use docker. it works if I try local: npm install npm start It throws error if I try docker docker-compose build docker-compose up I'm getting this error. Error: Cannot find…
user21116899
1
vote
0 answers

Running sqlite3 with react fails with error

In my React web app I want to read from local sqlite db file. From what I understand it can be done via sqlite3 service package. After installing npm install sqlite3 and executing the following code I'm getting an error (Windows machine). Does…
Eric
  • 1,685
  • 1
  • 17
  • 32
1
vote
0 answers

npm install sqlite3 fails after npm cache clean

I'm trying to install sqlite3 in order to develop an express.js backend with sequelize. My operating system is Ubuntu 22.04. My Node version is 18.13.0, npm version 9.3.1. My current situation is: > npm install sqlite3 --save npm WARN deprecated…
Haem
  • 929
  • 6
  • 15
  • 31