Code example for SQLException

Methods: e, getMessage

0
                // upgrade 1,2 -> 3 added appWidgetId column 
                db.beginTransaction();
                try { 
                    // Insert new column for holding appWidgetIds 
                    db.execSQL("ALTER TABLE favorites " +
                        "ADD COLUMN appWidgetId INTEGER NOT NULL DEFAULT -1;"); 
                    db.setTransactionSuccessful();
                    version = 3;
                } catch (SQLException ex) {
                    // Old version remains, which means we wipe old data 
                    Log.e(LOG_TAG, ex.getMessage(), ex);
                } finally { 
                    db.endTransaction();
                } 
                 
                // Convert existing widgets only if table upgrade was successful 
                if (version == 3) {
                    convertWidgets(db);
                } 
            } 
 
            if (version < 4) {
                db.beginTransaction();
                try { 
                    db.execSQL("CREATE TABLE gestures (" +
                        "_id INTEGER PRIMARY KEY," + 
                        "title TEXT," + 
                        "intent TEXT," + 
                        "itemType INTEGER," + 
                        "iconType INTEGER," + 
                        "iconPackage TEXT," + 
                        "iconResource TEXT," + 
                        "icon BLOB" + 
                        ");"); 
                    db.setTransactionSuccessful();
                    version = 4;
                } catch (SQLException ex) {
                    // Old version remains, which means we wipe old data 
                    Log.e(LOG_TAG, ex.getMessage(), ex);