Skip to content

Database.on not registering handles for callbacks #1722

Open
@johnnadratowski

Description

@johnnadratowski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions