public void WipeData() { lock (sqlite_lock) { db.Exec(DatasetColumns.BuildDelete(null)); db.Exec(RecordColumns.BuildDelete(null)); } }
public override void WipeData() { lock (SQLiteDatabase.SQLiteLock) { db.Exec(DatasetColumns.BuildDelete(null)); db.Exec(RecordColumns.BuildDelete(null)); } }
/// <summary> /// Wipes all locally cached data including dataset metadata and records. All /// opened dataset handler should not perform further operations to avoid /// inconsistent state. /// </summary> public void WipeData() { lock (sqlite_lock) { string query1 = DatasetColumns.BuildDelete(null); string query2 = RecordColumns.BuildDelete(null); ExecuteMultipleHelper(new List <Statement>() { new Statement { Query = query1 }, new Statement { Query = query2 } }); } }
private void DeleteDataset(string identityId, string datasetName, List <Statement> additionalStatements) { lock (sqlite_lock) { string deleteRecordsQuery = RecordColumns.BuildDelete( RecordColumns.IDENTITY_ID + " = @whereIdentityId AND " + RecordColumns.DATASET_NAME + " = @whereDatasetName " ); Statement s1 = new Statement { Query = deleteRecordsQuery, Parameters = new string[] { identityId, datasetName } }; string deleteDatasetQuery = DatasetColumns.BuildUpdate( new string[] { DatasetColumns.LAST_MODIFIED_TIMESTAMP, DatasetColumns.LAST_SYNC_COUNT }, DatasetColumns.IDENTITY_ID + " = @whereIdentityId AND " + DatasetColumns.DATASET_NAME + " = @whereDatasetName " ); Statement s2 = new Statement { Query = deleteDatasetQuery, Parameters = new object[] { AWSSDKUtils.CorrectedUtcNow.ToLocalTime(), -1, identityId, datasetName } }; List <Statement> statementsToExecute = new List <Statement>() { s1, s2 }; if (additionalStatements != null) { statementsToExecute.AddRange(additionalStatements); } ExecuteMultipleHelper(statementsToExecute); } }
public void DeleteDataset(string identityId, string datasetName) { lock (sqlite_lock) { SQLiteStatement stmt = null; try { stmt = db.Prepare( RecordColumns.BuildDelete( RecordColumns.IDENTITY_ID + " = @whereIdentityId AND " + RecordColumns.DATASET_NAME + " = @whereDatasetName" )); stmt.BindText(1, identityId); stmt.BindText(2, datasetName); stmt.Step(); stmt.FinalizeStm(); stmt = db.Prepare( DatasetColumns.BuildUpdate( new string[] { DatasetColumns.LAST_MODIFIED_TIMESTAMP, DatasetColumns.LAST_SYNC_COUNT }, DatasetColumns.IDENTITY_ID + " = @whereIdentityId AND " + DatasetColumns.DATASET_NAME + " = @whereDatasetName" )); stmt.BindDateTime(1, DateTime.Now); stmt.BindInt(2, -1); stmt.BindText(3, identityId); stmt.BindText(4, datasetName); stmt.Step(); } finally { stmt.FinalizeStm(); } } }