(value, field, options)
| 1009 | @private |
| 1010 | */ |
| 1011 | escape(value, field, options) { |
| 1012 | options = options || {}; |
| 1013 | |
| 1014 | if (value !== null && value !== undefined) { |
| 1015 | if (value instanceof Utils.SequelizeMethod) { |
| 1016 | return this.handleSequelizeMethod(value); |
| 1017 | } |
| 1018 | if (field && field.type) { |
| 1019 | this.validate(value, field, options); |
| 1020 | |
| 1021 | if (field.type.stringify) { |
| 1022 | // Users shouldn't have to worry about these args - just give them a function that takes a single arg |
| 1023 | const simpleEscape = escVal => SqlString.escape(escVal, this.options.timezone, this.dialect); |
| 1024 | |
| 1025 | value = field.type.stringify(value, { escape: simpleEscape, field, timezone: this.options.timezone, operation: options.operation }); |
| 1026 | |
| 1027 | if (field.type.escape === false) { |
| 1028 | // The data-type already did the required escaping |
| 1029 | return value; |
| 1030 | } |
| 1031 | } |
| 1032 | } |
| 1033 | } |
| 1034 | return SqlString.escape(value, this.options.timezone, this.dialect); |
| 1035 | } |
| 1036 | |
| 1037 | bindParam(bind) { |
| 1038 | return value => { |
no test coverage detected