public override IJoinSourceQueryBuilder <TRecord> Join(IAliasedSelectSource source, JoinType joinType, CommandParameterValues parameterValues, Parameters parameters, ParameterDefaults parameterDefaults) { if (clauses.Count == 0) { throw new InvalidOperationException("Must have at least one 'ON' clause per join"); } intermediateJoins.Add(new Join(clauses.ToList(), joinSource, type)); clauses = new List <JoinClause>(); joinSource = source; type = joinType; var commandParameterValues = new CommandParameterValues(ParamValues, parameterValues); var combinedParameters = new Parameters(Params, parameters); var combinedParameterDefaults = new ParameterDefaults(ParamDefaults, parameterDefaults); ParamValues.Clear(); ParamValues.AddRange(commandParameterValues); Params.Clear(); Params.AddRange(combinedParameters); ParamDefaults.Clear(); ParamDefaults.AddRange(combinedParameterDefaults); return(this); }
/// <summary> /// 原生条件字符串 /// </summary> /// <param name="sqlString">id=? or name=?</param> /// <param name="args"></param> /// <returns></returns> public Sql Where(string sqlString, params object[] args) { if (string.IsNullOrWhiteSpace(sqlString)) { throw new Exception("数据库操作命令不能为空"); } var cmd = DB.GetRawSql(" " + sqlString + " ", args); if (cmd.SqlParams != null) { Params.AddRange(cmd.SqlParams); } // 如果有左括号,忽略逻辑运算符 if (hasParenthesis) { hasParenthesis = false; } else if (OtherCondition.Length > 0) { OtherCondition.Append(AndOr.And); } OtherCondition.Append(cmd.SqlString); return(this); }
/// <summary> /// Adds an array or variable string parameters to this request /// </summary> /// <param name="parameters"></param> /// <returns></returns> public Request AddParameters(params string[] parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } Params.AddRange(parameters); return(this); }
public LibFunction(ValueType returnType, params ValueType[] paramType) { switch (ReturnType = returnType) { case ValueType.Void: ReturnSlot = 0; break; case ValueType.Int: case ValueType.Float: ReturnSlot = 1; break; default: throw new Exception("not allowed return type"); } Params.AddRange(paramType); if (ReturnType != ValueType.Void) { Params.Insert(0, ReturnType); } }
public FunctionStatement(IToken token, IEnumerable<IToken> parameters, IEnumerable<IStatement> body) { Token = token; Params.AddRange(parameters); Body.AddRange(body); }