session.cjs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6. var __export = (target, all) => {
  7. for (var name in all)
  8. __defProp(target, name, { get: all[name], enumerable: true });
  9. };
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") {
  12. for (let key of __getOwnPropNames(from))
  13. if (!__hasOwnProp.call(to, key) && key !== except)
  14. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15. }
  16. return to;
  17. };
  18. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  19. var session_exports = {};
  20. __export(session_exports, {
  21. PrismaMySqlPreparedQuery: () => PrismaMySqlPreparedQuery,
  22. PrismaMySqlSession: () => PrismaMySqlSession
  23. });
  24. module.exports = __toCommonJS(session_exports);
  25. var import_entity = require("../../entity.cjs");
  26. var import_logger = require("../../logger.cjs");
  27. var import_mysql_core = require("../../mysql-core/index.cjs");
  28. var import_sql = require("../../sql/sql.cjs");
  29. class PrismaMySqlPreparedQuery extends import_mysql_core.MySqlPreparedQuery {
  30. constructor(prisma, query, logger) {
  31. super(void 0, void 0, void 0);
  32. this.prisma = prisma;
  33. this.query = query;
  34. this.logger = logger;
  35. }
  36. iterator(_placeholderValues) {
  37. throw new Error("Method not implemented.");
  38. }
  39. static [import_entity.entityKind] = "PrismaMySqlPreparedQuery";
  40. execute(placeholderValues) {
  41. const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
  42. this.logger.logQuery(this.query.sql, params);
  43. return this.prisma.$queryRawUnsafe(this.query.sql, ...params);
  44. }
  45. }
  46. class PrismaMySqlSession extends import_mysql_core.MySqlSession {
  47. constructor(dialect, prisma, options) {
  48. super(dialect);
  49. this.prisma = prisma;
  50. this.options = options;
  51. this.logger = options.logger ?? new import_logger.NoopLogger();
  52. }
  53. static [import_entity.entityKind] = "PrismaMySqlSession";
  54. logger;
  55. execute(query) {
  56. return this.prepareQuery(this.dialect.sqlToQuery(query)).execute();
  57. }
  58. all(_query) {
  59. throw new Error("Method not implemented.");
  60. }
  61. prepareQuery(query) {
  62. return new PrismaMySqlPreparedQuery(this.prisma, query, this.logger);
  63. }
  64. transaction(_transaction, _config) {
  65. throw new Error("Method not implemented.");
  66. }
  67. }
  68. // Annotate the CommonJS export names for ESM import in node:
  69. 0 && (module.exports = {
  70. PrismaMySqlPreparedQuery,
  71. PrismaMySqlSession
  72. });
  73. //# sourceMappingURL=session.cjs.map