不要怂,就是干,撸起袖子干!

Commit f7c25fca by Jan Aagaard Meier

Add a note that .set only works for mysql and throw an error for other dialects

1 parent fa509566
Showing with 4 additions and 0 deletions
...@@ -564,6 +564,7 @@ module.exports = (function() { ...@@ -564,6 +564,7 @@ module.exports = (function() {
/** /**
* Execute a query which would set an environment or user variable. The variables are set per connection, so this function needs a transaction. * Execute a query which would set an environment or user variable. The variables are set per connection, so this function needs a transaction.
* Only works for MySQL.
* *
* @method set * @method set
* @param {Object} variables Object with multiple variables. * @param {Object} variables Object with multiple variables.
...@@ -578,6 +579,9 @@ module.exports = (function() { ...@@ -578,6 +579,9 @@ module.exports = (function() {
// Prepare options // Prepare options
options = Utils._.extend({}, this.options.set, typeof options === 'object' && options || {}); options = Utils._.extend({}, this.options.set, typeof options === 'object' && options || {});
if (['mysql', 'mariadb'].indexOf(this.options.dialect) === -1) {
throw new Error('sequelize.set is only supported for mysql');
}
if (!options.transaction || !(options.transaction instanceof Transaction) ) { if (!options.transaction || !(options.transaction instanceof Transaction) ) {
throw new TypeError("options.transaction is required"); throw new TypeError("options.transaction is required");
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!