Skip to content

Commit 4cf7739

Browse files
committed
fix: debug output
1 parent f434f11 commit 4cf7739

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,46 +89,42 @@ module.exports.connect = (config = {}) => {
8989
pool.insert = pool.i = async (table, row) => {
9090
qid++
9191
const log = debug.extend(qid)
92-
log('INSERT INTO', table/*, row, rows/*, fields */)
93-
log(getTable(row))
92+
log('INSERT INTO', table)
93+
log(row)
9494
const [rows, fields] = await pool.query('INSERT INTO ?? SET ?', [table, row])
9595
.catch(error => {
9696
console.error('[MYSQL] insert', table, row, error)
9797
throw error
9898
})
99-
log(getTable(rows))
99+
log(rows)
100100
return rows || false
101101
}
102102

103103
pool.update = async (table, row, where = false) => {
104104
qid++
105105
const log = debug.extend(qid)
106-
log('UPDATE', table/*, [row, where], rows/*, fields */)
107-
log(getTable(row))
108-
log(getTable(where))
106+
log('UPDATE', table, row, where)
109107
const _where = where ? 'WHERE ' + Object.keys(where).map(key => key + '=' + pool.escape(where[key])).join(' AND ') : ''
110108
const [rows, fields] = await pool.query(`UPDATE ?? SET ? ${_where}`, [table, row])
111109
.catch(error => {
112110
console.error('[MYSQL] update', table, [row, where], error)
113111
throw error
114112
})
115-
116-
log(getTable(rows))
113+
log(rows)
117114
return rows || false
118115
}
119116

120117
pool.delete = pool.del = async (table, where = false) => {
121118
qid++
122119
const log = debug.extend(qid)
123-
log('DELETE', table/*, [row, where], rows/*, fields */)
124-
log(getTable(where))
120+
log('DELETE FROM', table, where)
125121
const _where = where ? 'WHERE ' + Object.keys(where).map(key => key + '=' + pool.escape(where[key])).join(' AND ') : ''
126122
const [rows, fields] = await pool.query(`DELETE FROM ?? ${_where}`, [table])
127123
.catch(error => {
128124
console.error('[MYSQL] delete', table, where, error)
129125
throw error
130126
})
131-
log(getTable(rows))
127+
log(rows)
132128
return rows || false
133129
}
134130

0 commit comments

Comments
 (0)