Permalink
Browse files

Fix sql adapters

  • Loading branch information...
1 parent 222b457 commit 16a1c21d9cf0e260e64bbc1b92c92ecf4d435372 @1602 committed Apr 19, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −0 lib/adapters/mysql.js
  2. +1 −0 lib/adapters/sqlite3.js
  3. +2 −1 test/common_test.js
@@ -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';
@@ -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
@@ -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) {

0 comments on commit 16a1c21

Please sign in to comment.