mercredi 22 juillet 2015

SQLite : DEFAULT values are not set to table's columns

I am trying to create a table in my app's SQLite database that has 3 columns that accept integer values. To create the table I use the following code :

db = openOrCreateDatabase("HelpMeDatabase", Context.MODE_PRIVATE, null);

        db.execSQL("CREATE TABLE IF NOT EXISTS settings (\n" +

                "\t whatsapp \t INTEGER NOT NULL DEFAULT 1,\n" +
                "\t viber \t INTEGER NOT NULL DEFAULT 1,\n" +
                "\t vibration \t INTEGER NOT NULL DEFAULT 1\n" +
                ");");

The table is created successfully but the default values are not assigned to the columns . Do you have any idea why this happens?

Aucun commentaire:

Enregistrer un commentaire