当前位置:网站首页>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
边栏推荐
- Kitex 重试机制
- 在线硬核工具
- July 10, 2022 "five heart public welfare" activity notice + registration entry (two-dimensional code)
- Deep understanding of Apache Hudi asynchronous indexing mechanism
- Poj1821 fence problem solving Report
- 【安装系统】U盘安装系统教程,使用UltraISO制作U盘启动盘
- Multithreaded application (thread pool, singleton mode)
- Go-Redis 中间件
- The concept, implementation and analysis of binary search tree (BST)
- [C #] the solution of WinForm operation zoom (blur)
猜你喜欢
Array object sorting
[untitled]
The difference between monotonicity constraint and anti monotonicity constraint
RationalDMIS2022阵列工件测量
Still cannot find RPC dispatcher table failed to connect in virtual KD
Seata 1.3.0 four modes to solve distributed transactions (at, TCC, Saga, XA)
[untitled]
How to use cherry pick?
Input type= "password" how to solve the problem of password automatically brought in
解决VSCode只能开两个标签页的问题
随机推荐
网络协议 概念
The concept, implementation and analysis of binary search tree (BST)
VIM命令模式与输入模式切换
Template initial level template
[STM32] actual combat 3.1 - drive 42 stepper motors with STM32 and tb6600 drivers (I)
[machine learning 03] Lagrange multiplier method
Qtcreator sets multiple qmake
2021-05-21
Debezium同步之Debezium架构详解
[installation system] U disk installation system tutorial, using UltraISO to make U disk startup disk
uniapp 在onLaunch中跳轉頁面後,點擊事件失效解决方法
90后,辞职创业,说要卷死云数据库
單調性約束與反單調性約束的區別 monotonicity and anti-monotonicity constraint
[OneNote] can't connect to the network and can't sync the problem
Array object sorting
POJ1821 Fence 题解报告
Static semantic check of clang tidy in cicd
测试开发基础,教你做一个完整功能的Web平台之环境准备
Some online academic report websites and machine learning videos
Unity determines whether the mouse clicks on the UI