Retrieve affected row

47 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Beto Sosa

ungelesen,
04.10.2016, 18:21:1904.10.16
an node-mysql

Hi I am starting to use this package, and I was wodering if there is a way to get all the affected rows of  a query.
For example, when you insert a new row, the driver give us a callback object with the key insertId I dont know if I there is a way to get all the object not just the id

connection.query('INSERT INTO posts SET ?', {title: 'test'}, function(err, result) {
 
if (err) throw err;

 
console.log(result.insertId);
});


Something like this

connection.query('UPDATE posts SET title = ? WHERE...', { titles: 'New title' }, function(err, result) {
    console
.log(result.updatedRow)
}
)





Thank you

Kiss Koppány

ungelesen,
19.10.2016, 19:22:5319.10.16
an node-mysql
You could simply just write another query inside that one and get the row you need based on the inserId.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten