16 lines
414 B
JavaScript
16 lines
414 B
JavaScript
|
var s = require('sqlite3');
|
||
|
var db = new s.Database('osm.db3');
|
||
|
|
||
|
db.serialize(function() {
|
||
|
db.run("CREATE TABLE IF NOT EXISTS sales(cust text, part text, value numeric)");
|
||
|
});
|
||
|
|
||
|
db.serialize(function() {
|
||
|
db.run("INSERT INTO sales VALUES ('Agri AFC','nsr001g',.50)");
|
||
|
});
|
||
|
|
||
|
db.each("SELECT cust, part FROM sales", function(err, row) {
|
||
|
console.log(row.cust + ": " + row.part);
|
||
|
});
|
||
|
|
||
|
db.close;
|