Try to get large file

Issue #81 resolved
Evgeny Bozhko created an issue

Hi developers this beautiful issue for large data. I receive problem, your project don't has any docs. I will be very happy if you write docs for usage all functionality with samples. Thanks.

Also I have another problem, when try to get large blob data at android database.

When I try get large blob witch biggest than phone VM heap, I receive out of memory exception.

                db.open(true);
                SQLiteStatement sqLiteStatement = db.prepare("SELECT * FROM ZLISTENEXERCISE");

                List<AudioText> audioTextList = new ArrayList<AudioText>();

                try {
                    while (sqLiteStatement.step()) {
                        System.gc();
                        AudioText audioText = new AudioText();
                        audioText.articleName = Tools.escapeApostrophe(sqLiteStatement.columnString(1));
                        audioText.editionName = sqLiteStatement.columnString(2);
                        audioText.title = Tools.escapeApostrophe(sqLiteStatement.columnString(3));
                        audioText.content = sqLiteStatement.columnString(4);
                        audioText.audio = sqLiteStatement.columnBlob(5);
                        audioTextList.add(audioText);
                    }
                } finally {
                    sqLiteStatement.dispose();
                    db.dispose();
                }

When code execution problem has come at 14 line. So when I can solve this issue ??? Very thanks.

Comments (2)

  1. Igor Sereda

    Well, I guess, better late than never. Evgeny – sorry you have that trouble. I believe you can try using columnStream() method and then reading from the stream in chunks. This should not cause buffering the whole data blob in memory.

    Sorry for missing your question before. Igor

  2. Log in to comment