Prepared statement sometimes reuse previous queries / bind sometimes doesn't work properly
SrMouraSilva opened this issue · 4 comments
SrMouraSilva commented
First, of all, thank you for this awesome library!
Describe the bug
Sometimes, prepared statement reuse previous queries without replace parameters sent by bind, so the same query is runned.
Versions:
- OS and version: Android 12
- op-sqlite version: 2.0.13
- RN version: 0.73.2
Reproducible example
// Open database
const database = open({
name: `../files/${databaseName}`,
});
// Create statement
const statement = database.prepareStatement(`
select id_musica, titulo, letra, compositores, midias
from musica
where id_musica = ?
`);
// Bind and execute
statement.bind([123]);
console.log(statement.execute());
// Wait a random time, like close a screen and open again
// Bind and execute
statement.bind([321]);
console.log(statement.execute());
// do some iterations, sometimes the error doesn't occurs at first time
// but I don't noticed any pattern :/
I noticed that bind and execute both don't requires await. Is it expected?
ospfranco commented
thanks for reporting. let me take a look there might be something wrong.
ospfranco commented
SrMouraSilva commented
Thanks @opsfranco. I will prepare a reproduction repo
ospfranco commented
Going to close this for now, as I cannot find anything wrong. Feel free to post a reproduction demo and I will re-open it.