Add OkPacket interface for inserts, updates, and deletes (#43938)

* add OkPacket interface for inserts, updates, and deletes

* revert OkPacket member type, complete fields on OkPacket interface

Co-authored-by: Sanders DeNardi <sdenardi@summusglobal.com>
This commit is contained in:
Sanders DeNardi 2020-04-16 19:42:24 -04:00 committed by GitHub
parent bf1af1a78f
commit 5f0c754abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
// Kacper Polak <https://github.com/kacepe>
// Krittanan Pingclasai <https://github.com/kpping>
// James Munro <https://github.com/jdmunro>
// Sanders DeNardi <https://github.com/sedenardi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@ -667,6 +668,30 @@ export interface MysqlError extends Error {
sqlMessage?: string;
}
// Result from an insert, update, or delete statement.
export interface OkPacket {
fieldCount: number;
/**
* The number of affected rows from an insert, update, or delete statement.
*/
affectedRows: number;
/**
* The insert id after inserting a row into a table with an auto increment primary key.
*/
insertId: number;
serverStatus?: number;
warningCount?: number;
/**
* The server result message from an insert, update, or delete statement.
*/
message: string;
/**
* The number of changed rows from an update statement. "changedRows" differs from "affectedRows" in that it does not count updated rows whose values were not changed.
*/
changedRows: number;
protocol41: boolean;
}
export const enum Types {
DECIMAL = 0x00, // aka DECIMAL (http://dev.mysql.com/doc/refman/5.0/en/precision-math-decimal-changes.html)
TINY = 0x01, // aka TINYINT, 1 byte