Skip to content

Commit

Permalink
Merge pull request #2449 from dreamersp/fix-update-geospatial-mysql
Browse files Browse the repository at this point in the history
Fix update of geospatial type column with mysql driver in UpdateQueryBuilder.ts
  • Loading branch information
pleerock committed Jul 2, 2018
2 parents 51b2a63 + 2b10721 commit a4dec02
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/query-builder/UpdateQueryBuilder.ts
Expand Up @@ -393,7 +393,12 @@ export class UpdateQueryBuilder<Entity> extends QueryBuilder<Entity> implements
this.expressionMap.nativeParameters[paramName] = value;
}

updateColumnAndValues.push(this.escape(column.databaseName) + " = " + this.connection.driver.createParameter(paramName, parametersCount));
if (this.connection.driver instanceof MysqlDriver && this.connection.driver.spatialTypes.indexOf(column.type) !== -1) {
updateColumnAndValues.push(this.escape(column.databaseName) + " = GeomFromText(" + this.connection.driver.createParameter(paramName, parametersCount) + ")");
} else {
updateColumnAndValues.push(this.escape(column.databaseName) + " = " + this.connection.driver.createParameter(paramName, parametersCount));
}

parametersCount++;
}
});
Expand Down

0 comments on commit a4dec02

Please sign in to comment.