List of usage examples for android.database.sqlite SQLiteDatabase execSQL
public void execSQL(String sql) throws SQLException
From source file:com.google.android.apps.forscience.whistlepunk.sensordb.SensorDatabaseImpl.java
public SensorDatabaseImpl(Context context, String name) { mOpenHelper = new SQLiteOpenHelper(context, name, null, DbVersions.CURRENT) { @Override//from w w w . j a va 2 s . co m public void onCreate(SQLiteDatabase db) { db.execSQL(ScalarSensorsTable.CREATION_SQL); db.execSQL(ScalarSensorsTable.INDEX_SQL); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { while (oldVersion != newVersion) { if (oldVersion == DbVersions.V1_START) { db.execSQL(ScalarSensorsTable.INDEX_SQL); oldVersion = DbVersions.V2_INDEX; } else if (oldVersion == DbVersions.V2_INDEX) { db.execSQL("ALTER TABLE " + ScalarSensorsTable.NAME + " ADD COLUMN " + ScalarSensorsTable.Column.RESOLUTION_TIER + " INTEGER DEFAULT 0;"); oldVersion = DbVersions.V3_TIER; } } } }; }
From source file:au.org.ala.fielddata.mobile.dao.DatabaseHelper.java
private void createAttributeRowTable(SQLiteDatabase db) { db.execSQL(RecordDAO.ATTRIBUTE_ROW_TABLE_DDL); }
From source file:au.org.ala.fielddata.mobile.dao.DatabaseHelper.java
private void createSpeciesTables(SQLiteDatabase db) { db.execSQL(SpeciesDAO.SPECIES_TABLE_DDL); db.execSQL(SpeciesDAO.SURVEY_SPECIES_TABLE_DDL); db.execSQL(SpeciesDAO.SPECIES_GROUP_DDL); createSpeciesIndexes(db);// ww w. j av a 2s . c o m }
From source file:com.github.michalbednarski.intentslab.providerlab.proxy.ProxyProviderDatabase.java
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { switch (oldVersion) { case 0:/*from ww w .jav a 2 s . c om*/ db.execSQL("CREATE TABLE operations (" + "_id INTEGER PRIMARY KEY AUTOINCREMENT," + "method INTEGER NOT NULL," + "uri TEXT NOT NULL," + "result," + /* no type */ "others TEXT," + /* JSON */ "exception TEXT," + "uid INTEGER NOT NULL" + ")"); // case 1: // current version } }
From source file:com.manning.androidhacks.hack023.provider.DatabaseHelper.java
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.i(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + TodoContentProvider.TODO_TABLE_NAME); onCreate(db);/*from www .j ava 2 s . c om*/ }
From source file:au.org.ala.fielddata.mobile.dao.DatabaseHelper.java
private void version5(SQLiteDatabase db) { db.execSQL("ALTER TABLE " + RecordDAO.RECORD_TABLE + " ADD COLUMN attributes_json TEXT"); db.execSQL("ALTER TABLE " + DraftRecordDAO.DRAFT_RECORD_TABLE + " ADD COLUMN attributes_json TEXT"); db.execSQL("ALTER TABLE " + RecordDAO.RECORD_TABLE + " ADD COLUMN location_wkt TEXT"); db.execSQL("ALTER TABLE " + DraftRecordDAO.DRAFT_RECORD_TABLE + " ADD COLUMN location_wkt TEXT"); }
From source file:com.clutch.ClutchStats.java
@Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE IF NOT EXISTS stats (uuid TEXT, ts REAL, action TEXT, data TEXT)"); db.execSQL("CREATE TABLE IF NOT EXISTS abcache (name TEXT, choice INTEGER)"); db.execSQL("CREATE TABLE IF NOT EXISTS ablog (uuid TEXT, ts REAL, data TEXT)"); }
From source file:com.example.android.touroflondon.data.TourDbHelper.java
@Override public void onCreate(SQLiteDatabase db) { // Create the two table db.execSQL(SQL_CREATE_ENTRIES_POI); db.execSQL(SQL_CREATE_ENTRIES_ROUTE); }
From source file:au.org.ala.fielddata.mobile.dao.DatabaseHelper.java
private void createRecordTable(SQLiteDatabase db) { db.execSQL(RecordDAO.RECORD_TABLE_DDL); db.execSQL(RecordDAO.ATTRIBUTE_VALUE_TABLE_DDL); db.execSQL(DraftRecordDAO.DRAFT_RECORD_TABLE_DDL); db.execSQL(DraftRecordDAO.DRAFT_ATTRIBUTE_TABLE_DDL); createRecordIndexes(db);//w w w. ja va 2 s .co m }
From source file:org.egov.android.data.SQLiteHelper.java
public void execSQL(String sql) { SQLiteDatabase db = getWritableDatabase(); db.execSQL(sql); db.close(); }