Skip to content

Commit 29f2217

Browse files
authored
Merge pull request #1427 from testn/fix-field-length
Fix field.length to be number
2 parents 11dd45b + 0c7ab95 commit 29f2217

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/parsers/text_parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function compile(fields, options, config) {
105105
);
106106
parserFn(`this.wrap${i} = {
107107
type: ${helpers.srcEscape(typeNames[field.columnType])},
108-
length: ${helpers.srcEscape(field.columnLength)},
108+
length: ${field.columnLength},
109109
db: ${helpers.srcEscape(field.schema)},
110110
table: ${helpers.srcEscape(field.table)},
111111
name: ${helpers.srcEscape(field.name)},

test/integration/connection/test-typecast.js

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ connection.query(
1111
{
1212
sql: 'select "foo uppercase" as foo',
1313
typeCast: function(field, next) {
14+
assert.equal("number", typeof field.length);
1415
if (field.type === 'VAR_STRING') {
16+
1517
return field.string().toUpperCase();
1618
}
1719
return next();

0 commit comments

Comments
 (0)