Skip to content
Permalink
ef5484962f
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
36 lines (27 sloc) 946 Bytes
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 uploadTrack\
(id TEXT, singer_name TEXT, singer_details TEXT, description TEXT,image_url TEXT, Track_name TEXT);'
await this.db.run(sql)
return this
})()
}
async insert(id, singer_name, singer_details,description,track,image_url) {
sql = `INSERT INTO uploadTrack(id, singer_name, singer_details,description,image_url,Track_name) VALUES("${id}", "${singer_name}", "${singer_details}", "${description}", "${image_url}", "${track}")`
await this.db.run(sql)
console.log("Done")
return true
}
async getAll() {
sql = `SELECT * FROM uploadTrack`
const record = await this.db.get(sql)
return record
}
async tearDown() {
await this.db.close()
}
}