Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix sql adapters

  • Loading branch information...
commit 16a1c21d9cf0e260e64bbc1b92c92ecf4d435372 1 parent 222b457
@1602 authored
View
1  lib/adapters/mysql.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';
View
1  lib/adapters/sqlite3.js
@@ -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
3  test/common_test.js
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.