Search code examples
androidsqlitespatialite

Android: Failing to update row using SQL Extension function or builtin


I'm having a lot of trouble with SQLiteDatabase command. I have loaded up spatialite and enabled the extension. I want one of my values to be the output of the MakePoint function so I have a content value like this:

values.put("Location", "MakePoint(43.2, 27.345, 4326)");

When this is passed into SQLiteDatabase.Update() it's escapsed so that the resulting string ends up being "UPDATE Targets SET Location='MakePoint(43.2, 27.345, 4326)'" SQLite hates this and throws an exception.

Is there an easy way around this? Right now I'm trying to build up the string manually since I can't use Update.


Solution

  • I figured it out. I have to do a "SELECT MakePoint(43.2, 27.345, 4326)" first and then insert that into Location.