Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

254
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda