Closed
Description
I'm trying to implement a typeCast function on my conenction pool to convert TINYINT(1) to boolean, as provided in the documentation:
var sqlpool = mysql.createPool({
host: [...],
user: [...],
password: [...],
timezone: 'Z',
typeCast: function (field, next) {
if (field.type == 'TINY' && field.length == 1) {
return (field.string() == '1'); // 1 = true, 0 = false
}
return next();
}
})
However, I'm always getting undefined for field.length (regardless of field type) so this is currently failing. Is there something else I need to enable to get the field length, or is something else going on here?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels