-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
My boolean fields are tinyint and i wanted to cast them as real boolean.
I used
typeCast: function (field, next) {
// Check if the field is a TINYINT(1)
if (field.type === 'TINY' && field.columnLength === 1) {
const val = field.string();
return val === null ? null : val === '1';
}
return next();
}
but it keep throwing.
Trying to troubleshooting, I discovered that field.string(), (and many other methods of field) actually fails on some JSON columns.
For example a field typed as JSON and with value [["12:00","15:30"],["19:00","22:30"]]
will throw
undefined:1
"12:00","15:30"],["19:00","22:30"]]%[["12:00","15:30"],["19:00","22:30"]]%[["12:00","15:30"
^
SyntaxError: Unexpected non-whitespace character after JSON at position 7 (line 1 column 8)
at JSON.parse (<anonymous>)
at readJsonBinary (C:\Users\Gabi\Documents\Web\yesresto\node_modules\mariadb\lib\cmd\decoder\binary-decoder.js:249:49)
Metadata
Metadata
Assignees
Labels
No labels