{"id":15705964,"url":"https://github.com/gurumian/simpledb","last_synced_at":"2025-05-12T18:44:28.575Z","repository":{"id":44210564,"uuid":"242300120","full_name":"gurumian/simpledb","owner":"gurumian","description":"sqlite3 nodejs binding","archived":false,"fork":false,"pushed_at":"2022-12-30T19:50:19.000Z","size":404,"stargazers_count":1,"open_issues_count":9,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-22T18:56:48.864Z","etag":null,"topics":["database","db","nodejs","npm","simpledb","simpledbc","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gurumian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-22T07:35:45.000Z","updated_at":"2020-03-10T09:21:58.000Z","dependencies_parsed_at":"2023-01-31T15:01:24.942Z","dependency_job_id":null,"html_url":"https://github.com/gurumian/simpledb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurumian%2Fsimpledb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurumian%2Fsimpledb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurumian%2Fsimpledb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurumian%2Fsimpledb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gurumian","download_url":"https://codeload.github.com/gurumian/simpledb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221278212,"owners_count":16790249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","db","nodejs","npm","simpledb","simpledbc","sqlite","sqlite3"],"created_at":"2024-10-03T20:20:52.182Z","updated_at":"2024-10-24T05:01:38.896Z","avatar_url":"https://github.com/gurumian.png","language":"C++","readme":"SQLite3 nodejs binding. It's simple to use and supports the both asynchronous and synchronous manners.\n\n![Node.js CI](https://github.com/gurumian/simpledb/workflows/Node.js%20CI/badge.svg)\n[![Dependencies](https://david-dm.org/gurumian/simpledb.svg)](https://david-dm.org/gurumian/simpledb)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgurumian%2Fsimpledb.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fgurumian%2Fsimpledb?ref=badge_shield)\n\n## Prerequisites\n```bash\napt install libsqlite3-dev\n\n(or brew)\n```\n\nYou may need to install `cmake-js` and `typescript`\n```\nnpm i -g cmake-js\nnpm i -g typescript\n```\n\n\n## Install\n```bash\nnpm i simpledbc\n```\n\n## Example\nSee `example/`\n\n### CREATE\n```js\nconst {Connection} = require('simpledbc');\n\nlet conn = new Connection(db)\nlet stmt = conn.createStatement()\nlet query = `CREATE TABLE ${table}(idx INTEGER PRIMARY KEY AUTOINCREMENT, passwd TEXT, date DATETIME);`\nstmt.execute(query)\n.then(res =\u003e {\n  console.log(res);\n})\n```\n\n### INSERT\n```js\nlet stmt = conn.createStatement();\nlet password = Math.round(Math.random() * 1000);\nlet query =  `INSERT INTO ${table} (passwd, date) VALUES(${password},datetime(\\'now\\',\\'localtime\\'));`;\nstmt.execute(query)\n.then(res =\u003e {\n  console.log(res);\n})\n```\n\n### SELECT\n```js\nlet stmt = conn.createStatement();\nlet query =`SELECT idx, passwd, date FROM ${table}`;\nstmt.execute(query)\n.then(res =\u003e {\n  while(res.next()) {\n    console.log(res.data);\n    // console.log(res.obj);\n  }\n})\n```\n\n### UPDATE\n```js\nlet stmt = conn.createStatement();\nlet password = 'new password';\nlet query = `UPDATE ${table} set passwd=\\'${password}\\', date=datetime(\\'now\\',\\'localtime\\') WHERE idx=1;`;\nstmt.execute(query)\n.then(res =\u003e {\n  if(res) {\n    console.log(`successfully updated to ${password}`);\n  }\n})\n```\n\n### DELETE\n```js\nlet id = 1;\nlet stmt = conn.createStatement();\nlet query = `DELETE FROM admin WHERE idx=${id};`;\nstmt.execute(query)\n.then(res =\u003e {\n  // \n})\n```\n\n### async / await\nYou can use it like this as well.\n```js\nasync function removeAsync(conn) {\n  let id = 2;\n  let stmt = conn.createStatement();\n  let query = `DELETE FROM admin WHERE idx=${id};`;\n  let res = await stmt.execute(query)\n  console.log(`removeAsync ${res}`);\n}\n```\n\n\n## (Optional) Native only build\n```bash\ncd native;\nmkdir build; cd build\ncmake .. \u0026\u0026 make\n```\n\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgurumian%2Fsimpledb.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fgurumian%2Fsimpledb?ref=badge_large)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgurumian%2Fsimpledb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgurumian%2Fsimpledb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgurumian%2Fsimpledb/lists"}