Fix sql adapters

This commit is contained in:
Anatoliy Chakkaev 2012-04-19 19:20:10 +04:00
parent 222b457b3f
commit 16a1c21d9c
3 changed files with 4 additions and 1 deletions

View File

@ -163,6 +163,7 @@ MySQL.prototype.toDatabase = function (prop, val) {
}
}
}
if (!prop) return val;
if (prop.type.name === 'Number') return val;
if (prop.type.name === 'Date') {
if (!val) return 'NULL';

View File

@ -133,6 +133,7 @@ function dateToMysql(val) {
}
SQLite3.prototype.toDatabase = function (prop, val) {
if (!prop) return val;
if (prop.type.name === 'Number') return val;
if (val === null) return 'NULL';
if (prop.type.name === 'Date') {

View File

@ -763,7 +763,8 @@ function testOrm(schema) {
User.find(user.id, function (err, user) {
test.ok(user !== u);
test.equal(user.passwd, 'qwertysalt');
User.all({where: {id: user.id}}, function (err, users) {
console.log(user.id);
User.all({where: {passwd: 'qwertysalt'}}, function (err, users) {
test.ok(users[0] !== user);
test.equal(users[0].passwd, 'qwertysalt');
User.create({passwd: 'asalat'}, function (err, usr) {