Search in sources :

Example 11 with SQLiteFullException

use of android.database.sqlite.SQLiteFullException in project MiMangaNu by raulhaag.

the class Database method markAllChapters.

public static void markAllChapters(Context context, int mangaId, boolean read) {
    ContentValues cv = new ContentValues();
    cv.put(COL_CAP_STATE, read ? Chapter.READ : Chapter.UNREAD);
    try {
        SQLiteDatabase database = getDatabase(context);
        if (!database.isReadOnly()) {
            database.update(TABLE_CHAPTERS, cv, COL_CAP_ID_MANGA + " = " + mangaId, null);
        } else {
            Log.e("Database", "(markAllChapters) " + context.getResources().getString(R.string.error_database_is_read_only));
            Util.getInstance().toast(context, context.getResources().getString(R.string.error_database_is_read_only));
        }
    } catch (SQLiteFullException sqlfe) {
        Log.e("Database", "SQLiteFullException", sqlfe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (SQLiteDiskIOException sqldioe) {
        Log.e("Database", "SQLiteDiskIOException", sqldioe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (Exception e) {
        Log.e("Database", "Exception", e);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    }
}
Also used : ContentValues(android.content.ContentValues) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDatabaseCorruptException(android.database.sqlite.SQLiteDatabaseCorruptException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteCantOpenDatabaseException(android.database.sqlite.SQLiteCantOpenDatabaseException) IOException(java.io.IOException) SQLException(android.database.SQLException) SQLiteConstraintException(android.database.sqlite.SQLiteConstraintException)

Example 12 with SQLiteFullException

use of android.database.sqlite.SQLiteFullException in project MiMangaNu by raulhaag.

the class Database method updateMangaLastIndex.

public static void updateMangaLastIndex(Context context, int mid, int idx) {
    ContentValues cv = new ContentValues();
    cv.put(COL_LAST_INDEX, idx);
    try {
        SQLiteDatabase database = getDatabase(context);
        if (!database.isReadOnly())
            database.update(TABLE_MANGA, cv, COL_ID + "=" + mid, null);
        else {
            Log.e("Database", "(updateMangaLastIndex) " + context.getResources().getString(R.string.error_database_is_read_only));
            Util.getInstance().toast(context, context.getResources().getString(R.string.error_database_is_read_only));
        }
    } catch (SQLiteFullException sqlfe) {
        Log.e("Database", "SQLiteFullException", sqlfe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (SQLiteDiskIOException sqldioe) {
        Log.e("Database", "SQLiteDiskIOException", sqldioe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (Exception e) {
        Log.e("Database", "Exception", e);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    }
}
Also used : ContentValues(android.content.ContentValues) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDatabaseCorruptException(android.database.sqlite.SQLiteDatabaseCorruptException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteCantOpenDatabaseException(android.database.sqlite.SQLiteCantOpenDatabaseException) IOException(java.io.IOException) SQLException(android.database.SQLException) SQLiteConstraintException(android.database.sqlite.SQLiteConstraintException)

Example 13 with SQLiteFullException

use of android.database.sqlite.SQLiteFullException in project MiMangaNu by raulhaag.

the class Database method updateManga.

/**
 * For information,
 * <p/>
 * setTime = false is "updateMangaNo
 * Time"
 * setTime = true is "updateManga"
 */
public static void updateManga(Context context, Manga manga, boolean setTime) {
    try {
        SQLiteDatabase database = getDatabase(context);
        if (!database.isReadOnly())
            database.update(TABLE_MANGA, setMangaCV(manga, setTime), COL_ID + "=" + manga.getId(), null);
        else {
            Log.e("Database", "(updateManga) " + context.getResources().getString(R.string.error_database_is_read_only));
            Util.getInstance().toast(context, context.getResources().getString(R.string.error_database_is_read_only));
        }
    } catch (SQLiteFullException sqlfe) {
        Log.e("Database", "SQLiteFullException", sqlfe);
        outputMangaDebugInformation(manga);
        Util.getInstance().toast(context, context.getString(R.string.error_while_updating_chapter_or_manga_in_db, manga.getTitle()));
    } catch (SQLiteDiskIOException sqldioe) {
        Log.e("Database", "SQLiteDiskIOException", sqldioe);
        outputMangaDebugInformation(manga);
        Util.getInstance().toast(context, context.getString(R.string.error_while_updating_chapter_or_manga_in_db, manga.getTitle()));
    } catch (Exception e) {
        Log.e("Database", "Exception", e);
        outputMangaDebugInformation(manga);
        Util.getInstance().toast(context, context.getString(R.string.error_while_updating_chapter_or_manga_in_db, manga.getTitle()));
    }
}
Also used : SQLiteDatabase(android.database.sqlite.SQLiteDatabase) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDatabaseCorruptException(android.database.sqlite.SQLiteDatabaseCorruptException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteCantOpenDatabaseException(android.database.sqlite.SQLiteCantOpenDatabaseException) IOException(java.io.IOException) SQLException(android.database.SQLException) SQLiteConstraintException(android.database.sqlite.SQLiteConstraintException)

Example 14 with SQLiteFullException

use of android.database.sqlite.SQLiteFullException in project MiMangaNu by raulhaag.

the class Database method updateChapterPlusDownload.

static void updateChapterPlusDownload(Context context, Chapter cap) {
    ContentValues cv = new ContentValues();
    cv.put(COL_CAP_NAME, cap.getTitle());
    cv.put(COL_CAP_PATH, cap.getPath());
    cv.put(COL_CAP_PAGES, cap.getPages());
    cv.put(COL_CAP_STATE, cap.getReadStatus());
    cv.put(COL_CAP_PAG_READ, cap.getPagesRead());
    cv.put(COL_CAP_DOWNLOADED, cap.isDownloaded() ? 1 : 0);
    try {
        SQLiteDatabase database = getDatabase(context);
        if (!database.isReadOnly())
            database.update(TABLE_CHAPTERS, cv, COL_CAP_ID + " = " + cap.getId(), null);
        else {
            Log.e("Database", "(updateChapterPlusDownload) " + context.getResources().getString(R.string.error_database_is_read_only));
            Util.getInstance().toast(context, context.getResources().getString(R.string.error_database_is_read_only));
        }
    } catch (SQLiteFullException sqlfe) {
        Log.e("Database", "SQLiteFullException", sqlfe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (SQLiteDiskIOException sqldioe) {
        Log.e("Database", "SQLiteDiskIOException", sqldioe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (Exception e) {
        Log.e("Database", "Exception", e);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    }
}
Also used : ContentValues(android.content.ContentValues) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDatabaseCorruptException(android.database.sqlite.SQLiteDatabaseCorruptException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteCantOpenDatabaseException(android.database.sqlite.SQLiteCantOpenDatabaseException) IOException(java.io.IOException) SQLException(android.database.SQLException) SQLiteConstraintException(android.database.sqlite.SQLiteConstraintException)

Example 15 with SQLiteFullException

use of android.database.sqlite.SQLiteFullException in project MiMangaNu by raulhaag.

the class Database method setUpgradable.

public static void setUpgradable(Context context, int mangaid, boolean buscar) {
    ContentValues cv = new ContentValues();
    cv.put(COL_IS_FINISHED, buscar ? 1 : 0);
    try {
        SQLiteDatabase database = getDatabase(context);
        if (!database.isReadOnly())
            database.update(TABLE_MANGA, cv, COL_ID + "=" + mangaid, null);
        else {
            Log.e("Database", "(setUpgradable) " + context.getResources().getString(R.string.error_database_is_read_only));
            Util.getInstance().toast(context, context.getResources().getString(R.string.error_database_is_read_only));
        }
    } catch (SQLiteFullException sqlfe) {
        Log.e("Database", "SQLiteFullException", sqlfe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (SQLiteDiskIOException sqldioe) {
        Log.e("Database", "SQLiteDiskIOException", sqldioe);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    } catch (Exception e) {
        Log.e("Database", "Exception", e);
        Util.getInstance().toast(context, context.getString(R.string.error_while_trying_to_update_db));
    }
}
Also used : ContentValues(android.content.ContentValues) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteFullException(android.database.sqlite.SQLiteFullException) SQLiteDatabaseCorruptException(android.database.sqlite.SQLiteDatabaseCorruptException) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) SQLiteCantOpenDatabaseException(android.database.sqlite.SQLiteCantOpenDatabaseException) IOException(java.io.IOException) SQLException(android.database.SQLException) SQLiteConstraintException(android.database.sqlite.SQLiteConstraintException)

Aggregations

SQLiteFullException (android.database.sqlite.SQLiteFullException)23 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)16 ContentValues (android.content.ContentValues)15 SQLiteDiskIOException (android.database.sqlite.SQLiteDiskIOException)14 IOException (java.io.IOException)13 SQLException (android.database.SQLException)12 SQLiteCantOpenDatabaseException (android.database.sqlite.SQLiteCantOpenDatabaseException)12 SQLiteConstraintException (android.database.sqlite.SQLiteConstraintException)12 SQLiteDatabaseCorruptException (android.database.sqlite.SQLiteDatabaseCorruptException)12 Context (android.content.Context)3 Cursor (android.database.Cursor)3 SQLiteQueryBuilder (android.database.sqlite.SQLiteQueryBuilder)3 Uri (android.net.Uri)3 ResolveInfo (android.content.pm.ResolveInfo)2 ServiceInfo (android.content.pm.ServiceInfo)2 SQLiteOpenHelper (android.database.sqlite.SQLiteOpenHelper)2 SQLiteStatement (android.database.sqlite.SQLiteStatement)2 Bundle (android.os.Bundle)2 Date (java.util.Date)2 ImPlugin (org.awesomeapp.messenger.plugin.ImPlugin)2