index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. "use strict";
  2. const _ = require("lodash");
  3. const AbstractDialect = require("../abstract");
  4. const ConnectionManager = require("./connection-manager");
  5. const Query = require("./query");
  6. const QueryGenerator = require("./query-generator");
  7. const DataTypes = require("../../data-types").mysql;
  8. const { MySQLQueryInterface } = require("./query-interface");
  9. class MysqlDialect extends AbstractDialect {
  10. constructor(sequelize) {
  11. super();
  12. this.sequelize = sequelize;
  13. this.connectionManager = new ConnectionManager(this, sequelize);
  14. this.queryGenerator = new QueryGenerator({
  15. _dialect: this,
  16. sequelize
  17. });
  18. this.queryInterface = new MySQLQueryInterface(sequelize, this.queryGenerator);
  19. }
  20. canBackslashEscape() {
  21. return true;
  22. }
  23. }
  24. MysqlDialect.prototype.supports = _.merge(_.cloneDeep(AbstractDialect.prototype.supports), {
  25. "VALUES ()": true,
  26. "LIMIT ON UPDATE": true,
  27. lock: true,
  28. forShare: "LOCK IN SHARE MODE",
  29. settingIsolationLevelDuringTransaction: false,
  30. inserts: {
  31. ignoreDuplicates: " IGNORE",
  32. updateOnDuplicate: " ON DUPLICATE KEY UPDATE"
  33. },
  34. index: {
  35. collate: false,
  36. length: true,
  37. parser: true,
  38. type: true,
  39. using: 1
  40. },
  41. constraints: {
  42. dropConstraint: false,
  43. check: false
  44. },
  45. indexViaAlter: true,
  46. indexHints: true,
  47. NUMERIC: true,
  48. GEOMETRY: true,
  49. JSON: true,
  50. REGEXP: true
  51. });
  52. MysqlDialect.prototype.defaultVersion = "5.7.0";
  53. MysqlDialect.prototype.Query = Query;
  54. MysqlDialect.prototype.QueryGenerator = QueryGenerator;
  55. MysqlDialect.prototype.DataTypes = DataTypes;
  56. MysqlDialect.prototype.name = "mysql";
  57. MysqlDialect.prototype.TICK_CHAR = "`";
  58. MysqlDialect.prototype.TICK_CHAR_LEFT = MysqlDialect.prototype.TICK_CHAR;
  59. MysqlDialect.prototype.TICK_CHAR_RIGHT = MysqlDialect.prototype.TICK_CHAR;
  60. module.exports = MysqlDialect;
  61. //# sourceMappingURL=index.js.map