Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
better-sqlite3 .get() returns undefined

I'm new to bettersql3lite, I tried reading the documentation here: https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md

and I couldn't figure out this bug.

I am trying to run a select statement in javascript as follows:

const stmt = db.prepare('select * from table where token = ?').get(token);

where token is an int initialized to be 5000 in this example. db corresponds to the line const db = require('./database') Whenever I try running this code and printing out what stmt is, stmt is undefined.

When I try running the same sql query, select * from table where token = 5000 , in a database browser, I do get a record returned to me as desired. I'm not sure why the above javascript code isn't working for me, I use it the same way, with strings in place of token, and it behaves as expected (i.e the variable is initialized when there is something in the database that would be returned). I don't know if strings are the issue, but I'm really confused as to why the above line does not work. Any help is appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!