Skip to content
Permalink
4db3e5365e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
38 lines (28 sloc) 1.02 KB
const sqlite = require('sqlite-async')
module.exports = class UploadTrack {
constructor(dbName = ':memory:') {
console.log("constructor")
return (async() => {
this.db = await sqlite.open(dbName)
const sql = 'CREATE TABLE IF NOT EXISTS uplorac\
(id TEXT PRIMARY KEY , singer_name TEXT, singer_details TEXT, description TEXT,image_url TEXT, Track_name TEXT, trackSource TEXT);'
await this.db.run(sql)
return this
})()
}
async insert(id, singer_name, singer_details,description,track,image_url,src) {
const sql = `INSERT INTO uplorac(id, singer_name, singer_details,description,image_url,Track_name,trackSource) VALUES("${id}", "${singer_name}", "${singer_details}", "${description}", "${image_url}", "${track}","${src}")`
await this.db.run(sql)
console.log("Done")
return true
}
async getAll() {
const sql = `SELECT * FROM uplorac;`
const record = await this.db.all(sql)
console.log(record)
return record
}
async tearDown() {
await this.db.close()
}
}