I have an online page where I put SQLite queries and then on my Android app I iterate through them and execute them.. Here is the code:
URL url;
try {
url = new URL(Database.UpdateDB_URL);
URLConnection connection = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line = null;
File dbfile = new File(Database.Database_PATH);
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);
while ((line = reader.readLine()) != null)
db.rawQuery(line.trim(), null);
db.close();
reader.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Here is an example of whats in line.trim() when the while loop is being run:
UPDATE Behavior SET Body="AAAAAA" WHERE _id=1
but when I browse the database in my phone I see that nothing's changed, but if I run this exact query on my pc, it works!
Why is that?