/// <summary> /// 随机数 /// </summary> /// <returns></returns> public static CsqCommonFunction Random() { CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { }, DBMathFunction.DoRandom, DbType.Double); //handle.ValueDataType = DefaultType.DoubleType; return(handle); }
/// <summary> /// 正切 /// </summary> /// <param name="value"></param> /// <returns></returns> public static CsqCommonFunction Tan(BQLValueItem value) { value.ValueDbType = DbType.Double; CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { value }, DBMathFunction.DoTan, DbType.Double); //handle.ValueDataType = DefaultType.DoubleType; return(handle); }
/// <summary> /// 反正弦函数 /// </summary> /// <param name="value">弧度</param> /// <returns></returns> public static CsqCommonFunction Asin(BQLValueItem value) { value.ValueDbType = DbType.Double; CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { value }, DBMathFunction.DoAsin, DbType.Double); //handle.ValueDbType = DbType.Double; return(handle); }
/// <summary> /// 判断是否为空 /// </summary> /// <param name="source">源值</param> /// <returns></returns> public static CsqCommonFunction Length(BQLValueItem source) { CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { source }, DBCommonFunction.Len, DbType.Int32); //handle.ValueDataType = DefaultType.IntType; return(handle); }
/// <summary> /// 求任意数为底的幂 /// </summary> /// <param name="value">数值</param> /// <param name="value2">几次方</param> /// <returns></returns> public static CsqCommonFunction Power(BQLValueItem value, BQLValueItem value2) { value.ValueDbType = DbType.Double; value2.ValueDbType = DbType.Int32; CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { value, value2 }, DBMathFunction.DoPower, DbType.Double); //handle.ValueDataType = DefaultType.DoubleType; return(handle); }
/// <summary> /// 按位异或运算 /// </summary> /// <param name="value1">数字1</param> /// <param name="value2">数字2</param> /// <returns></returns> public static CsqCommonFunction BitXOR(BQLValueItem value1, BQLValueItem value2) { value1.ValueDbType = DbType.Double; value2.ValueDbType = DbType.Double; CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { value1, value2 }, DBMathFunction.BitXOR, DbType.Double); //handle.ValueDataType = DefaultType.DoubleType; return(handle); }
/// <summary> /// 计算两个变量 x 和 y 的反正切值 /// </summary> /// <param name="y">定点的 y 坐标</param> /// <param name="x">定点的 x 坐标</param> /// <returns></returns> public static CsqCommonFunction Atan2(BQLValueItem y, BQLValueItem x) { x.ValueDbType = DbType.Double; y.ValueDbType = DbType.Double; CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { y, x }, DBMathFunction.DoAtan2, DbType.Double); //handle.ValueDataType = DefaultType.DoubleType; return(handle); }
/// <summary> /// 截取字符串 /// </summary> /// <param name="start">字符串起始位置</param> /// <param name="length">字符串长度</param> /// <returns></returns> public CsqCommonFunction SubString(BQLValueItem start, BQLValueItem length) { start.ValueDbType = DbType.Int32; length.ValueDbType = DbType.Int32; CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { this, start, length }, DBMathFunction.SubString, DbType.Int32); //handle.ValueDataType = DefaultType.IntType; handle.ValueDbType = DbType.Int32; return(handle); }
//private static BQLAlias _alias = new BQLAlias(); ///// <summary> ///// 别名函数 ///// </summary> //protected static BQLAlias ALIAS //{ // get // { // return _alias; // } //} #endregion #region 常用函数 //ICommonFunction common = DbAdapterLoader.Common; /// <summary> /// 判断是否为空 /// </summary> /// <param name="source">源值</param> /// <param name="nullValue">如果为空的话的输出值</param> /// <returns></returns> public static CsqCommonFunction IsNull(BQLValueItem source, BQLValueItem nullValue) { CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { source, nullValue }, DBCommonFunction.IsNull, source.ValueDbType); if (!CommonMethods.IsNull(nullValue)) { handle.ValueDbType = nullValue.ValueDbType; } else if (!CommonMethods.IsNull(source)) { handle.ValueDbType = source.ValueDbType; } return(handle); }
/// <summary> /// 查找字符 /// </summary> /// <param name="value">要查找的字符</param> /// <param name="start">起始位置</param> /// <returns></returns> public CsqCommonFunction IndexOf(object value, BQLValueItem start) { BQLValueItem oValue = BQLValueItem.ToValueItem(value);; start.ValueDbType = DbType.Int32; if (oValue.ValueDbType == DbType.Object) { oValue = DbType.String; } CsqCommonFunction handle = new CsqCommonFunction(new BQLValueItem[] { oValue, this, start }, DBMathFunction.IndexOf, DbType.Int32); //handle.ValueDataType = DefaultType.IntType; handle.ValueDbType = DbType.Int32; return(handle); }
/// <summary> /// distinct,不重复字段 /// </summary> /// <param name="param">字段</param> /// <returns></returns> public static CsqCommonFunction Distinct(params BQLParamHandle[] cparams) { CsqCommonFunction handle = new CsqCommonFunction(cparams, DBCommonFunction.Distinct, DbType.Object); return(handle); }