Last active
July 31, 2020 12:56
-
-
Save fmacedoo/5bfc1a3a99bd1e1f608a8630bdd4596c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ipcMain } = require('electron'); | |
const sqlite3 = require('sqlite3'); | |
const database = new sqlite3.Database('./public/db.sqlite3', (err) => { | |
if (err) console.error('Database opening error: ', err); | |
}); | |
ipcMain.on('asynchronous-message', (event, arg) => { | |
const sql = arg; | |
database.all(sql, (err, rows) => { | |
event.reply('asynchronous-reply', (err && err.message) || rows); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment