From 7718a640d24f62876c90209b24c6de48ffd0c56b Mon Sep 17 00:00:00 2001 From: Kun Zhou Date: Thu, 21 Mar 2024 03:11:32 -0700 Subject: [PATCH] Use the same regex as mysqljs for changed rows --- lib/packets/resultset_header.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/packets/resultset_header.js b/lib/packets/resultset_header.js index 8aa17e037e..43b1892a91 100644 --- a/lib/packets/resultset_header.js +++ b/lib/packets/resultset_header.js @@ -91,7 +91,8 @@ class ResultSetHeader { if (stateChanges) { this.stateChanges = stateChanges; } - const m = this.info.match(/\schanged:\s*(\d+)/i); + // Use the same regex as mysqljs at https://github.com/mysqljs/mysql/blob/dc9c152a87ec51a1f647447268917243d2eab1fd/lib/protocol/packets/OkPacket.js#L3C29-L3C91 + const m = this.info.match(/^[^:0-9]+: [0-9]+[^:0-9]+: ([0-9]+)[^:0-9]+: [0-9]+[^:0-9]*$/); if (m !== null) { this.changedRows = parseInt(m[1], 10); } else {