Currently I have code that goes through my sqlite database and gets the number of rows with a number equals 1. if that is the case I delete the row with that number. It works well but I was wondering if I could do the same in sqlite only instead of doing all this looping and constant pegging of the badtadase.
here is the code I currently have
public void deleteSession(){
ArrayList<long> numbers = getScannedNumbers();
for(int i=0; i<numbers.size(); i++){
int count = getRowCount(numbers.get(i).number);
if(count == 1){
//delete that row
}
}
}
getScannedNumbers returns a list of numbers (basically identifiers) from the database where a column called scan_count is > 0
getRowCount returns the number of rows that have the number as an identifier
can this be done as a single sql delete statement or is what I am doing with all the looping going to be my solution?
Aucun commentaire:
Enregistrer un commentaire