lundi 2 novembre 2015

How to create a sqlite table only if it doesnt exist?

Am using the following code to create a table. But i don't want to create it if it already exist. Is there any ways to do that?

String CREATE_CONTACTS_TABLE3 = "CREATE TABLE " + TABLE_CONTACTS3 + "("
                + KEY_URL3 + " TEXT,"
                + KEY_RESPONSE3 + " TEXT"+ ")";
        db.execSQL(CREATE_CONTACTS_TABLE3);

I know we can drop table if it already exist by using

db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);

But i don't want to delete it if already exist. Hope you understand my problem.

Aucun commentaire:

Enregistrer un commentaire