Questions tagged [node-sqlite3]

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

More info:

278 questions
43
votes
2 answers

How does `db.serialize` work in `node-sqlite3`

Recently I'm learning to use node and node-sqlite3 to manipulate sqlite3, here is a sample. var sqlite3 = require('sqlite3'); var db = new sqlite3.Database(':memory:'); db.serialize(function() { db.run("CREATE TABLE test(info TEXT)"); …
Searene
  • 25,920
  • 39
  • 129
  • 186
11
votes
1 answer

Cross-platform install of npm package sqlite3

Question Is there a way to install node-sqlite3 for multiple platforms I am targeting in my app without running standalone build for just every target platform combination? Context In my Node.js app I have a npm dependency node-sqlite3 (GitHub,…
Deilan
  • 4,740
  • 3
  • 39
  • 52
8
votes
1 answer

MAC npm install issue with gyp

I was trying to install the npm, but I keep getting this error that I think is related to the hummus module: npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue npm ERR! code 1 npm ERR! path…
gangdou
  • 123
  • 2
  • 6
8
votes
2 answers

Inserting multiple rows with multiple columns in Node and sqlite3

I'm trying to insert many different rows into an sqlite database using a single operation. Each of the rows has multiple columns, and I have the data represented as an array of arrays. I've read the user guide and other tutorials, but all the ones…
Chris Hill
  • 165
  • 1
  • 6
8
votes
1 answer

nexe, node and sqlite3

I'm trying to get nexe working with a node program that uses sqlite3. When I try I get this at runtime: package.json must declare these properties: binary.module_name binary.module_path binary.host and I've read everything I can on the web - I've…
Darren Oakey
  • 2,894
  • 3
  • 29
  • 55
7
votes
2 answers

Transactions in node-sqlite3

In node-sqlite3, if the db is currently in serialized mode, will the next statement wait before the callback of the previous statement finishes, or will the callback run at the same time as the next statement? What's the best way to write a…
Tirafesi
  • 1,297
  • 2
  • 18
  • 36
7
votes
1 answer

SQLite3 Node.js JSON

I am using the sqlite3 NPM package. I would like store JSON in one of my database columns. I understand that SQLite itself is able to store JSON https://www.sqlite.org/json1.html, but I am not necessarily sure how I would do this through…
Hysii
  • 702
  • 2
  • 10
  • 23
7
votes
1 answer

When to close Database with node-sqlite3 and express?

My problem is to figure out when to close a database connection from an expressjs backend to a sqlite database. What I basically want to achieve is a database connection which is open during the whole server uptime and is closed on server shutdown.…
Link1510
  • 101
  • 1
  • 8
6
votes
1 answer

Electron Js - A javascript error occurred in the main process

I have created an electron project which is working fine but when I try to package an electron app using electron packager and then run it. I am facing an exception Uncaught Exception: Error: Cannot find module Require…
5
votes
1 answer

sqlite3 + node: when to close db?

I'm using better-sqlite3 on Node, but I suspect my questions are applicable to node-sqlite3 as well. I basically have 2 simple questions, relating to a server-rendered website: Do I need to explicitly call .close() on the database? I seem to…
Zoltán Matók
  • 3,923
  • 2
  • 33
  • 64
5
votes
2 answers

How to make SQLite to work with Angular 4+, Electron and NodeJS

I'm trying to build one small desktop app using: Angular 4+ NodeJS Electron SQLite3 NodeJS will be used for scanning local user hdd and inserting specific files that are found into SQLite3 database. I checked dozens of documentation and…
Haris Hajdarevic
  • 1,535
  • 2
  • 25
  • 39
4
votes
3 answers

Sqlite Electron: Error: SQLITE_CANTOPEN: unable to open database file

I'm trying to open an sqlite database file using node-sqlite3 in my Angular + Electron app. Despite I made sure that the file exists and Electron can read it, when I try to create the sqlite database using: import * as sqlite from 'sqlite3'; //…
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
3
votes
1 answer

How to use document.querySelector and require with node.js and SQLite3

So pretty much I am trying to create an application that interacts with a database but cannot seem to get either one to work. Either the require causes an issue or the document keyword does (dependant on which I start from) I was just wondering if…
ConnerWithAnE
  • 1,106
  • 10
  • 26
3
votes
1 answer

how to avoid insert duplicate record in node, sqlite [knex, objectionJS]

I'm pulling data from an api and storing into the database, here is the values I fetched from api: const optAdThisMonthsResult = [ [ 'google.com', 'Display', '2021-02-01', 3, 48, 76 ], [ 'google.com', 'a1.php', '2021-02-01',…
3
votes
2 answers

Cannot await for sqlite3.Database.get() function completion in Node.js

I'm struggling with some basic async/await problem in node.js using node-sqlite3. My objective is to select some value from SQLite DB, check it for some condition and take some actions in case the condition is met. Here's the code: const sqlite3 =…
1
2 3
18 19