Skip to content

Latest commit

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

edb-sqlite-nodejs

Easy Database Sqlite Node-Js

For some small applications that use SQLite Database, I needed to design a small library to simplify my work. And connect to the database without any worries. So I also published the library that I implemented for the projects here.

Import edb-sqlite

constdatabase=require(`./database`)

Using edb-sqlite

Open/Connect DB

database.open(`database.db`)

Create Table

database.run(`CREATE TABLE IF NOT EXISTS 'record'( ID INTEGER PRIMARY KEY NOT NULL, meetingId CHAR(70) NOT NULL, recordId CHAR(70) NOT NULL, status INTEGER NOT NULL)`)

update

database.update(`UPDATE langs SET name = ? WHERE name = ?`,[`test`,`c`])

Delete

database.delete(`DELETE FROM langs WHERE rowid=?`,[1])

Insert

database.insert(`INSERT INTO langs(name) VALUES(?)`,[4])

Select(s) Rows

database.selects(`SELECT * FROM record WHERE status = 0 ORDER BY ID ASC LIMIT 5`,[],(rows)=>{console.log(rows)for(letrowofrows){console.log(row)}})

Single Select

database.select(`SELECT * FROM record WHERE meetingId = ? AND recordId = ?`,[5,8],(res)=>{console.log(res)})

Single Select Count

database.select(`SELECT COUNT(*) as count FROM record WHERE meetingId = ? AND recordId = ?`,[5,8],(res)=>{if(res[`count`]){console.log(res[`count`])}else{console.log(`Error: ${res}`)}})

Close/Disconnect db

database.close()

TODO EDB-Sqlite

  • Adding example js files
  • Publish package to npm package manager

I appreciate if anyone does these and send PR to me.


Max Base

My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers.

Asrez Team

A team includes some programmer, developer, designer, researcher(s) especially Max Base.

Asrez Team

Releases

Packages

Used by

Contributors

Languages