Skip to content

Commit

Permalink
Merge pull request #8 from igalklebanov/support-future-query-result-c…
Browse files Browse the repository at this point in the history
…hanges
  • Loading branch information
jacobwgillespie authored Dec 10, 2022
2 parents 5b92e56 + d87f385 commit 46e7589
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 46e7589

Please sign in to comment.