Skip to content

Commit

Permalink
Fix field.length to be number
Browse files Browse the repository at this point in the history
  • Loading branch information
testn committed Oct 17, 2021
1 parent 11dd45b commit 0c7ab95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parsers/text_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function compile(fields, options, config) {
);
parserFn(`this.wrap${i} = {
type: ${helpers.srcEscape(typeNames[field.columnType])},
length: ${helpers.srcEscape(field.columnLength)},
length: ${field.columnLength},
db: ${helpers.srcEscape(field.schema)},
table: ${helpers.srcEscape(field.table)},
name: ${helpers.srcEscape(field.name)},
Expand Down
2 changes: 2 additions & 0 deletions test/integration/connection/test-typecast.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ connection.query(
{
sql: 'select "foo uppercase" as foo',
typeCast: function(field, next) {
assert.equal("number", typeof field.length);
if (field.type === 'VAR_STRING') {

return field.string().toUpperCase();
}
return next();
Expand Down

0 comments on commit 0c7ab95

Please sign in to comment.