Code example for SQLException

Methods: printStackTrace, toString

0
            TableUtils.createTable(connectionSource, Category.class);
            TableUtils.createTable(connectionSource, LearningData.class);
 
            getSettingDao().create(new Setting()); 
            getCategoryDao().create(new Category()); 
 
            if (database.getVersion() == 0) {
                convertOldDatabase(database);
            } 
        } catch (SQLException e) {
            e.printStackTrace();
            throw new RuntimeException("Database creation error: " + e.toString());
        } 
    } 
 
    /* Convert database from AnyMemo < 9.0 */ 
    private void convertOldDatabase(SQLiteDatabase database) {
        Cursor res = database.rawQuery("select name from sqlite_master where type = 'table' and name = 'dict_tbl'", null);
        boolean isOldDatabase = res.getCount() > 0;
        res.close();
        // This is old database