当前位置:网站首页>electron添加SQLite数据库
electron添加SQLite数据库
2022-07-07 09:09:00 【InfoQ】
序
electron
electron
SQLite
mongodb
pass
SQLite
- https://xie.infoq.cn/article/6c7094a919d33144f50cdc6d9《vue番茄钟&electron 打包》
- 《Node の MongoDB Driver》
- 《node の SQLite》
开发
sqliteDB.js
tomato.db
tomatoTable
runSQL(`
create table tomatoTable
(
name text not null,
creatTime text not null,
duringTime int not null,
startFlag boolean not null,
bgSrc text not null,
taskEndCount int not null,
taskId text not null
);
`)
ipcMain
ipcRenderer
sqlite
db.all
promise
// 查询番茄钟数据
function getTomatoData() {
db = new sqlite3.Database(rootPath);
return new Promise((reslove)=>{
db.all('select * from tomatoTable', (err, data)=>{
reslove(data);
});
})
}
JSON.parse
// 向番茄钟表插入新数据
function insertNewInfo(d) {
let insertInfo = db.prepare('insert into tomatoTable (name, creatTime, duringTime, startFlag, bgSrc, taskEndCount, taskId) values (?, ?, ?, ?, ?, ?, ?)')
insertInfo.run(d.name, d.creatTime, d.duringTime, d.startFlag, d.bgSrc, d.taskEndCount, d.taskId );
insertInfo.finalize();
}
// 从番茄钟表删除数据
function deleteNewInfo(taskId) {
let del = db.prepare("delete from tomatoTable where taskId = ? ");
del.run(taskId);
del.finalize();
}
// 修改番茄钟任务完成次数
function updateTaskEndCount(arg) {
let update = db.prepare('update tomatoTable set taskEndCount = ? where taskId = ?');
update.run(arg.taskEndCount, arg.taskId);
update.finalize();
}
-- SQLite
select * from tomatoTable
tomato.db
边栏推荐
- [untitled]
- Graduation season | keep company with youth and look forward to the future together!
- 毕业季|与青春作伴,一起向未来!
- 高考作文,高频提及科技那些事儿……
- Debezium同步之Debezium架构详解
- VR development optimization
- Kitex 重试机制
- Deep understanding of Apache Hudi asynchronous indexing mechanism
- Eth trunk link switching delay is too high
- Antd select selector drop-down box follows the scroll bar to scroll through the solution
猜你喜欢
How to remove addition and subtraction from inputnumber input box
【C#】WinForm运行缩放(变糊)的解决方法
Transaction rolled back because it has been marked as rollback only
RationalDMIS2022 高级编程宏程序
Deep understanding of Apache Hudi asynchronous indexing mechanism
July 10, 2022 "five heart public welfare" activity notice + registration entry (two-dimensional code)
[untitled]
[C #] the solution of WinForm operation zoom (blur)
Input type= "password" how to solve the problem of password automatically brought in
[untitled]
随机推荐
The opacity value becomes 1%
The concept, implementation and analysis of binary search tree (BST)
Idea shortcut keys
Wallhaven壁纸桌面版
Deeply understand the characteristics of database transaction isolation
Go Slice 比较
关于jmeter中编写shell脚本json的应用
Simple and easy to modify spring frame components
书签整理-程序员常用网站导航
CentOS系统下Redis安装和自启动配置的步骤
MPX plug-in
How to use cherry pick?
关于在云服务器上(这里用腾讯云)安装mysql8.0并使本地可以远程连接的方法
Array object sorting
基于DE2 115开发板驱动HC_SR04超声波测距模块【附源码】
解决VSCode只能开两个标签页的问题
Deep understanding of Apache Hudi asynchronous indexing mechanism
uniapp 在onLaunch中跳轉頁面後,點擊事件失效解决方法
基于Retrofit框架的金山API翻译功能案例
After the uniapp jumps to the page in onlaunch, click the event failure solution