Answer the question
In order to leave comments, you need to log in
Get information from sqlite db in node.js?
Hello. Such a problem. There is a sqlite database connected to the Node.js project, interacting with 'sqlite-sync'. And here is a table in the database that stores 1 row and 2 columns:
Id - Key
1 - 892
(example)
How to get this value "892" and put it into a variable using a query in Node.js?
Answer the question
In order to leave comments, you need to log in
This is not a problem
https://www.npmjs.com/package/sqlite-sync#usage
something like this
var sqlite = require('sqlite-sync');
sqlite.connect(':memory:');
sqlite.run("CREATE TABLE TableName(Id INTEGER PRIMARY KEY, Key INTEGER NOT NULL)");
sqlite.run("INSERT INTO TableName VALUES(1, 892)");
var result = sqlite.run("SELECT Key FROM TableName WHERE Id = 1");
console.log(result[0].Key);
OUT: 892
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question