August 2017
Intermediate to advanced
214 pages
4h 31m
English
In order to insert a value into one of our tables, we need only two pieces of information:
Let's construct a function that takes these two as parameters and performs the insert operation:
const insertReading = (type, reading) => { db.run(`INSERT INTO ${type} VALUES (datetime('now'), ${reading});`) }
The date and time of the reading are handled by SQLite's datetime function.
Read now
Unlock full access