当前位置:网站首页>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
边栏推荐
- Using ENSP to do MPLS pseudo wire test
- 使用MeterSphere让你的测试工作持续高效
- MIF file format record
- Ffmpeg record a video command from RTSP
- Verilog 实现数码管显视驱动【附源码】
- JS add spaces to the string
- 常用sql语句整理:mysql
- ‘module‘ object is not callable错误
- [untitled]
- Learning notes | data Xiaobai uses dataease to make a large data screen
猜你喜欢
Input type= "password" how to solve the problem of password automatically brought in
What if copying is prohibited?
electron添加SQLite数据库
About the application of writing shell script JSON in JMeter
Transaction rolled back because it has been marked as rollback-only解决
科普达人丨一文弄懂什么是云计算?
高考作文,高频提及科技那些事儿……
Activity生命周期
测试优惠券要怎么写测试用例?
Debezium同步之Debezium架构详解
随机推荐
面试被问到了解哪些开发模型?看这一篇就够了
JS add spaces to the string
请问申购新股哪个证券公司开户是最好最安全的
Activity lifecycle
[pyqt] the cellwidget in tablewidget uses signal and slot mechanism
[untitled]
软件设计之——“高内聚低耦合”
What if copying is prohibited?
Basic knowledge of process (orphan, zombie process)
Compile QT project script with qmake
Apprentissage comparatif non supervisé des caractéristiques visuelles par les assignations de groupes de contrôle
audit 移植
QT document
毕业季|与青春作伴,一起向未来!
Socket socket programming
Go-Redis 中间件
From pornographic live broadcast to live broadcast E-commerce
Une fois que l'uniapp a sauté de la page dans onlaunch, cliquez sur Event Failure resolution
Process control (creation, termination, waiting, program replacement)
什么是高内聚、低耦合?