当前位置:网站首页>Electron adding SQLite database
Electron adding SQLite database
2022-07-07 11:18:00 【InfoQ】
order
electron
electron
SQLite
mongodb
pass
SQLite

- https://xie.infoq.cn/article/6c7094a919d33144f50cdc6d9《vue Tomato clock &electron pack 》
- 《Node の MongoDB Driver》
- 《node の SQLite》
Development
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
// Query tomato clock data
function getTomatoData() {
db = new sqlite3.Database(rootPath);
return new Promise((reslove)=>{
db.all('select * from tomatoTable', (err, data)=>{
reslove(data);
});
})
}

JSON.parse

// Insert new data into the tomato clock
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();
}
// Delete data from tomato clock
function deleteNewInfo(taskId) {
let del = db.prepare("delete from tomatoTable where taskId = ? ");
del.run(taskId);
del.finalize();
}
// Modify tomato clock task completion times
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
边栏推荐
- 创意信息获2家机构调研:GreatDB 数据库已在9地部署
- [untitled]
- Ping tool ICMP message learning
- From pornographic live broadcast to live broadcast E-commerce
- Network foundation (1)
- 从色情直播到直播电商
- The post-90s resigned and started a business, saying they would kill cloud database
- 基于华为云IOT设计智能称重系统(STM32)
- Distributed database master-slave configuration (MySQL)
- Hash / (understanding, implementation and application)
猜你喜欢
[untitled]
解决VSCode只能开两个标签页的问题
Apprentissage comparatif non supervisé des caractéristiques visuelles par les assignations de groupes de contrôle
Qtcreator sets multiple qmake
Interprocess communication (IPC)
Activity lifecycle
JS add spaces to the string
Transaction rolled back because it has been marked as rollback-only解决
MPX plug-in
自动化测试框架
随机推荐
数据库同步工具 DBSync 新增对MongoDB、ES的支持
滚动踩坑--UNI_APP(八)
[untitled]
TDengine 社区问题双周精选 | 第二期
Go slice comparison
STM32入门开发 采用IIC硬件时序读写AT24C08(EEPROM)
Transaction rolled back because it has been marked as rollback only
[untitled]
RationalDMIS2022 高级编程宏程序
【C#】WinForm运行缩放(变糊)的解决方法
Using ENSP to do MPLS pseudo wire test
Galaxy Kirin desktop operating system installation postgresql13 (source code installation)
Rolling puddle Uni_ App (VIII)
Force buckle 1002 Find common characters
[untitled]
About the application of writing shell script JSON in JMeter
Antd select selector drop-down box follows the scroll bar to scroll through the solution
【问道】编译原理
如何在博客中添加Aplayer音乐播放器
oracle常见锁表处理方式