Only flatten array/object for relational DBs

This commit is contained in:
Raymond Feng 2013-07-12 19:10:42 -07:00
parent 8e01e17bdb
commit ef671825ff
3 changed files with 9 additions and 0 deletions

View File

@ -40,6 +40,9 @@ function DataAccessObject() {
DataAccessObject._forDB = function (data) {
if(!this.schema.isRelational()) {
return data;
}
var res = {};
Object.keys(data).forEach(function (propName) {
if (this.whatTypeName(propName) === 'JSON' || data[propName] instanceof Array) {

View File

@ -1271,6 +1271,10 @@ DataSource.prototype.defineOperation = function (name, options, fn) {
this._operations[name] = options;
}
DataSource.prototype.isRational = function() {
return this.adapter && this.adapter.relational;
}
/**
* Define hidden property
*/

View File

@ -6,6 +6,8 @@ module.exports = BaseSQL;
function BaseSQL() {
}
BaseSQL.prototype.rational = true;
BaseSQL.prototype.query = function () {
throw new Error('query method should be declared in adapter');
};