public static void addDeletedColumn(SQLiteDatabase db) { try { db.execSQL("ALTER TABLE messages ADD deleted INTEGER default 0"); } catch (SQLiteException e) { if (!e.toString().startsWith("duplicate column name: deleted")) { throw e; } } } }
public static void addPreviewColumn(SQLiteDatabase db) { try { db.execSQL("ALTER TABLE messages ADD preview TEXT"); } catch (SQLiteException e) { if (!e.toString().startsWith("duplicate column name: preview")) { throw e; } } } }
@ChromeDevtoolsMethod public JsonRpcResult getDatabaseTableNames(JsonRpcPeer peer, JSONObject params) throws JsonRpcException { GetDatabaseTableNamesRequest request = mObjectMapper.convertValue(params, GetDatabaseTableNamesRequest.class); String databaseId = request.databaseId; DatabaseDescriptorHolder holder = mPeerListener.getDatabaseDescriptorHolder(databaseId); try { GetDatabaseTableNamesResponse response = new GetDatabaseTableNamesResponse(); response.tableNames = holder.driver.getTableNames(holder.descriptor); return response; } catch (SQLiteException e) { throw new JsonRpcException( new JsonRpcError( JsonRpcError.ErrorCode.INVALID_REQUEST, e.toString(), null /* data */)); } }
Log.e(TAG, "Error reading from catalog: " + e.toString());
Log.e(TAG, "Error reading from catalog: " + e.toString());
Log.e(TAG, "Sql exception occured: " + e.toString(), e); } catch(final Exception e) { Log.e(TAG, e.toString(), e);
protected Long updateByCore(final ContentValues entity, final SQLiteDatabase dbCon) { try { final Long id = entity.getAsLong(getPrimaryKeyColumnName()); String whereArgs[] = {id.toString()}; debug("updateByCore %s %s", getTableName(), entity); dbCon.update(getTableName(), entity, "_id = ?", whereArgs); return id; } catch (SQLiteException e2) { error("SQLiteException %s: %s", e2.getMessage(), e2.toString()); return -1L; } }