示例#1
0
        /// <summary>
        /// 获取类型值对应的数据库值的表达
        /// 包含安全考虑
        /// </summary>
        /// <param name="value">类型值</param>
        /// <returns>数据库类型值的表达</returns>
        public static string GetDbValueStatement(object value, bool needQuoted)
        {
            string valueStr = ValueConverter.TypeValueToDbValue(value);

            valueStr = SafeDbStatement(valueStr);

            if (valueStr == null)
            {
                return null;
            }

            if (needQuoted && MySQLUtility.IsValueNeedQuoted(value.GetType()))
            {
                valueStr = GetQuoted(valueStr);
            }

            return valueStr;
        }
示例#2
0
 public bool IsValueNeedQuoted(Type type)
 {
     return(MySQLUtility.IsValueNeedQuoted(type));
 }