1

I'm working on my own implementation of slf4 for android which has in-memory db and flushes data to sd when i need it. The reason we have to skip using default android.util.Log is that we need to get logs "if something happens" and android log is already truncated. (Is there any way to configure android log not to truncate records until we know we no need it any more?)

I've found that SQLite can work in in-memory mode when passing null as db name: Using in-memory sqlite android

How can i flush it to sd? Will only diff be flushed or all db will be rewritten? It's important for performance reason.

To be more detailed i'm going to use OrmLite to save and request from db. Probably it's not a good idea because of performance, but we should start with it and switch to raw request if it's not fast enough. Will using OrmLite help to solve it probably (some caches or smth else)?

Community
  • 1
  • 1
4ntoine
  • 19,816
  • 21
  • 96
  • 220

1 Answers1

1

If I understood you, you want to drop new data-log into sd card using SQLite.

If I were you if would use ATTACH command for new SQLite on SD card database and merge tables you wanted with a paticular parameters.

That is,

ATTACH 'dbpath' AS AM;
BEGIN TRANSACTION;
CREATE TABLE AM.tableName0 (<rows>);
INSERT INTO AM.tableName0 (<rows>) SELECT <rows> FROM tableName0 ;
COMMIT;

DETACH DATABASE 'AM';

But I do not think that writing into SD card is very fast.

Vyacheslav
  • 26,359
  • 19
  • 112
  • 194