Ejemplo n.º 1
0
        public static MySqlParameter AddQueryParam(this ZinSQL sql, string field, object value, bool addParam = false, string op = "=")
        {
            sql.SetParamQuery(field, op);

            if (addParam)
            {
                sql.AddParam(field);
            }

            return(new MySqlParameter(string.Format("@{0}", field), value));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        public void SaveData <T>(string type, T data, DatabaseConfig config = null)
            where T : new()
        {
#if NoneWriteSQL
            return;
#endif
            try
            {
                var sql       = new ZinSQL("game_data");
                var paramList = new List <MySqlParameter>();
                paramList.Add(sql.AddParam("DataValue", SerializationHelper.Serialize <T>(data)));
                paramList.Add(sql.AddParam("DataType", type));
                sql.SetQuery("DataType", type);
                sql.Config = config;

                InsertOrUpdate(sql, paramList);
            }
            catch (Exception ex)
            {
                // LogHelper.WriteErrorLog(ex);
                // LogHelper.WriteErrorLog(string.Format("Save Data {0} Error", type));
            }
        }
Ejemplo n.º 3
0
 public static MySqlParameter AddParam(this ZinSQL sql, string field, object value)
 {
     sql.AddParam(field);
     return(new MySqlParameter(string.Format("@{0}", field), value));
 }