public static bool updateOrNewConfig(string key, string value) { MysqlDatas data = getValue(key); if (!data.hasRows) { InsertQueryBuilder query = new InsertQueryBuilder(); query.Table = _table; query.addValue("config_key", key); query.addValue("config_value", value); query.addValue("created_at", Helper.GetDatabaseDateFormat()); string cmd = query.BuildQuery(); return(Utils.Mysql.execute(cmd)); } else { UpdateQueryBuilder query = new UpdateQueryBuilder(); query.Table = _table; query.addSet("config_value", value); query.AddWhere("config_key", Comparison.Equals, key); string cmd = query.BuildQuery(); return(Utils.Mysql.execute(cmd)); } return(false); }
public static bool addValue(string value) { if (!Models.Faculty.getValue(value).hasRows) { InsertQueryBuilder query = new InsertQueryBuilder(); query.Table = _table; query.addValue("value", value); query.addValue("created_at", Helper.GetDatabaseDateFormat()); string cmd = query.BuildQuery(); bool result = Utils.Mysql.execute(cmd); return(result); } return(false); }