| 176 | } |
| 177 | |
| 178 | handleJsonSelectQuery(rows) { |
| 179 | if (!this.model || !this.model.fieldRawAttributesMap) { |
| 180 | return; |
| 181 | } |
| 182 | for (const _field of Object.keys(this.model.fieldRawAttributesMap)) { |
| 183 | const modelField = this.model.fieldRawAttributesMap[_field]; |
| 184 | if (modelField.type instanceof DataTypes.JSON) { |
| 185 | // Value is returned as String, not JSON |
| 186 | rows = rows.map(row => { |
| 187 | if (row[modelField.fieldName] && typeof row[modelField.fieldName] === 'string') { |
| 188 | row[modelField.fieldName] = JSON.parse(row[modelField.fieldName]); |
| 189 | } |
| 190 | if (DataTypes.JSON.parse) { |
| 191 | return DataTypes.JSON.parse(modelField, this.sequelize.options, |
| 192 | row[modelField.fieldName]); |
| 193 | } |
| 194 | return row; |
| 195 | }); |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | async logWarnings(results) { |
| 201 | const warningResults = await this.run('SHOW WARNINGS'); |