j256 / ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
http://ormlite.com/
ISC License
1.59k stars 367 forks source link

Ormlite rows not deleted #94

Closed cloudshooterhuman closed 6 years ago

cloudshooterhuman commented 6 years ago

Background :

Struggling with a subtle Ormlite bug while deleting rows from the table.

Taking into account that I have 3 clients and that TableUtils.clearTable(connectionSource, Client.class) return the deleted rows, when I debug clearTable return 3 which mean that 3 rows has been deleted but by inspecting the database with Stetho the 3 rows still there. I note that the suppression happen when I kill the app and launch it again. Which push me to think that the problem can be threads max limit but I don't have proven it.

public void clearSomeTables() {
        ConnectionSource connectionSource = getConnectionSource();
        try {
            TableUtils.clearTable(connectionSource, Client.class);
            TableUtils.clearTable(connectionSource, Table2.class);
            TableUtils.clearTable(connectionSource, Table3.class);
            TableUtils.clearTable(connectionSource, Table4.class);
        } catch (SQLException e) {
            Timber.e(e, "Can't clear Some tables");
        }
    }

I already shared this issue on SO : https://stackoverflow.com/questions/50355698/ormlite-rows-not-deleted