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

Commit 6132bcc5 by Mick Hansen

normalize start/commit/rollback query generation

1 parent 07e72bdd
...@@ -551,7 +551,7 @@ module.exports = (function() { ...@@ -551,7 +551,7 @@ module.exports = (function() {
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
startTransactionQuery: function(options) { startTransactionQuery: function(options) {
throwMethodUndefined('startTransactionQuery') return "START TRANSACTION;"
}, },
/** /**
...@@ -561,7 +561,7 @@ module.exports = (function() { ...@@ -561,7 +561,7 @@ module.exports = (function() {
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
commitTransactionQuery: function(options) { commitTransactionQuery: function(options) {
throwMethodUndefined('commitTransactionQuery') return "COMMIT;"
}, },
/** /**
...@@ -571,7 +571,7 @@ module.exports = (function() { ...@@ -571,7 +571,7 @@ module.exports = (function() {
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
rollbackTransactionQuery: function(options) { rollbackTransactionQuery: function(options) {
throwMethodUndefined('rollbackTransactionQuery') return "ROLLBACK;"
}, },
addLimitAndOffset: function(options, query){ addLimitAndOffset: function(options, query){
......
...@@ -300,24 +300,6 @@ module.exports = (function() { ...@@ -300,24 +300,6 @@ module.exports = (function() {
return Utils._.template(sql)({ tableName: tableName, indexName: indexName }) return Utils._.template(sql)({ tableName: tableName, indexName: indexName })
}, },
/**
* Returns a query that starts a transaction.
*
* @param {Object} options An object with options.
* @return {String} The generated sql query.
*/
startTransactionQuery: function(options) {
return "START TRANSACTION;"
},
commitTransactionQuery: function(options) {
return "COMMIT;"
},
rollbackTransactionQuery: function(options) {
return "ROLLBACK;"
},
attributesToSQL: function(attributes) { attributesToSQL: function(attributes) {
var result = {} var result = {}
...@@ -428,7 +410,7 @@ module.exports = (function() { ...@@ -428,7 +410,7 @@ module.exports = (function() {
quoteIdentifiers: function(identifiers, force) { quoteIdentifiers: function(identifiers, force) {
return identifiers.split('.').map(function(v) { return this.quoteIdentifier(v, force) }.bind(this)).join('.') return identifiers.split('.').map(function(v) { return this.quoteIdentifier(v, force) }.bind(this)).join('.')
}, },
quoteTable: function(table) { quoteTable: function(table) {
return this.quoteIdentifier(table) return this.quoteIdentifier(table)
}, },
......
...@@ -859,25 +859,7 @@ module.exports = (function() { ...@@ -859,25 +859,7 @@ module.exports = (function() {
*/ */
dropForeignKeyQuery: function(tableName, foreignKey) { dropForeignKeyQuery: function(tableName, foreignKey) {
return 'ALTER TABLE ' + this.quoteIdentifier(tableName) + ' DROP CONSTRAINT ' + this.quoteIdentifier(foreignKey) + ';' return 'ALTER TABLE ' + this.quoteIdentifier(tableName) + ' DROP CONSTRAINT ' + this.quoteIdentifier(foreignKey) + ';'
}, }
/**
* Returns a query that starts a transaction.
*
* @param {Object} options An object with options.
* @return {String} The generated sql query.
*/
startTransactionQuery: function(options) {
return "START TRANSACTION;"
},
commitTransactionQuery: function(options) {
return "COMMIT;"
},
rollbackTransactionQuery: function(options) {
return "ROLLBACK;"
},
} }
// Private // Private
......
...@@ -376,10 +376,6 @@ module.exports = (function() { ...@@ -376,10 +376,6 @@ module.exports = (function() {
}) })
}, },
startTransactionQuery: function(options) {
return "BEGIN TRANSACTION;"
},
setAutocommitQuery: function(value) { setAutocommitQuery: function(value) {
return "-- SQLite does not support SET autocommit." return "-- SQLite does not support SET autocommit."
}, },
......
...@@ -1252,7 +1252,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1252,7 +1252,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
} }
}) })
it.only("should be able to create and update records under any valid schematic", function(done){ it("should be able to create and update records under any valid schematic", function(done){
var self = this var self = this
self.UserPublic.sync({ force: true }).done(function(err, UserPublicSync){ self.UserPublic.sync({ force: true }).done(function(err, UserPublicSync){
...@@ -1288,7 +1288,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1288,7 +1288,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
} }
done() done()
}).error(function (err) { }).error(function (err) {
console.log(err)
expect(err).not.to.be.ok expect(err).not.to.be.ok
}) })
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!