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

You need to sign in or sign up before continuing.
Commit 90bfe09b by Sascha Depold

fixed error handling misbehavior

1 parent e67e43c0
......@@ -34,4 +34,7 @@
# 0.3.0 #
- added possibility to define class and instance methods for models
- added import method for loading model definition from a file
\ No newline at end of file
- added import method for loading model definition from a file
# 0.3.1 #
- added error handling when defining invalid database credentials
\ No newline at end of file
......@@ -151,15 +151,15 @@ Sequelize.prototype = {
},
query: function(queryString, callback) {
var fields = []
var values = []
var self = this
var connection = require(__dirname + "/../lib/nodejs-mysql-native/client").createTCPClient()
var fields = [],
values = [],
self = this,
connection = require(__dirname + "/../lib/nodejs-mysql-native/client").createTCPClient()
connection.auto_prepare = true
connection
.auth(this.config.database, this.config.username, this.config.password)
.addListener("error", function(err) { callback(err) })
.addListener("error", function(err) { callback(null, null, err) })
.addListener('authorized', function() {
if(!self.options.disableLogging)
Sequelize.Helper.log("Executing the query: " + queryString)
......
......@@ -88,14 +88,14 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o
sequelize.query(
Sequelize.sqlQueryFor( 'create', { table: table.tableName, fields: fields.join(', ') } ),
function(err) { if(callback) callback(table, err) }
function(_, _, err) { if(callback) callback(table, err) }
)
},
drop: function(callback) {
sequelize.query(
Sequelize.sqlQueryFor('drop', { table: table.tableName }),
function(err) { if(callback) callback(table, err) }
function(_, _, err) { if(callback) callback(table, err) }
)
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!