SQLCipher for Android: In-Memory Databases OK?


#1

Does SQLCipher for Android support in-memory databases?

I have never used it that way, and in traditional Android app development it would be unusual. However, Room makes it really easy to use an in-memory database… and their entire test suite is written using that approach. The idea is that you would use in-memory databases for testing app logic, as the tests run a lot faster.

I tried converting their test suite over to use SQLCipher for Android 3.5.9 and normal on-disk databases, and I get spurious disk I/O errors. I don’t know if that’s indicative of a SQLCipher for Android problem or that their tests make assumptions about timing that don’t hold up when real disk I/O comes into play. So, I’m considering taking another shot at porting their tests, to use SQLCipher and in-memory databases, but I wanted your input as to whether that was likely to work before I spent time on it.

Thanks!


#2

Hi @commonsguy

Yes, SQLCipher for Android will support in memory databases, it just utilizes the special file name :memory: used by SQLite. We don’t have a specific test case focused just on an in memory database, but here is one were we validate WAL does not work with in memory databases. We can certainly expand on an in memory database scenario if it would be helpful.


#3

OK, I’ll try the SQCipher-and-:memory scenario next. Many thanks!