Skip to content

Commit

Permalink
Fix update of geospatial type column with mysql driver in UpdateQuery…
Browse files Browse the repository at this point in the history
…Builder.ts as in InsertQueryBuilder.ts
  • Loading branch information
dreamersp committed Jul 2, 2018
1 parent 51b2a63 commit 2b10721
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 2b10721

Please sign in to comment.