Skip to content

Commit

Permalink
Merge pull request #1427 from testn/fix-field-length
Browse files Browse the repository at this point in the history
Fix field.length to be number
  • Loading branch information
sidorares committed Oct 17, 2021
2 parents 11dd45b + 0c7ab95 commit 29f2217
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 29f2217

Please sign in to comment.