Skip to content

Commit

Permalink
fix: correctly return insertId for react-native (#9554)
Browse files Browse the repository at this point in the history
  • Loading branch information
dehy committed Dec 3, 2022
1 parent 50cb580 commit 97fae63
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/driver/react-native/ReactNativeQueryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ export class ReactNativeQueryRunner extends AbstractSqliteQueryRunner {

const result = new QueryResult()

// return id of inserted row, if query was insert statement.
if (query.substr(0, 11) === "INSERT INTO") {
result.raw = raw.insertId
}

if (raw?.hasOwnProperty("rowsAffected")) {
result.affected = raw.rowsAffected
}
Expand All @@ -95,6 +90,11 @@ export class ReactNativeQueryRunner extends AbstractSqliteQueryRunner {
result.records = records
}

// return id of inserted row, if query was insert statement.
if (query.substr(0, 11) === "INSERT INTO") {
result.raw = raw.insertId
}

if (useStructuredResult) {
ok(result)
} else {
Expand Down

0 comments on commit 97fae63

Please sign in to comment.