当前位置:网站首页>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边栏推荐
- 從色情直播到直播電商
- JSON format query of MySQL
- 【pyqt】tableWidget里的cellWidget使用信号与槽机制
- Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
- 2022.7.4DAY596
- Project ERROR: Unknown module(s) in QT: core gui
- The difference between monotonicity constraint and anti monotonicity constraint
- How to play video on unityui
- 毕业季|与青春作伴,一起向未来!
- Deep understanding of Apache Hudi asynchronous indexing mechanism
猜你喜欢

Basic knowledge of process (orphan, zombie process)

uniCloud

【安装系统】U盘安装系统教程,使用UltraISO制作U盘启动盘

uniCloud

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

Simple and easy to modify spring frame components

Debezium同步之Debezium架构详解

Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)

Idea shortcut keys

verilog设计抢答器【附源码】
随机推荐
Long list performance optimization scheme memo
The opacity value becomes 1%
Typescript interface inheritance
shardingsphere分库分表示例(逻辑表,真实表,绑定表,广播表,单表)
Une fois que l'uniapp a sauté de la page dans onlaunch, cliquez sur Event Failure resolution
2022.7.6DAY598
互联网协议
Deep understanding of Apache Hudi asynchronous indexing mechanism
Wallhaven壁纸桌面版
Deeply understand the characteristics of database transaction isolation
Graduation season | keep company with youth and look forward to the future together!
How to use cherry pick?
2022.7.4DAY596
Template initial level template
【安装系统】U盘安装系统教程,使用UltraISO制作U盘启动盘
变量的解构赋值
[pyqt] the cellwidget in tablewidget uses signal and slot mechanism
RationalDMIS2022阵列工件测量
[untitled]
SQL Server knowledge collection 11: Constraints