How do I use prepared statements in SQlite in Android?

android, prepared-statement, sqlite

Solution

I use prepared statements in Android all the time, it's quite simple:

SQLiteDatabase db = dbHelper.getWritableDatabase();
SQLiteStatement stmt = db.compileStatement("INSERT INTO Country (code) VALUES (?)");
stmt.bindString(1, "US");
stmt.executeInsert();

Problem

How do I use prepared statements in SQlite in Android?

Original source

Related problems