import type { Knex } from 'knex'; import { type AnyEntity, type Collection, type Configuration, type ConnectionType, type Constructor, type CountOptions, DatabaseDriver, type DeleteOptions, type Dictionary, type DriverMethodOptions, type EntityData, type EntityDictionary, type EntityField, EntityManagerType, type EntityMetadata, type EntityName, type EntityProperty, type FilterQuery, type FindOneOptions, type FindOptions, type IDatabaseDriver, type LockOptions, type LoggingOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type ObjectQuery, type Options, type OrderDefinition, type PopulateOptions, type PopulatePath, type Primary, type QueryOrderMap, type QueryResult, type Transaction, type UpsertManyOptions, type UpsertOptions } from '@mikro-orm/core'; import type { AbstractSqlConnection } from './AbstractSqlConnection'; import type { AbstractSqlPlatform } from './AbstractSqlPlatform'; import { QueryBuilder, QueryType } from './query'; import { SqlEntityManager } from './SqlEntityManager'; import type { Field } from './typings'; export declare abstract class AbstractSqlDriver extends DatabaseDriver { [EntityManagerType]: SqlEntityManager; protected readonly connection: Connection; protected readonly replicas: Connection[]; protected readonly platform: Platform; protected constructor(config: Configuration, platform: Platform, connection: Constructor, connector: string[]); getPlatform(): Platform; createEntityManager(useContext?: boolean): D[typeof EntityManagerType]; find(entityName: string, where: ObjectQuery, options?: FindOptions): Promise[]>; findOne(entityName: string, where: ObjectQuery, options?: FindOneOptions): Promise | null>; protected hasToManyJoins(hint: PopulateOptions, meta: EntityMetadata): boolean; findVirtual(entityName: string, where: ObjectQuery, options: FindOptions): Promise[]>; countVirtual(entityName: string, where: ObjectQuery, options: CountOptions): Promise; protected findFromVirtual(entityName: string, where: ObjectQuery, options: FindOptions | CountOptions, type: QueryType): Promise[] | number>; protected wrapVirtualExpressionInSubquery(meta: EntityMetadata, expression: string, where: FilterQuery, options: FindOptions, type: QueryType): Promise; mapResult(result: EntityData, meta: EntityMetadata, populate?: PopulateOptions[], qb?: QueryBuilder, map?: Dictionary): EntityData | null; private mapJoinedProps; count(entityName: string, where: any, options?: CountOptions): Promise; nativeInsert(entityName: string, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; nativeInsertMany(entityName: string, data: EntityDictionary[], options?: NativeInsertUpdateManyOptions, transform?: (sql: string) => string): Promise>; nativeUpdate(entityName: string, where: FilterQuery, data: EntityDictionary, options?: NativeInsertUpdateOptions & UpsertOptions): Promise>; nativeUpdateMany(entityName: string, where: FilterQuery[], data: EntityDictionary[], options?: NativeInsertUpdateManyOptions & UpsertManyOptions): Promise>; nativeDelete(entityName: string, where: FilterQuery | string | any, options?: DeleteOptions): Promise>; /** * Fast comparison for collection snapshots that are represented by PK arrays. * Compares scalars via `===` and fallbacks to Utils.equals()` for more complex types like Buffer. * Always expects the same length of the arrays, since we only compare PKs of the same entity type. */ private comparePrimaryKeyArrays; syncCollections(collections: Iterable>, options?: DriverMethodOptions): Promise; loadFromPivotTable(prop: EntityProperty, owners: Primary[][], where?: FilterQuery, orderBy?: OrderDefinition, ctx?: Transaction, options?: FindOptions, pivotJoin?: boolean): Promise>; private getPivotOrderBy; execute | EntityData[] = EntityData[]>(queryOrKnex: string | Knex.QueryBuilder | Knex.Raw, params?: any[], method?: 'all' | 'get' | 'run', ctx?: Transaction, loggerContext?: LoggingOptions): Promise; /** * 1:1 owner side needs to be marked for population so QB auto-joins the owner id */ protected autoJoinOneToOneOwner(meta: EntityMetadata, populate: PopulateOptions[], fields?: readonly EntityField[]): PopulateOptions[]; /** * @internal */ joinedProps(meta: EntityMetadata, populate: PopulateOptions[], options?: { strategy?: Options['loadStrategy']; }): PopulateOptions[]; /** * @internal */ mergeJoinedResult(rawResults: EntityData[], meta: EntityMetadata, joinedProps: PopulateOptions[]): EntityData[]; protected getFieldsForJoinedLoad(qb: QueryBuilder, meta: EntityMetadata, explicitFields?: Field[], exclude?: Field[], populate?: PopulateOptions[], options?: { strategy?: Options['loadStrategy']; populateWhere?: FindOptions['populateWhere']; populateFilter?: FindOptions['populateFilter']; }, parentTableAlias?: string, parentJoinPath?: string, count?: boolean): Field[]; /** * @internal */ mapPropToFieldNames(qb: QueryBuilder, prop: EntityProperty, tableAlias?: string): Field[]; /** @internal */ createQueryBuilder(entityName: EntityName | QueryBuilder, ctx?: Transaction, preferredConnectionType?: ConnectionType, convertCustomTypes?: boolean, loggerContext?: LoggingOptions, alias?: string, em?: SqlEntityManager): QueryBuilder; protected resolveConnectionType(args: { ctx?: Transaction; connectionType?: ConnectionType; }): ConnectionType; protected extractManyToMany(entityName: string, data: EntityDictionary): EntityData; protected processManyToMany(meta: EntityMetadata | undefined, pks: Primary[], collections: EntityData, clear: boolean, options?: DriverMethodOptions): Promise; lockPessimistic(entity: T, options: LockOptions): Promise; protected buildPopulateWhere(meta: EntityMetadata, joinedProps: PopulateOptions[], options: Pick, 'populateWhere'>): ObjectQuery; protected buildOrderBy(qb: QueryBuilder, meta: EntityMetadata, populate: PopulateOptions[], options: Pick, 'strategy' | 'orderBy' | 'populateOrderBy'>): QueryOrderMap[]; protected buildPopulateOrderBy(qb: QueryBuilder, meta: EntityMetadata, populateOrderBy: QueryOrderMap[], parentPath: string, explicit: boolean, parentAlias?: string): QueryOrderMap[]; protected buildJoinedPropsOrderBy(qb: QueryBuilder, meta: EntityMetadata, populate: PopulateOptions[], options?: Pick, 'strategy' | 'orderBy' | 'populateOrderBy'>, parentPath?: string): QueryOrderMap[]; protected normalizeFields(fields: Field[], prefix?: string): string[]; protected processField(meta: EntityMetadata, prop: EntityProperty | undefined, field: string, ret: Field[], populate: PopulateOptions[], joinedProps: PopulateOptions[], qb: QueryBuilder): void; protected isPopulated(meta: EntityMetadata, prop: EntityProperty, hint: PopulateOptions, name?: string): boolean; protected buildFields(meta: EntityMetadata, populate: PopulateOptions[], joinedProps: PopulateOptions[], qb: QueryBuilder, alias: string, options: Pick, 'strategy' | 'fields' | 'exclude'>, count?: boolean): Field[]; }