import { AbstractSqliteQueryRunner } from "../sqlite-abstract/AbstractSqliteQueryRunner";
|
import { ExpoDriver } from "./ExpoDriver";
|
/**
|
* Runs queries on a single sqlite database connection.
|
*/
|
export declare class ExpoQueryRunner extends AbstractSqliteQueryRunner {
|
/**
|
* Database driver used by connection.
|
*/
|
driver: ExpoDriver;
|
/**
|
* Database transaction object
|
*/
|
private transaction?;
|
constructor(driver: ExpoDriver);
|
/**
|
* Starts transaction. Within Expo, all database operations happen in a
|
* transaction context, so issuing a `BEGIN TRANSACTION` command is
|
* redundant and will result in the following error:
|
*
|
* `Error: Error code 1: cannot start a transaction within a transaction`
|
*
|
* Instead, we keep track of a `Transaction` object in `this.transaction`
|
* and continue using the same object until we wish to commit the
|
* transaction.
|
*/
|
startTransaction(): Promise<void>;
|
/**
|
* Commits transaction.
|
* Error will be thrown if transaction was not started.
|
* Since Expo will automatically commit the transaction once all the
|
* callbacks of the transaction object have been completed, "committing" a
|
* transaction in this driver's context means that we delete the transaction
|
* object and set the stage for the next transaction.
|
*/
|
commitTransaction(): Promise<void>;
|
/**
|
* Rollbacks transaction.
|
* Error will be thrown if transaction was not started.
|
* This method's functionality is identical to `commitTransaction()` because
|
* the transaction lifecycle is handled within the Expo transaction object.
|
* Issuing separate statements for `COMMIT` or `ROLLBACK` aren't necessary.
|
*/
|
rollbackTransaction(): Promise<void>;
|
/**
|
* Executes a given SQL query.
|
*/
|
query(query: string, parameters?: any[]): Promise<any>;
|
}
|