public static void UpdateMyTestToMySQL() { //删除表 string commandText = "DROP TABLE MyTest"; DatabaseManager.GetInstance().DoSQLUpdateDelete(commandText); //创建表 commandText = "CREATE TABLE MyTest ("; commandText += DTMySQLExtenion.GetMySQLCreateTable_PK("Id"); commandText += DTMySQLExtenion.GetMySQLCreateTable_string("Name", ""); commandText += DTMySQLExtenion.GetMySQLCreateTable_string("ClassName", ""); commandText += DTMySQLExtenion.GetMySQLCreateTable_string("Info", "200"); commandText += DTMySQLExtenion.GetMySQLCreateTable_int("Score", ""); commandText = commandText.Substring(0, commandText.Length - 1); commandText += ");"; DatabaseManager.GetInstance().OpenDatabase(); DatabaseManager.GetInstance().DoSQLUpdateDelete(commandText); //数据库插入数据 DTMySQL_MyTest_Manager.Instance.ReloadAll(true); }
public bool UpdateToMySQL() { string commandText = string.Format("select * from {0} where {1}={2};", "Test", "Id", DTMySQLExtenion.GetMySQLValue_int(Id)); if (string.IsNullOrEmpty(DatabaseManager.GetInstance().GetSQLSelectString(commandText))) { //插入 commandText = "insert into Test("; commandText += string.Format(" {0},", "Id"); commandText += string.Format(" {0},", "Value1"); commandText += string.Format(" {0},", "Value"); commandText = commandText.Substring(0, commandText.Length - 1); commandText += ") values("; commandText += string.Format("{0},", DTMySQLExtenion.GetMySQLValue_int(Id)); commandText += string.Format("{0},", DTMySQLExtenion.GetMySQLValue_float(Value1)); commandText += string.Format("{0},", DTMySQLExtenion.GetMySQLValue_string(Value)); commandText = commandText.Substring(0, commandText.Length - 1); commandText += ");"; UnityEngine.Debug.Log("插入: " + commandText); } else { //更新 commandText = "update Test set "; commandText += string.Format(" {0}={1},", "Value1", DTMySQLExtenion.GetMySQLValue_float(Value1)); commandText += string.Format(" {0}={1},", "Value", DTMySQLExtenion.GetMySQLValue_string(Value)); commandText = commandText.Substring(0, commandText.Length - 1); commandText += string.Format(" where Id={0};", DTMySQLExtenion.GetMySQLValue_int(Id)); UnityEngine.Debug.Log("更新: " + commandText); } return(DatabaseManager.GetInstance().DoSQLUpdateDelete(commandText)); }
public List <DTMySQL_Test> LoadByValue(string Value) { string commandText = string.Format("select* from {0} where {1}={2};", "Test", "Value", DTMySQLExtenion.GetMySQLValue_string(Value)); return(LoadBy_MySQLComTextInternal(commandText)); }
public DTMySQL_Test LoadById(int Id) { string commandText = string.Format("select* from {0} where {1}={2};", "Test", "Id", DTMySQLExtenion.GetMySQLValue_int(Id)); List <DTMySQL_Test> tempList = LoadBy_MySQLComTextInternal(commandText); return(tempList.Count > 0 ? tempList[0]:null); }
public bool DeleteInMySQL() { string commandText = string.Format("delete from {0} where Id = {1};", "MyTest", DTMySQLExtenion.GetMySQLValue_int(Id)); UnityEngine.Debug.Log("删除: " + commandText); return(DatabaseManager.GetInstance().DoSQLUpdateDelete(commandText)); }
public List <DTMySQL_MyTest> LoadByScore(int Score) { string commandText = string.Format("select* from {0} where {1}={2};", "MyTest", "Score", DTMySQLExtenion.GetMySQLValue_int(Score)); return(LoadBy_MySQLComTextInternal(commandText)); }
public List <DTMySQL_MyTest> LoadByInfo(string Info) { string commandText = string.Format("select* from {0} where {1}={2};", "MyTest", "Info", DTMySQLExtenion.GetMySQLValue_string(Info)); return(LoadBy_MySQLComTextInternal(commandText)); }
public List <DTMySQL_MyTest> LoadByClassName(string ClassName) { string commandText = string.Format("select* from {0} where {1}={2};", "MyTest", "ClassName", DTMySQLExtenion.GetMySQLValue_string(ClassName)); return(LoadBy_MySQLComTextInternal(commandText)); }