Only flatten array/object for relational DBs
This commit is contained in:
parent
8e01e17bdb
commit
ef671825ff
|
@ -40,6 +40,9 @@ function DataAccessObject() {
|
||||||
|
|
||||||
|
|
||||||
DataAccessObject._forDB = function (data) {
|
DataAccessObject._forDB = function (data) {
|
||||||
|
if(!this.schema.isRelational()) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
var res = {};
|
var res = {};
|
||||||
Object.keys(data).forEach(function (propName) {
|
Object.keys(data).forEach(function (propName) {
|
||||||
if (this.whatTypeName(propName) === 'JSON' || data[propName] instanceof Array) {
|
if (this.whatTypeName(propName) === 'JSON' || data[propName] instanceof Array) {
|
||||||
|
|
|
@ -1271,6 +1271,10 @@ DataSource.prototype.defineOperation = function (name, options, fn) {
|
||||||
this._operations[name] = options;
|
this._operations[name] = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataSource.prototype.isRational = function() {
|
||||||
|
return this.adapter && this.adapter.relational;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define hidden property
|
* Define hidden property
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,6 +6,8 @@ module.exports = BaseSQL;
|
||||||
function BaseSQL() {
|
function BaseSQL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseSQL.prototype.rational = true;
|
||||||
|
|
||||||
BaseSQL.prototype.query = function () {
|
BaseSQL.prototype.query = function () {
|
||||||
throw new Error('query method should be declared in adapter');
|
throw new Error('query method should be declared in adapter');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue