We just joined Techstars London with our Mobile Database ObjectBox. We’re really happy to be part of Techstars and to have the opportunity to learn so much. If you’re interested in learning more about that, we will post regular updates on our Techstars’ journey on our ObjectBox Blog. We already posted on our first days at Techstars and how we got into Techstars. Thanks to everyone who helped us on our journey so far, but especially our developer community on github. We could never have done any of our projects without you and we appreciate your feedback and support a lot! Please feel free to ping us with any questions you may have.
What is an Object-Relational-Mapper (ORM)?
An ORM is a layer between the relational SQLite database and the object-oriented app code. The ORM allows the developer to use the database without the need to transform objects into a format suited for the relational database.
Do I need an ORM to work with SQLite?
At Droidcon Berlin, we noticed a lot of questions around databases and that many people weren’t aware of SQLite alternatives and Object-Relational Mappers (ORMs). Therefore, we follow up with an overview of the mobile database landscape.
What is a mobile database?
While Wikipedia defines a mobile database as “either a stationary database that can be connected to by a mobile computing device […] over a mobile network, or a database which is actually stored by the mobile device,” we solely refer to databases that run on the mobile device itself.
Why use a mobile database?
There are some advantages associated with using a mobile database:
That's really good news. Just by using the new version 3.5.0 of SQLCipher, you can reduce your APK size (and build/deployment time). Not just the binary .so files got smaller, also the big "icudt46l.dat" file was removed in 3.5.0.
To see the effect in an app, we took the greenDAO example app and compared the resulting sizes. Of course, the version using built-in SQLite is by far the smallest, but your APK may lose 4.4 MB if you were using a previous version of SQLCipher:
We noticed one incompatibility with SQLCipher 3.5.x however. Android's SQLiteDatabase defines two additional collations:
In addition to SQLite's default BINARY collator, Android supplies two more, LOCALIZED, which changes with the system's current locale, and UNICODE, which is the Unicode Collation Algorithm and not tailored to the current locale.
Running SQL ORDER commands with "COLLATE LOCALIZED" does not work anymore starting with SQLCipher 3.5.0. That is the downside of the ICU (and ASOP code) removal.
So, what about greenDAO support for SQLCipher 3.5.x? greenDAO used "COLLATE LOCALIZED" in the QueryBuilder when specifying orders using string properties. To ensure compatibility with SQLCipher 3.5, we just released greendao-encryption V2.2.2 without the LOCALIZED collation.