当前位置:网站首页>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
边栏推荐
- electron 添加 SQLite 数据库
- The eighth training assignment
- 【pyqt】tableWidget里的cellWidget使用信号与槽机制
- 高考作文,高频提及科技那些事儿……
- JS add spaces to the string
- 2021-04-23
- Verilog 实现数码管显视驱动【附源码】
- Galaxy Kirin desktop operating system installation postgresql13 (source code installation)
- Bookmarking - common website navigation for programmers
- [untitled]
猜你喜欢
[untitled]
uniCloud
90后,辞职创业,说要卷死云数据库
對比學習之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
从色情直播到直播电商
Antd select selector drop-down box follows the scroll bar to scroll through the solution
面试被问到了解哪些开发模型?看这一篇就够了
Wallhaven wallpaper desktop version
2021-04-23
Basic knowledge of process (orphan, zombie process)
随机推荐
[untitled]
Wallhaven wallpaper desktop version
Distributed database master-slave configuration (MySQL)
Activity lifecycle
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
VIM命令模式与输入模式切换
请问申购新股哪个证券公司开户是最好最安全的
Use metersphere to keep your testing work efficient
Go Slice 比较
從色情直播到直播電商
uniCloud
STM32入门开发 编写DS18B20温度传感器驱动(读取环境温度、支持级联)
Eth trunk link switching delay is too high
2021-04-23
Bookmarking - common website navigation for programmers
QT document
关于jmeter中编写shell脚本json的应用
Case study of Jinshan API translation function based on retrofit framework
【愚公系列】2022年7月 Go教学课程 005-变量
QT implements the delete method of the container