当前位置:网站首页>electron添加SQLite数据库
electron添加SQLite数据库
2022-07-07 09:09:00 【InfoQ】
序
electronelectronSQLitemongodbpassSQLite
- https://xie.infoq.cn/article/6c7094a919d33144f50cdc6d9《vue番茄钟&electron 打包》
- 《Node の MongoDB Driver》
- 《node の SQLite》
开发
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// 查询番茄钟数据
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边栏推荐
- Unity script visualization about layout code
- [OneNote] can't connect to the network and can't sync the problem
- POJ1821 Fence 题解报告
- Multithreaded application (thread pool, singleton mode)
- Realize ray detection, drag the mouse to move the object and use the pulley to scale the object
- Input type= "password" how to solve the problem of password automatically brought in
- The eighth training assignment
- 关于测试人生的一站式发展建议
- RationalDMIS2022 高级编程宏程序
- How to play video on unityui
猜你喜欢

SQL Server knowledge gathering 9: modifying data
![[pro test feasible] error while loading shared libraries solution](/img/e2/688ffa07861f38941cbf2cafdd9939.png)
[pro test feasible] error while loading shared libraries solution

MPX plug-in

2021-04-08

Antd select selector drop-down box follows the scroll bar to scroll through the solution
![[untitled]](/img/f9/18b85ad17d4c560f2b9d95a53ee72a.jpg)
[untitled]

單調性約束與反單調性約束的區別 monotonicity and anti-monotonicity constraint

"Dream Cup" 2017 Jiangsu information and future primary school summer camp it expert PK program design questions

在我有限的软件测试经历里,一段专职的自动化测试经验总结

面试被问到了解哪些开发模型?看这一篇就够了
随机推荐
VIM命令模式与输入模式切换
V-for img SRC rendering fails
通过 Play Integrity API 的 nonce 字段提高应用安全性
什么是高内聚、低耦合?
[OneNote] can't connect to the network and can't sync the problem
Interprocess communication (IPC)
[untitled]
创意信息获2家机构调研:GreatDB 数据库已在9地部署
Template initial level template
2021-04-23
Rolling puddle Uni_ App (VIII)
Mysql的json格式查询
The sixth training assignment
mif 文件格式记录
Operation method of Orange Pie orangepi 4 lts development board connecting SATA hard disk through mini PCIe
关于SIoU《SIoU Loss: More Powerful Learning for Bounding Box Regression Zhora Gevorgyan 》的一些看法及代码实现
Project ERROR: Unknown module(s) in QT: core gui
Which securities company is the best and safest to open an account for the subscription of new shares
Some online academic report websites and machine learning videos
在我有限的软件测试经历里,一段专职的自动化测试经验总结