Skip to content

Malformed FieldPacket #1276

@mgummelt

Description

@mgummelt

When fetching FieldPackets from a query, I'm observing that packet.type is undefined, in violation of its type: https://github.com/sidorares/node-mysql2/blob/master/typings/mysql/lib/protocol/packets/FieldPacket.d.ts#L18

Example code:

$ const [res, fields] = await conn.execute<RowDataPacket[]>(sql);
$ fields[0].type
undefined
$ console.log(fields[0])
{ catalog: 'def',
    schema: 'companies',
    name: 'created_at',
    orgName: 'created_at',
    table: 'companies',
    orgTable: 'companies',
    characterSet: 63,
    columnLength: 19,
    columnType: 12,
    flags: 128,
    decimals: 0 }

In fact, FieldPacket seems to have a significantly different structure than its type indicates.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions