Example usage for android.database.sqlite SQLiteDatabase execSQL

List of usage examples for android.database.sqlite SQLiteDatabase execSQL

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteDatabase execSQL.

Prototype

public void execSQL(String sql) throws SQLException 

Source Link

Document

Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.

Usage

From source file:com.example.shutapp.DatabaseHandler.java

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // Drop older table if existed
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_CHATROOMS);

    // Create tables again
    onCreate(db);//  w w w.  j  a v a2  s  .  c  o  m

}

From source file:za.co.neilson.alarm.database.Database.java

@Override
public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub
    db.execSQL("CREATE TABLE IF NOT EXISTS " + ALARM_TABLE + " ( " + COLUMN_ALARM_ID
            + " INTEGER primary key autoincrement, " + COLUMN_ALARM_ACTIVE + " INTEGER NOT NULL, "
            + COLUMN_ALARM_TIME + " TEXT NOT NULL, " + COLUMN_ALARM_DAYS + " BLOB NOT NULL, "
            + COLUMN_ALARM_DIFFICULTY + " INTEGER NOT NULL, " + COLUMN_ALARM_TONE + " TEXT NOT NULL, "
            + COLUMN_ALARM_VIBRATE + " INTEGER NOT NULL, " + COLUMN_ALARM_NAME + " TEXT NOT NULL)");
}

From source file:com.example.android.touroflondon.data.TourDbHelper.java

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // On database upgrade remove both tables and create them again.
    // TODO: An application should handle graceful database upgrades
    db.execSQL(SQL_DROP_POI);
    db.execSQL(SQL_DROP_ROUTE);/*ww  w. ja v  a 2 s  . co m*/
    onCreate(db);
}

From source file:ch.sebastienzurfluh.swissmuseumguides.contentprovider.model.io.connectors.LocalConnector.java

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    for (String dropTableStatement : DROP_TABLES) {
        db.execSQL(dropTableStatement);
    }/*from  w  ww  .j a  va 2 s. c o  m*/
    onCreate(db);
}

From source file:com.seneca.android.senfitbeta.DbHelper.java

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS" + USER_TABLE);
    db.execSQL("DROP TABLE IF EXISTS" + EXERCISE_TABLE);
    db.execSQL("DROP TABLE IF EXISTS" + RIP_TABLE);
    db.execSQL("DROP TABLE IF EXISTS" + IMG_TABLE);
    db.execSQL("DROP TABLE IF EXISTS" + CALENDER_TABLE);

    onCreate(db);/* w  ww  . java  2 s . c  o m*/
}

From source file:be.benvd.mvforandroid.data.DatabaseHelper.java

@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL("CREATE TABLE IF NOT EXISTS " + Usage.TABLE_NAME + " ("
            + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + "timestamp INTEGER NOT NULL, " + "duration INTEGER, "
            + "type INTEGER, " + "incoming INTEGER, " + "contact TEXT, " + "cost REAL);");
    db.execSQL("CREATE TABLE IF NOT EXISTS " + Topups.TABLE_NAME + " ("
            + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + "amount REAL NOT NULL, " + "method TEXT NOT NULL, "
            + "executed_on INTEGER NOT NULL, " + "received_on INTEGER NOT NULL, " + "status TEXT NOT NULL);");
    db.execSQL("CREATE TABLE IF NOT EXISTS " + Credit.TABLE_NAME + " ("
            + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + "valid_until INTEGER NULL, "
            + "expired INTEGER NOT NULL, " + "sms INTEGER NOT NULL, " + "data INTEGER NOT NULL, "
            + "credits REAL NOT NULL, " + "price_plan TEXT NOT NULL, " + "sms_son INTEGER NOT NULL);");
    db.execSQL("CREATE TABLE IF NOT EXISTS " + Msisdns.TABLE_NAME + " ("
            + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + "timestamp INTEGER NOT NULL, " + "msisdn TEXT);");
}

From source file:heartware.com.heartware_master.DBAdapter.java

public void deleteMeetup(String note) {
    SQLiteDatabase database = this.getWritableDatabase();
    String deleteQuery = "DELETE FROM " + MEETUPS_TABLE + " WHERE " + NOTE + "='" + note + "'";
    database.execSQL(deleteQuery);
}

From source file:ch.sebastienzurfluh.swissmuseumguides.contentprovider.model.io.connectors.LocalConnector.java

@Override
public void onCreate(SQLiteDatabase db) {
    System.out.println("LocalConnector: onCreate");

    for (String createTableStatement : CREATE_TABLES) {
        db.execSQL(createTableStatement);
    }/*  w  ww .  j a  v  a2 s  . c  o m*/
    System.out.println("LocalConnector: onCreate completed");
}

From source file:com.clutch.ClutchStats.java

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion
            + ", which will destroy all old data");
    db.execSQL("DROP TABLE IF EXISTS stats");
    db.execSQL("DROP TABLE IF EXISTS abcache");
    db.execSQL("DROP TABLE IF EXISTS ablog");
    onCreate(db);/*from  w  ww.  j av a2  s .co  m*/
}

From source file:heartware.com.heartware_master.DBAdapter.java

public void deleteProfile(String id) {
    SQLiteDatabase database = this.getWritableDatabase();
    String deleteQuery = "DELETE FROM " + PROFILES_TABLE + " WHERE " + PROFILE_ID + "='" + id + "'";
    database.execSQL(deleteQuery);
}