if I have a query like the following:
var queryString = "INSERT INTO pid SET title = '" + randomTitle + "', poc = '" + random + "';"
connection.query(queryString, function(err, rows, fields) {
...(do something here)
});
, is there a way I can retrieve information for the just-inserted row without performing a new query (in my particular case, I want the auto-generated primary key value).
For instance, can I use the construct with the "query" object (below) and then perhaps use one of the query.on callback to retrieve the information about the just-inserted row?:
var query = connection.query(queryString, function(err, rows, fields) {
query.on('fields', function(fields) {
... get the field information?
});
query.on('result', function(row) {
.. get the field information?
});
});
If not via the query callbacks, is there another way? Thanks for any response!