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

Commit 2d55a45b by Sascha Depold

fixed date bug

1 parent 4a61a0d5
Showing with 6 additions and 8 deletions
......@@ -87,13 +87,13 @@ Sequelize.prototype = {
table.klass.prepareAssociations()
})
if(SequelizeHelper.Hash.keys(this.tables).length == 0)
if((SequelizeHelper.Hash.keys(this.tables).length == 0) && callback)
callback()
else
SequelizeHelper.Hash.forEach(tables, function(table) {
table.klass.sync(function() {
finished.push(true)
if(finished.length == SequelizeHelper.Hash.keys(tables).length)
if((finished.length == SequelizeHelper.Hash.keys(tables).length) && callback)
callback()
})
})
......@@ -140,7 +140,7 @@ Sequelize.prototype = {
SequelizeHelper.log("Executing the query: " + queryString)
connection
.execute(queryString)
.query(queryString)
.addListener('row', function(r){ values.push(r) })
.addListener('field', function(f){ fields.push(f)})
.addListener('end', function() {
......@@ -152,7 +152,7 @@ Sequelize.prototype = {
mapping[fields[i].name] = valueArray[i]
result.push(mapping)
})
callback(result)
if(callback) callback(result)
}
})
connection.close()
......
......@@ -80,7 +80,6 @@ SequelizeTable = function(sequelize, tableName, attributes) {
)
},
// TODO: mysql library currently doesn't support MYSQL_DATE!!! look for fix
findAll: function(options, callback) {
// use the first param as callback if it is no object (hash)
var _callback = (typeof options == 'object') ? callback : options
......@@ -111,11 +110,10 @@ SequelizeTable = function(sequelize, tableName, attributes) {
)
},
// TODO: mysql library currently doesn't support MYSQL_DATE!!! don't merge if fixed
sqlResultToObject: function(result) {
if(typeof result == undefined) return null
var object = new table(SequelizeHelper.Hash.merge({createdAt: new Date(), updatedAt: new Date()}, result, true))
var object = new table(result)
object.id = result.id
return object
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!