diff --git a/lib/Drivers/DML/mysql.js b/lib/Drivers/DML/mysql.js index d73b5d08..bc3d8c03 100755 --- a/lib/Drivers/DML/mysql.js +++ b/lib/Drivers/DML/mysql.js @@ -267,7 +267,9 @@ Driver.prototype.propertyToValue = function (value, property) { value = (value) ? 1 : 0; break; case "object": - value = JSON.stringify(value); + if (value !== null) { + value = JSON.stringify(value); + } break; case "point": return function() { return 'POINT(' + value.x + ', ' + value.y + ')'; }; diff --git a/lib/Drivers/DML/postgres.js b/lib/Drivers/DML/postgres.js index b2470b69..5dc5ca2b 100644 --- a/lib/Drivers/DML/postgres.js +++ b/lib/Drivers/DML/postgres.js @@ -302,7 +302,9 @@ Driver.prototype.propertyToValue = function (value, property) { switch (property.type) { case "object": - value = JSON.stringify(value); + if (value !== null) { + value = JSON.stringify(value); + } break; case "date": if (this.config.timezone && this.config.timezone != 'local') { diff --git a/lib/Drivers/DML/sqlite.js b/lib/Drivers/DML/sqlite.js index 023ffecf..d124bcd7 100644 --- a/lib/Drivers/DML/sqlite.js +++ b/lib/Drivers/DML/sqlite.js @@ -273,7 +273,9 @@ Driver.prototype.propertyToValue = function (value, property) { value = (value) ? 1 : 0; break; case "object": - value = JSON.stringify(value); + if (value !== null) { + value = JSON.stringify(value); + } break; case "date": if (this.config.query && this.config.query.strdates) {