Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions database.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ let db = new sqlite3.Database(DBSOURCE, (err) => {
console.log('Connected to the SQlite database.')
db.run(`CREATE TABLE products (
id INTEGER PRIMARY KEY AUTOINCREMENT,
productName text,
description text,
category text,
brand text,
expiredDate text,
manufacturedDate text,
batchNumber INTEGER,
unitPrice INTEGER,
quantity INTEGER,
createdDate text
name text,
address text,
email text,
gender text,
age INTEGER,
cardHolderName text,
cardNumber INTEGER,
expiryDate text,
cvv INTEGER,
timeStamp text
)`, (err) => {
if (err) {
// Table already created
} else {
// Table just created, creating some rows
var insert = 'INSERT INTO products (productName, description, category, brand, expiredDate, manufacturedDate, batchNumber, unitPrice, quantity, createdDate) VALUES (?,?,?,?,?,?,?,?,?,?)'
db.run(insert, ["White Basmathi Rice", "White Basmathi Rice imported from Pakistan. High-quality rice with extra fragrance. Organically grown.", "Rice", "CIC", "2023.05.04", "2022.02.20", 324567, , 1020, 200, "2022.02.24"])
var insert = 'INSERT INTO products (name, address, email, gender, age, cardHolderName, cardNumber, expiryDate, cvv, timeStamp) VALUES (?,?,?,?,?,?,?,?,?,?)'
db.run(insert, ["A.D.Lakith Dharmasiri", "No 324/A Ra De Mel Road, Colombo", "lakith@gmail.com", "female", 28, "A.D.L.Dharmasiri", 102445217895, , "12/2022", 246, "2022-12-31 23:59:59"])
}
})

Expand Down