Answer the question
In order to leave comments, you need to log in
How to form an array of objects?
Here is my code and it doesn't work quite right.
var mass = [];
function queryDatabasePunish() {
request = new Request(`SELECT punishments.num_punishment, breakdowns.coast, punishments.name_breakdown FROM breakdowns INNER JOIN punishments ON breakdowns.num_breakdown = punishments.num_breakdown WHERE (punishments.num_ptc = '${password}')`, function (err, rowCount, rows) {
console.log(rowCount + ' row(s) вернулось из штрафов');
PunCount = rowCount;
});
request.on('row', function (columns) {
columns.forEach(function (column) {
punishments[column.metadata.colName] = column.value;//заполнение объекта
});
mass.push(punishments);
console.log(mass);
});
abcdef.execSql(request);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question