当前位置:网站首页>Electron adding SQLite database
Electron adding SQLite database
2022-07-07 11:18:00 【InfoQ】
order
electronelectronSQLitemongodbpassSQLite
- https://xie.infoq.cn/article/6c7094a919d33144f50cdc6d9《vue Tomato clock &electron pack 》
- 《Node の MongoDB Driver》
- 《node の SQLite》
Development
sqliteDB.jstomato.dbtomatoTablerunSQL(`
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
);
`)ipcMainipcRenderersqlitedb.allpromise// 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边栏推荐
- 关于测试人生的一站式发展建议
- Basic knowledge of process (orphan, zombie process)
- Verilog realizes nixie tube display driver [with source code]
- 90后,辞职创业,说要卷死云数据库
- Cmake learning manual
- CentOS系统下Redis安装和自启动配置的步骤
- Transaction rolled back because it has been marked as rollback-only解决
- Rolling puddle Uni_ App (VIII)
- Distributed database master-slave configuration (MySQL)
- verilog设计抢答器【附源码】
猜你喜欢

Static semantic check of clang tidy in cicd

MPX plug-in

Interprocess communication (IPC)

對比學習之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments

关于测试人生的一站式发展建议

From pornographic live broadcast to live broadcast E-commerce

seata 1.3.0 四種模式解决分布式事務(AT、TCC、SAGA、XA)

Transaction rolled back because it has been marked as rollback-only解决

测试开发基础,教你做一个完整功能的Web平台之环境准备

JS add spaces to the string
随机推荐
Which securities company is the best and safest to open an account for the subscription of new shares
对比学习之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
Android 面试知识点
RationalDMIS2022阵列工件测量
The fifth training assignment
Multithreaded application (thread pool, singleton mode)
Ffmpeg record a video command from RTSP
关于测试人生的一站式发展建议
JS array delete the specified element
Project ERROR: Unknown module(s) in QT: core gui
Socket socket programming
Add a self incrementing sequence number to the antd table component
Kitex 重试机制
The seventh training assignment
Avoid mutating a prop directly since the value will be overwritten whenever the parent component
Idea shortcut keys
Use metersphere to keep your testing work efficient
【pyqt】tableWidget里的cellWidget使用信号与槽机制
Bookmarking - common website navigation for programmers
[untitled]