Skip to content

Commit 0c7ab95

Browse files
committed
Fix field.length to be number
1 parent 11dd45b commit 0c7ab95

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/parsers/text_parser.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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)