/// <summary> /// Adds and image to the database as a blob /// </summary> public void AddImage() { var path = imagePath.text.Trim(); // check that the path exists if (!File.Exists(path)) { Debug.LogError("Path does not exist! " + imagePath.text); return; } var id = 1; // read the bytes of the file from the path var imageData = File.ReadAllBytes(path); // get the next ID from the database var sql = "SELECT MAX(ID) + 1 ID FROM Images"; bool recordExists; var result = dbManager.QueryFirstRecord <Images>(out recordExists, sql); if (recordExists) { id = result.ID; } // insert the image as a byte array sql = "INSERT INTO Images (ID, ImageData) VALUES (?, ?)"; dbManager.Execute(sql, id, imageData); // reload images LoadImages(); }
public void saveResource(SimpleSQLManager dbManager, ResourceResp response) { ConfigRow configRow = LoadConfig(dbManager); if (response.latestVersion > configRow.ResourceVersion) { dbManager.BeginTransaction(); dbManager.Execute("UPDATE ConfigRow SET ResourceVersion = ? WHERE Id = ?", response.latestVersion, 1); Resource r; Resource[] list = response.list; for (int i = 0; i < list.Length; i++) { r = list[i]; dbManager.Execute("DELETE FROM ResourceRow WHERE Code = ? AND Lan = ?", r.code, r.lan); dbManager.Insert(new ResourceRow { Code = r.code, Lan = r.lan, Desc = r.desc }); } dbManager.Commit(); Debug.Log(list.Length + " ResourceRow records updated."); } }
//Delete the word private void deleteWord() { string wordsSql = "DELETE FROM SM_Words WHERE id = ?"; dbManager.Execute(wordsSql, PlayerPrefs.GetInt("CurrentWord")); //IF FILE EXISTS THEN DELETE IT if (wordHasAudio()) { string wordAudioSql = "DELETE FROM SM_WordAudio WHERE wordID = ?"; dbManager.Execute(wordAudioSql, PlayerPrefs.GetInt("CurrentWord")); System.IO.File.Delete(Application.persistentDataPath + "/" + PlayerPrefs.GetInt("CurrentWord").ToString() + ".wav"); } }
public SQLiteQuery ExecuteQuery(string sqlQuery, bool isStep)//执行查询 { Debug.Log("ExecuteQuery::" + sqlQuery); // // dbCommand = dbConnection.CreateCommand(); // // dbCommand.CommandText = sqlQuery; // // dbReader = dbCommand.ExecuteReader(); // // return dbReader; // SQLiteQuery qr = new SQLiteQuery(db, sqlQuery); // if(isStep){ // qr.Step(); // } // //qr.Release(); // return qr; dbManager.Execute(sqlQuery); return(null); }
public void SaveProfile(SimpleSQLManager dbManager, LoginResp response) { dbManager.BeginTransaction(); dbManager.Execute("DELETE FROM SessionRow WHERE Id = 1"); SessionRow row = new SessionRow(); row.Id = 1; row.Token = response.token; row.Mobile = response.mobile; row.Status = response.status; row.NickName = response.nickName; dbManager.Insert(row); dbManager.Commit(); }
/// <summary>删除所有数据</summary> public void DeleteAll() { m_DbManager.Execute("delete from CacheInfo", new object[] { }); }
private void deactivateLists() { string sql = "UPDATE SM_WordList SET isActive = 0 WHERE isActive = 1"; dbManager.Execute(sql); }
public void CleanProfile(SimpleSQLManager dbManager) { dbManager.Execute("DELETE FROM SessionRow WHERE Id = 1"); SceneManager.LoadScene("login"); }