I am trying to query my database based on a specific id.
String sql = "SELECT * FROM mash WHERE recipe_id = '" + id + "'"; Cursor data = database.rawQuery(sql, null);
If this is the first run of this operation, the table will exist along with the id column, but there will be no record with a specific identifier. How can I check if this particular entry exists, and if not, add it? I have found many questions regarding checking for the presence of a specific column, but nothing is checking if a specific record exists.
So far, I have been trying to get the index of the id column and checking if it returns -1, but for some reason it really returns 1. What can I use in the if statement to verify that the id column has not been created yet?
ryandlf
source share