Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda