public void Underwrite(PlaceHolders placeHolders) { foreach (KeyValuePair <string, string> kv in placeHolders) { this.Underwrite(kv.Key, kv.Value); } }
public void Add(PlaceHolders placeHolders) { foreach (KeyValuePair <string, string> kv in placeHolders) { this.Add(kv.Key, kv.Value); } }
/// <summary> /// IF文を判定し、条件がTrueになる入れ子SQL文を返す /// </summary> /// <param name="aDbConn">Db接続</param> /// <param name="ifSql">IF文</param> /// <param name="placeHolders">IF文の条件式に適用するPlaceHolder</param> /// <param name="aCacheStrategy"></param> /// <returns></returns> /// <remarks>条件がTrueになる入れ子SQL文がない場合、最大の表記順番+1を返す</remarks> public static SqlAndSeq Evaluate(IDbConn aDbConn , SqlBuilder ifSql , PlaceHolders placeHolders , Tran.CacheStrategy aCacheStrategy) { //IF文でない場合は渡されたSQLをそのまま返す if (ifSql.GetStatementType() != SqlBuilder.StatementType.If) { return(new SqlAndSeq(0, new SqlBuilders(new SqlBuilder[] { ifSql }))); } int i = 0; foreach (Tuple <SqlPredicate, SqlBuilders> branch in ifSql.GetIfBranches()) { //IF文の条件式にPlaceHolderを適用する branch.Item1.Place(placeHolders.ToDictionary()); string ifCondition = branch.Item1.ToString(); if (IfStatement.EvaluateCondition(aDbConn, ifCondition, aCacheStrategy)) { return(new SqlAndSeq(i, branch.Item2)); } i += 1; } return(new SqlAndSeq(i, new SqlBuilders())); }
private int ExecSqlImp(string sql, PlaceHolders placeHolders, IEnumerable <string> updateTables) { //Commandオブジェクトを生成する DbCommand aDbCommand = this.CreateDbCommand(sql, _aDbConnection, _aDbTransaction); foreach (var ph in placeHolders) { DbParameter aDbParameter = aDbCommand.CreateParameter(); aDbParameter.Direction = System.Data.ParameterDirection.Input; aDbParameter.ParameterName = ph.Key; aDbParameter.Value = ph.Value; aDbCommand.Parameters.Add(aDbParameter); } }
public int ExecSql(string sql, PlaceHolders placeHolders, IEnumerable <string> updateTables) { return(_state.ExecSql(this, sql, placeHolders, updateTables)); }