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

Commit 0b75f32f by Mick Hansen

DEFAULT VALUES vs VALUES() on blank query

1 parent ab1eb32c
...@@ -5,7 +5,8 @@ var AbstractDialect = function() { ...@@ -5,7 +5,8 @@ var AbstractDialect = function() {
AbstractDialect.prototype.supports = { AbstractDialect.prototype.supports = {
'RETURNING': false, 'RETURNING': false,
'DEFAULT': true, 'DEFAULT': true,
'DEFAULT VALUES': false 'DEFAULT VALUES': false,
'VALUES ()': false
} }
module.exports = AbstractDialect module.exports = AbstractDialect
\ No newline at end of file
...@@ -115,6 +115,8 @@ module.exports = (function() { ...@@ -115,6 +115,8 @@ module.exports = (function() {
if (this._dialect.supports['DEFAULT VALUES']) { if (this._dialect.supports['DEFAULT VALUES']) {
emptyQuery += " DEFAULT VALUES" emptyQuery += " DEFAULT VALUES"
} else if (this._dialect.supports['VALUES ()']) {
emptyQuery += " VALUES ()"
} }
if (this._dialect.supports['RETURNING']) { if (this._dialect.supports['RETURNING']) {
......
...@@ -6,7 +6,7 @@ var MysqlDialect = function(sequelize) { ...@@ -6,7 +6,7 @@ var MysqlDialect = function(sequelize) {
} }
MysqlDialect.prototype.supports = _.extend(Abstract.prototype.supports, { MysqlDialect.prototype.supports = _.extend(Abstract.prototype.supports, {
'VALUES ()': true
}) })
module.exports = MysqlDialect module.exports = MysqlDialect
\ No newline at end of file
...@@ -812,7 +812,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -812,7 +812,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
}) })
}) })
it('should be able to add twice (second call result in UPDATE call) without any attributes (and timestamps off) on the through model', function (done) { it.only('should be able to add twice (second call result in UPDATE call) without any attributes (and timestamps off) on the through model', function (done) {
var Worker = this.sequelize.define('Worker', {}, {timestamps: false}) var Worker = this.sequelize.define('Worker', {}, {timestamps: false})
, Task = this.sequelize.define('Task', {}, {timestamps: false}) , Task = this.sequelize.define('Task', {}, {timestamps: false})
, WorkerTasks = this.sequelize.define('WorkerTasks', {}, {timestamps: false}) , WorkerTasks = this.sequelize.define('WorkerTasks', {}, {timestamps: false})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!