tmotagam / sqlite-electron

module for electron to use sqlite3 databases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why fetching methods return boolean

mrAbra opened this issue · comments

`` ipcMain.handle('test-row', async () => {
dataBase.insertRow("123", "deveui", "joineui");
dataBase.insertRow("124", "deveui", "joineui");
dataBase.insertRow("125", "deveui", "joineui");
const result = await dataBase.read5Rows();
console.log(result);
});
.....
async read5Rows() {
try {
const query = SELECT * FROM DeviceTable ORDER BY time DESC LIMIT 5;
const size = 5;
return await fetchMany(query, size);
} catch (error) {
console.error(error);
return [];
}
}

``
why fetchMany returning true? btw i create needed data in db with executeQuery. I cheked it with db reader.

@mrAbra,
Hi I checked it and it is not returning Boolean you can also put your dB in the example that is in this repo and see it it will return the data correctly I suggest checking your code.

I have the same problem, but it doesn't always show up. I found out that the problem manifests itself when, for example, I call a function from watch on vue js 3.

watch(currentProject, (val) => {
  if (val?.id) {
    getTime()
  }
})

const getTime = async () => {
  const res = await window.api.fetchAll('select start, end, project_id from sessions where project_id = ?', [currentProject.value.id])
console.log(res) // Boolean
commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.