Java Code Examples for com.activeandroid.util.SQLiteUtils#execSql()
The following examples show how to use
com.activeandroid.util.SQLiteUtils#execSql() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BloodTest.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static void fixUpTable() { if (patched) return; final String[] patchup = { "CREATE TABLE BloodTest (_id INTEGER PRIMARY KEY AUTOINCREMENT);", "ALTER TABLE BloodTest ADD COLUMN timestamp INTEGER;", "ALTER TABLE BloodTest ADD COLUMN created_timestamp INTEGER;", "ALTER TABLE BloodTest ADD COLUMN state INTEGER;", "ALTER TABLE BloodTest ADD COLUMN mgdl REAL;", "ALTER TABLE BloodTest ADD COLUMN source TEXT;", "ALTER TABLE BloodTest ADD COLUMN uuid TEXT;", "CREATE UNIQUE INDEX index_Bloodtest_uuid on BloodTest(uuid);", "CREATE UNIQUE INDEX index_Bloodtest_timestamp on BloodTest(timestamp);", "CREATE INDEX index_Bloodtest_created_timestamp on BloodTest(created_timestamp);", "CREATE INDEX index_Bloodtest_state on BloodTest(state);"}; for (String patch : patchup) { try { SQLiteUtils.execSql(patch); // UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch); } catch (Exception e) { // UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString()); } } patched = true; }
Example 2
Source File: HeartRate.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private static void fixUpTable() { if (patched) return; String[] patchup = { "CREATE TABLE HeartRate (_id INTEGER PRIMARY KEY AUTOINCREMENT);", "ALTER TABLE HeartRate ADD COLUMN timestamp INTEGER;", "ALTER TABLE HeartRate ADD COLUMN bpm INTEGER;", "ALTER TABLE HeartRate ADD COLUMN accuracy INTEGER;", "CREATE UNIQUE INDEX index_HeartRate_timestamp on HeartRate(timestamp);"}; for (String patch : patchup) { try { SQLiteUtils.execSql(patch); // UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch); } catch (Exception e) { // UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString()); } } patched = true; }
Example 3
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 6 votes |
public synchronized static void updateDB() { final String[] updates = new String[]{"ALTER TABLE BgReadings ADD COLUMN dg_mgdl REAL;", "ALTER TABLE BgReadings ADD COLUMN dg_slope REAL;", "ALTER TABLE BgReadings ADD COLUMN dg_delta_name TEXT;", "ALTER TABLE BgReadings ADD COLUMN source_info TEXT;"}; for (String patch : updates) { try { SQLiteUtils.execSql(patch); } catch (Exception e) { } } // needs different handling on wear if (JoH.areWeRunningOnAndroidWear()) { BgSendQueue.emptyQueue(); SqliteRejigger.rejigSchema("BgReadings", "uuid TEXT UNIQUE ON CONFLICT FAIL", "uuid TEXT UNIQUE ON CONFLICT REPLACE"); SqliteRejigger.rejigSchema("BgReadings", "uuid TEXT UNIQUE ON CONFLICT IGNORE", "uuid TEXT UNIQUE ON CONFLICT REPLACE"); SqliteRejigger.rejigSchema("BgSendQueue", "BgReadings_temp", "BgReadings"); } }
Example 4
Source File: StepCounter.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static void fixUpTable() { if (patched) return; String[] patchup = { "CREATE TABLE PebbleMovement (_id INTEGER PRIMARY KEY AUTOINCREMENT);", "ALTER TABLE PebbleMovement ADD COLUMN timestamp INTEGER;", "ALTER TABLE PebbleMovement ADD COLUMN metric INTEGER;", "CREATE UNIQUE INDEX index_PebbleMovement_timestamp on PebbleMovement(timestamp);"}; for (String patch : patchup) { try { SQLiteUtils.execSql(patch); // UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch); } catch (Exception e) { // UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString()); } } patched = true; }
Example 5
Source File: HeartRate.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static void fixUpTable() { if (patched) return; String[] patchup = { "CREATE TABLE HeartRate (_id INTEGER PRIMARY KEY AUTOINCREMENT);", "ALTER TABLE HeartRate ADD COLUMN timestamp INTEGER;", "ALTER TABLE HeartRate ADD COLUMN bpm INTEGER;", "ALTER TABLE HeartRate ADD COLUMN accuracy INTEGER;", "CREATE UNIQUE INDEX index_HeartRate_timestamp on HeartRate(timestamp);"}; for (String patch : patchup) { try { SQLiteUtils.execSql(patch); // UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch); } catch (Exception e) { // UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString()); } } patched = true; }
Example 6
Source File: BloodTest.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static void fixUpTable() { if (patched) return; final String[] patchup = { "CREATE TABLE BloodTest (_id INTEGER PRIMARY KEY AUTOINCREMENT);", "ALTER TABLE BloodTest ADD COLUMN timestamp INTEGER;", "ALTER TABLE BloodTest ADD COLUMN created_timestamp INTEGER;", "ALTER TABLE BloodTest ADD COLUMN state INTEGER;", "ALTER TABLE BloodTest ADD COLUMN mgdl REAL;", "ALTER TABLE BloodTest ADD COLUMN source TEXT;", "ALTER TABLE BloodTest ADD COLUMN uuid TEXT;", "CREATE UNIQUE INDEX index_Bloodtest_uuid on BloodTest(uuid);", "CREATE UNIQUE INDEX index_Bloodtest_timestamp on BloodTest(timestamp);", "CREATE INDEX index_Bloodtest_created_timestamp on BloodTest(created_timestamp);", "CREATE INDEX index_Bloodtest_state on BloodTest(state);"}; for (String patch : patchup) { try { SQLiteUtils.execSql(patch); // UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch); } catch (Exception e) { // UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString()); } } patched = true; }
Example 7
Source File: Calibration.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void cleanup(long timestamp) { try { SQLiteUtils.execSql("delete from CalibrationRequest"); List<Calibration> data = new Select() .from(BgReading.class) .where("timestamp < ?", timestamp) .orderBy("timestamp desc") .execute(); if (data != null) Log.d(TAG, "cleanup Calibration size=" + data.size()); new Calibration.Cleanup().execute(data); } catch (Exception e) { Log.e(TAG, "Got exception running cleanup " + e.toString()); } }
Example 8
Source File: BgReading.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void cleanup(long timestamp) { try { SQLiteUtils.execSql("delete from BgSendQueue"); List<BgReading> data = new Select() .from(BgReading.class) .where("timestamp < ?", timestamp) .orderBy("timestamp desc") .execute(); if (data != null) Log.d(TAG, "cleanup BgReading size=" + data.size()); new Cleanup().execute(data); } catch (Exception e) { Log.e(TAG, "Got exception running cleanup " + e.toString()); } }
Example 9
Source File: BgReading.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void cleanup(long timestamp) { try { SQLiteUtils.execSql("delete from BgSendQueue"); List<BgReading> data = new Select() .from(BgReading.class) .where("timestamp < ?", timestamp) .orderBy("timestamp desc") .execute(); if (data != null) Log.d(TAG, "cleanup BgReading size=" + data.size()); new Cleanup().execute(data); } catch (Exception e) { Log.e(TAG, "Got exception running cleanup " + e.toString()); } }
Example 10
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void deleteALL() { try { SQLiteUtils.execSql("delete from BgSendQueue"); SQLiteUtils.execSql("delete from BgReadings"); Log.d(TAG, "Deleting all BGReadings"); } catch (Exception e) { Log.e(TAG, "Got exception running deleteALL " + e.toString()); } }
Example 11
Source File: From.java From clear-todolist with GNU General Public License v3.0 | 5 votes |
public <T extends Model> List<T> execute() { if (mQueryBase instanceof Select) { return SQLiteUtils.rawQuery(mType, toSql(), getArguments()); } else { SQLiteUtils.execSql(toSql(), getArguments()); Cache.getContext().getContentResolver().notifyChange(ContentProvider.createUri(mType, null), null); return null; } }
Example 12
Source File: From.java From mobile-android-survey-app with MIT License | 5 votes |
public <T extends Model> List<T> execute() { if (mQueryBase instanceof Select) { return SQLiteUtils.rawQuery(mType, toSql(), getArguments()); } else { SQLiteUtils.execSql(toSql(), getArguments()); Cache.getContext().getContentResolver().notifyChange(ContentProvider.createUri(mType, null), null); return null; } }
Example 13
Source File: Reminder.java From xDrip with GNU General Public License v3.0 | 5 votes |
protected synchronized static void fixUpTable(String[] schema) { if (patched) return; for (String patch : schema) { try { SQLiteUtils.execSql(patch); } catch (Exception e) { // } } patched = true; }
Example 14
Source File: PlusModel.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
protected synchronized static boolean fixUpTable(String[] schema, boolean patched) { if (patched) return true; for (String patch : schema) { try { SQLiteUtils.execSql(patch); } catch (Exception e) { // } } return true; }
Example 15
Source File: PlusModel.java From xDrip with GNU General Public License v3.0 | 5 votes |
protected synchronized static boolean fixUpTable(String[] schema, boolean patched) { if (patched) return true; for (String patch : schema) { try { SQLiteUtils.execSql(patch); } catch (Exception e) { // } } return true; }
Example 16
Source File: UserNotification.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void fixUpTable() { if (patched) return; for (String patch : schema) { try { SQLiteUtils.execSql(patch); } catch (Exception e) { if (d) UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString()); } } patched = true; }
Example 17
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void deleteALL() { try { SQLiteUtils.execSql("delete from BgSendQueue"); SQLiteUtils.execSql("delete from BgReadings"); Log.d(TAG, "Deleting all BGReadings"); } catch (Exception e) { Log.e(TAG, "Got exception running deleteALL " + e.toString()); } }
Example 18
Source File: BgReading.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void cleanup(long timestamp) { try { SQLiteUtils.execSql("delete from BgSendQueue"); List<BgReading> data = new Select() .from(BgReading.class) .where("timestamp < ?", timestamp) .orderBy("timestamp desc") .execute(); if (data != null) Log.d(TAG, "cleanup BgReading size=" + data.size()); new Cleanup().execute(data); } catch (Exception e) { Log.e(TAG, "Got exception running cleanup " + e.toString()); } }
Example 19
Source File: UserNotification.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void fixUpTable() { if (patched) return; for (String patch : schema) { try { SQLiteUtils.execSql(patch); } catch (Exception e) { if (d) UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString()); } } patched = true; }
Example 20
Source File: Set.java From clear-todolist with GNU General Public License v3.0 | 4 votes |
public void execute() { SQLiteUtils.execSql(toSql(), getArguments()); }