Fork us on GitHub

Spatial, Pluggable SQLite

We added a new ability to replace the builtin SQLite implementation
Spatial, Pluggable SQLite

Spatial, Pluggable SQLite

One of our enterprise accounts is working on a complex GIS application that needs fine grained control over mapping. In this case features such as native maps aren’t useful. For some GIS applications the old MapComponent is more useful as it allows working with domain specific data. One of the features he needed was spatial support in the builtin SQL database.

When we initially implemented sqlite support we just delegated all the SQL calls to the OS native equivalents and called it a day. This works well for 98% of the cases but there are two big use cases that are missing by default in Android & iOS: Spatial queries & Security.

SpatiaLite allows you to use geographic locations in SQL. You can effectively query based on physical location which is surprisingly hard to do accurately without such an API. For simple cases like an Uber app you wouldn’t necessarily need something like that but for the more elaborate use cases it might become essential.

The SQL database in iOS/Android isn’t encrypted either, this isn’t a big deal for most applications but for some highly secure implementations that might be a hindrance. There is builtin support for encryption in SQLite that can be turned on as well.

A Pluggable Solution

We needed to solve the first problem so Steve created the Spatialite cn1lib which is now available in the extension manager. The cn1lib extends the Database class & allows you to plug-in a custom version of sqlite to replace the Database.

This approach can be extended to support other use cases for security and potentially other capabilities we aren’t aware of.

As a side note this took a lot of effort to build. That’s the type of work we do for enterprise customers!

Facebook Module Status

With a quick pivot I’ll also provide a quick update on the facebook clone module. We now have 8 lessons in the module and I’ve been adding more on a daily basis. I’m pretty sure we’ll have way more than 30 lessons so I’ll try to pick up the pace!

Here is another sample of the new post Form:

New Post Form in The Facebook Clone App
Figure 1. New Post Form in The Facebook Clone App
Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.