Skip to content

Commit a8328dd

Browse files
committed
feat: use internal function to get last_insert_row_id and changes
1 parent e51d4d5 commit a8328dd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/core.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,10 @@ export async function initSQLite(options: Promisable<Options>): Promise<SQLiteDB
1919
await sqlite.close(db)
2020
}
2121
const changes: SQLiteDB['changes'] = () => {
22-
return sqlite.changes(db)
22+
return sqliteModule._sqlite3_changes(db)
2323
}
24-
const lastInsertRowId: SQLiteDB['lastInsertRowId'] = async () => {
25-
return await new Promise<number>(resolve => sqlite.exec(
26-
db,
27-
'SELECT last_insert_rowid()',
28-
([id]) => resolve(id as number),
29-
))
24+
const lastInsertRowId: SQLiteDB['lastInsertRowId'] = () => {
25+
return sqliteModule._sqlite3_last_insert_rowid(db)
3026
}
3127
const stream: SQLiteDB['stream'] = async (onData, sql, parameters) => {
3228
for await (const stmt of sqlite.statements(db, sql)) {

0 commit comments

Comments
 (0)