-
Notifications
You must be signed in to change notification settings - Fork 78
Adding basic support for POINT #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'd have to look though the cases, as maybe it would produce some false-positives? What is wrong with using |
There are of course false positives. And I just noticed The use case is something like this: db.query("UPDATE devices SET ? WHERE id = ?", [{
name : "John Doe",
location : { x: -8, y: 40 },
}, device_id, next); |
Right, I get what you're trying to do :) That's why I'm wondering why should there be any risk of false-positives when there is support for doing this today with no false positives? What, specifically, is wrong with using |
It was an easier path, since, when querying the database, the module does not return a |
I'm going to close this as there is a solution with recent versions: class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
toSqlString() {
return `GeomFromText('POINT(${SqlString.escape(this.x)} ${SqlString.escape(this.y})')`
}
} Eventually the |
Does this make sense? I'm overwriting the function locally but perhaps this could land upstream. It's not the most elegant but enables one to insert or update a record with a point, just the way mysql retrieved it.
Of course, it only works with 2D points, but for me it's 90% of geometries I use.
The text was updated successfully, but these errors were encountered: