Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.

Commit

Permalink
Merge commit '52fd7074610079' into sugo-db2-support
Browse files Browse the repository at this point in the history
  • Loading branch information
HeGanjie committed Jul 11, 2019
2 parents 36a47f7 + 52fd707 commit 9211cf5
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lib/dialects/db2/data-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,26 @@ module.exports = BaseTypes => {

class JSONTYPE extends BaseTypes.JSON {
toSql() {
if (this._length) {
return `VARCHAR(${this._length})`;
}
return 'VARCHAR(2000)';
return 'CLOB(32672)';
}
_stringify(value) {
return JSON.stringify(value);
}

_sanitize(value) {
if (typeof value === 'object') {
return value;
}
defaultType() {
return 'JSON';
}

static parse(value) {
return JSON.parse(value);
}
}

class JSONB extends BaseTypes.JSON {
defaultType() {
return 'JSON';
return 'JSONB';
}
}
JSONTYPE.parse = JSONTYPE.prototype._sanitize;

class STRING extends BaseTypes.STRING {
toSql() {
Expand Down Expand Up @@ -365,6 +364,6 @@ module.exports = BaseTypes => {
FLOAT,
TEXT,
JSON: JSONTYPE,
JSONB: JSONTYPE
JSONB
};
};

0 comments on commit 9211cf5

Please sign in to comment.