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

Commit 048516f8 by Jan Aagaard Meier

Handle null blobs properly in sqlite, closes #1306

1 parent 5b9ff3d7
...@@ -111,7 +111,9 @@ module.exports = (function() { ...@@ -111,7 +111,9 @@ module.exports = (function() {
result[name] = new Date(val+'Z') // Z means UTC result[name] = new Date(val+'Z') // Z means UTC
} }
} else if (metaData.columnTypes[name].lastIndexOf('BLOB') !== -1) { } else if (metaData.columnTypes[name].lastIndexOf('BLOB') !== -1) {
result[name] = new Buffer(result[name]) if (result[name]) {
result[name] = new Buffer(result[name])
}
} }
} }
} }
......
...@@ -1805,6 +1805,18 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1805,6 +1805,18 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}) })
}) })
}) })
it("should work when the database returns null", function (done) {
var self = this
this.BlobUser.create({
// create a null column
}).success(function (user) {
self.BlobUser.find(user.id).success(function (user) {
expect(user.data).to.be.null
done()
})
})
})
}) })
describe("strings", function () { describe("strings", function () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!