Skip to content

Confusion over query/execute's return type union via Promise API #24

Open
@theFroh

Description

@theFroh

Upon console logging an INSERT, I can see the following:

ResultSetHeader {
    fieldCount: 0,
    affectedRows: 1,
    insertId: 0,
    info: '',
    serverStatus: 2,
    warningStatus: 1 }

This would imply that there's a warning. What return packet type would contain this information?

The signature for .query is RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[], and since this is an INSERT I'd expect the result to be an OkPacket if anything, however the OkPacket type definition is:

OkPacket {
    constructor: {
        name: 'OkPacket'
    };
    fieldCount: number;
    affectedRows: number;
    changedRows: number;
    insertId: number;
    serverStatus: number;
    warningCount: number;
    message: string;
    procotol41: boolean;
}

Observations:

  • warningStatus vs warningCount
  • procotol41 (odd spelling, can't find any reference to this elsewhere)

So unless I typecast as any I don't believe I can determine if a query has had a warning, but I'd just like to confirm if this is the case and raise this just in case there is indeed an issue in the definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions