DBFlow icon indicating copy to clipboard operation
DBFlow copied to clipboard

Storage limit

Open OptimistNot opened this issue 10 years ago • 1 comments

Hey! I've got a question.. I'm using something like this:

        getDatabase().beginTransaction();
        try {
            for (JsonTranslator model: models) {
                model.convertToModel().save();
            }
            getDatabase().setTransactionSuccessful();
        } catch (Exception error) {
            handler.handleResultException(error);
        } finally {
            getDatabase().endTransaction();
        }

what if in the middle of transaction user come to limit of storage space and ignores it? I know that Android will try to clear cache to get more space and supposedly it'll continue.. Is there any problem with it? Im not using caching. Is there any possibility that transaction will somehow loose models before setTransactionSuccessful is called and it'll save nothing?

OptimistNot avatar Apr 13 '16 10:04 OptimistNot

if the transaction fails without succeeding, the DB rolls back to the previous state it was in. SQLite database ops are ACID (https://www.sqlite.org/transactional.html) so you shouldn't have any real issues with it breaking the DB if it runs out of space.

agrosner avatar Apr 18 '16 01:04 agrosner