AK-21/Graphite-Industrial-Intelligence
0
1import { entityKind } from "../../entity.js";2import { NoopLogger } from "../../logger.js";3import { MySqlPreparedQuery, MySqlSession } from "../../mysql-core/index.js";4import { fillPlaceholders } from "../../sql/sql.js";5class PrismaMySqlPreparedQuery extends MySqlPreparedQuery {6 constructor(prisma, query, logger) {7 super(void 0, void 0, void 0);8 this.prisma = prisma;9 this.query = query;10 this.logger = logger;11 }12 iterator(_placeholderValues) {13 throw new Error("Method not implemented.");14 }15 static [entityKind] = "PrismaMySqlPreparedQuery";16 execute(placeholderValues) {17 const params = fillPlaceholders(this.query.params, placeholderValues ?? {});18 this.logger.logQuery(this.query.sql, params);19 return this.prisma.$queryRawUnsafe(this.query.sql, ...params);20 }21}22class PrismaMySqlSession extends MySqlSession {23 constructor(dialect, prisma, options) {24 super(dialect);25 this.prisma = prisma;26 this.options = options;27 this.logger = options.logger ?? new NoopLogger();28 }29 static [entityKind] = "PrismaMySqlSession";30 logger;31 execute(query) {32 return this.prepareQuery(this.dialect.sqlToQuery(query)).execute();33 }34 all(_query) {35 throw new Error("Method not implemented.");36 }37 prepareQuery(query) {38 return new PrismaMySqlPreparedQuery(this.prisma, query, this.logger);39 }40 transaction(_transaction, _config) {41 throw new Error("Method not implemented.");42 }43}44export {45 PrismaMySqlPreparedQuery,46 PrismaMySqlSession47};48//# sourceMappingURL=session.js.map