I'd like to know what could I use as alternative for PHP PDO in Node.js
I've found node-mysql2, they talk about prepared statements but I can't find a way to cache the statement to reuse it.
With PHP I do:
$sth = $pdo->prepare('SELECT 1+? AS test1');
$sth->execute( Array(10) );
$sth->execute( Array(20) );
And with this I don't prepare the query each time, I juse use the prepared one changing the variable value.
With node-mysql2 instead I do:
connection.execute('SELECT 1+? AS test1', [10], function(err, rows) {
//
});
But I can't find a way to take advantages by the prepared statement feature.