Skip to content

Commit

Permalink
add numAffectedRows @ PlanetScaleConnection.executeQuery.
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Dec 10, 2022
1 parent 5b92e56 commit d87f385
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,16 @@ class PlanetScaleConnection implements DatabaseConnection {
throw (results as any).error
}

const numAffectedRows = results.rowsAffected == null ? undefined : BigInt(results.rowsAffected)

return {
insertId: results.insertId !== null && results.insertId.toString() !== '0' ? BigInt(results.insertId) : undefined,
rows: results.rows as O[],
numUpdatedOrDeletedRows: results.rowsAffected == null ? undefined : BigInt(results.rowsAffected),
// @ts-ignore replaces `QueryResult.numUpdatedOrDeletedRows` in kysely > 0.22
// following https://github.com/koskimas/kysely/pull/188
numAffectedRows,
// deprecated in kysely > 0.22, keep for backward compatibility.
numUpdatedOrDeletedRows: numAffectedRows,
}
}

Expand Down

0 comments on commit d87f385

Please sign in to comment.