public long create(ItemVO vo, int idFather) { SQLiteDatabase sqLiteDatabase = mDatabaseHelper.getWritableDatabase(); ContentValues values = DatabaseTableItem.translate(vo, idFather); long id = sqLiteDatabase.insert(DatabaseTableItem.TABLE_NAME, null, values); sqLiteDatabase.close(); return id; }
public boolean update(ItemVO vo, int idFather) { SQLiteDatabase sqLiteDatabase = mDatabaseHelper.getWritableDatabase(); ContentValues values = DatabaseTableItem.translate(vo, idFather); int ack = sqLiteDatabase.update( DatabaseTableItem.TABLE_NAME, values, DatabaseTableItem.ID + " = ?", new String[] {String.valueOf(vo.getId())}); sqLiteDatabase.close(); return ack == 1; }