Mi código
stmt.bind({$ticket:"ABCD1245"}); while (stmt.step()) console.log(stmt.get());da un resultado como [1], eso es correcto
stmt.bind({$ticket:"ABCD1245a"}); while (stmt.step()) console.log(stmt.get());no da ningún resultado, lo cual está bien, porque no existe ningún registro.
¿Cómo detecto si no se encontró ningún registro? Intenté como stmt.numrows, pero parece que no es compatible.
Lo arreglé de esta manera, me gustaría usar stmt.num_rows
ticket= "ABCD1245A"; stmt.bind({$ticket:ticket}); if(stmt.step()){ console.log(stmt.get()); console.log(ticket+' found'); while (stmt.step()) console.log(stmt.get()); }else{ console.log('No result for '+ticket); }