UNPKG

typeorm

Version:

Data-Mapper ORM for TypeScript and ES2021+. Supports MySQL/MariaDB, PostgreSQL, MS SQL Server, Oracle, SAP HANA, SQLite, MongoDB databases.

58 lines (57 loc) 2.18 kB
import { AbstractSqliteQueryRunner } from "../../sqlite-abstract/AbstractSqliteQueryRunner"; import { ExpoLegacyDriver } from "./ExpoLegacyDriver"; /** * Runs queries on a single sqlite database connection. */ export declare class ExpoLegacyQueryRunner extends AbstractSqliteQueryRunner { /** * Database driver used by connection. */ driver: ExpoLegacyDriver; /** * Database transaction object */ private transaction?; constructor(driver: ExpoLegacyDriver); /** * 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>; /** * Called before migrations are run. */ beforeMigration(): Promise<void>; /** * Called after migrations are run. */ afterMigration(): Promise<void>; /** * Executes a given SQL query. */ query(query: string, parameters?: any[], useStructuredResult?: boolean): Promise<any>; }