NitroSQLite
react-native-nitro-sqliteInterfaces

Transaction

TypeScript

Source files: TypeScript

Handle valid only while its transaction callback and SQLite transaction are active. If SQLite implicitly rolls back the transaction, further queries reject before executing SQL, including queries already queued on the background worker. A caught ABORT constraint error leaves the transaction usable.

Properties

execute

execute: ExecuteQuery

Defined in: packages/react-native-nitro-sqlite/src/types.ts:343

Execute within this transaction on the calling thread.


executeAsync

executeAsync: <Row>(query, params?) => Promise<QueryResult<Row>>

Defined in: packages/react-native-nitro-sqlite/src/types.ts:348

Execute within this transaction on a background thread.

Type Parameters

Row

Row extends QueryResultRow = QueryResultRow

Parameters

query

string

SQL statement with optional positional placeholders.

params?

SQLiteQueryParams

Values bound to the placeholders.

Returns

Promise<QueryResult<Row>>


executeRaw

executeRaw: ExecuteRawQuery

Defined in: packages/react-native-nitro-sqlite/src/types.ts:353

Execute within this transaction on the calling thread, returning rows as arrays of column values.


executeRawAsync

executeRawAsync: (query, params?) => Promise<NativeRawQueryResult>

Defined in: packages/react-native-nitro-sqlite/src/types.ts:358

Execute within this transaction on a background thread, returning rows as arrays of column values.

Parameters

query

string

SQL statement with optional positional placeholders.

params?

SQLiteQueryParams

Values bound to the placeholders.

Returns

Promise<NativeRawQueryResult>

Methods

commit()

Defined in: packages/react-native-nitro-sqlite/src/types.ts:335

Commit now. Marks completion only after SQLite accepts COMMIT. On failure, only rollback remains available and the wrapper rejects unless the callback explicitly rolls back. Throws while async queries are pending.

Returns

NativeQueryResult


rollback()

rollback(): NativeQueryResult

Defined in: packages/react-native-nitro-sqlite/src/types.ts:341

Roll back now, including after a failed commit. Marks completion only after SQLite accepts ROLLBACK. A failed rollback rejects the transaction promise even if caught by the callback. Throws while async queries are pending or after successful finalization.

Returns

NativeQueryResult

On this page