TryGhost / node-sqlite3

SQLite3 bindings for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Database.on not registering handles for callbacks

johnnadratowski opened this issue · comments

Issue Summary

I'm attempting to get my SQLite 3 node to log the queries it runs when in verbose mode. I registered the handles in the following way:

export const db = await open({
  filename: dbFile,
  driver: sqlite3.Database,
})

db.on('trace', (q) => console.log(`QUERY:\n\n${q}`))
db.on('profile', (_, t) => console.log(`TOOK ${t}ms`))

However, I'm not seeing the logs. When looking at the code that registers the handle, I don't see it actually passing my callback through. Though I'm not so familiar with that C API so maybe I'm misunderstanding the code. Regardless I'm not getting these logs even when expected.

Steps to Reproduce

  1. Register the trace/profile events as shown above
  2. Make SQL query

Expected: See log of query/profile
Result: No logs outputted

Version

5.1.6

Node.js Version

v20.8.1

How did you install the library?

yarn add on mac OSX