//────────────────────────────────────────
        /// <summary>
        /// レコードセットを、名前を付けて一時記憶します。
        /// </summary>
        public void Execute_SaveRecordset(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Execute_SaveRecordset", log_Reports);
            //
            //

            //
            // 既に、一時記憶に同名のレコードセットがないか検索。

            string sStorage = this.Expression_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
            if (!this.Owner_MemoryApplication.MemoryRecordset.RecordsetStorage.Contains(this.Expression_Storage, log_Reports))
            {
                RecordSet dst_Rs_ToSave;
                Selectstatement selectSt_ToSave;
                {
                    if ("" == this.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                    {
                        //
                        // エラー。
                        goto gt_Error_EmptyTableName;
                    }

                    Table_Humaninput oTable = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        this.Expression_From,//これが空文字列の場合がある??
                        true,
                        log_Reports
                        );
                    dst_Rs_ToSave = new RecordSetImpl(oTable);

                    //
                    // 要求の作成。
                    {
                        // <startup-special-rule>の中で使う子要素。
                        selectSt_ToSave = new SelectstatementImpl(this, this.Cur_Configuration);
                        {
                            Recordcondition recCond1;// = new RecordconditionImpl(s_ParentNode);

                            // TODO: logic要素がある版も要るはず。
                            bool bSuccessful = RecordconditionImpl.TryBuild(
                                out recCond1,
                                EnumLogic.None,
                                this.Expression_Field.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports),
                                this.Cur_Configuration.Parent,
                                log_Reports
                                );
                            recCond1.Value = this.Expression_LookupVal.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                            selectSt_ToSave.List_Recordcondition.Add(recCond1);
                        }
                        selectSt_ToSave.Required = this.Expression_Required.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                        selectSt_ToSave.Expression_From = this.Expression_From;
                        selectSt_ToSave.Storage = this.Expression_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                    }
                }

                //
                // レコードの検索。
                {
                    //Configurationtree_Node
                    Configuration_Node parent_Cf_Query = this.Cur_Configuration.Parent;

                    // テーブル名。
                    if ("" == selectSt_ToSave.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                    {
                        //
                        // エラー。
                        goto gt_Error_EmptyTableName;
                    }

                    Table_Humaninput o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(selectSt_ToSave.Expression_From, true, log_Reports);

                    if (null == o_Table)
                    {
                        goto gt_Error_NullTable;
                    }

                    bool bExpectedValueRequired;
                    {
                        bool parseSuccessful = bool.TryParse(selectSt_ToSave.Required, out bExpectedValueRequired);
                    }

                    //
                    //
                    //
                    // 条件
                    //
                    //
                    //
                    string name_KeyField;
                    Fielddefinition fielddefinition_Key;
                    string value_Expected;
                    P2_ReccondImpl sel2 = new P2_ReccondImpl();
                    sel2.GetFirstAwhrReccond(
                        out name_KeyField,
                        out fielddefinition_Key,
                        out value_Expected,
                        selectSt_ToSave.List_Recordcondition,
                        o_Table,
                        log_Reports
                        );
                    List<DataRow> dst_Row = new List<DataRow>();

                    SelectPerformerImpl sp = new SelectPerformerImpl();
                    sp.Select(
                        out dst_Row,
                        name_KeyField,
                        value_Expected,
                        bExpectedValueRequired,
                        fielddefinition_Key,
                        o_Table.DataTable,
                        parent_Cf_Query,
                        log_Reports
                        );

                    dst_Rs_ToSave.AddList(dst_Row, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    //P2_SelectCellImpl sel2 = new P2_SelectCellImpl(this.MoOpyopyo);
                    //sel2.P2_Select(
                    //    ref dst_Rs_ToSave,
                    //    selectSt_ToSave,
                    //    this.Parent,
                    //    log_Reports
                    //    );
                }

                // debug:
                //if (false)
                //{
                //    StringBuilder txt = new StringBuilder();

                //    txt.Append(Info_E.LibraryName + ":" + this.GetType().Name + "#SaveRecordSet: 【検索してきたレコードセット】ここで内容消えてない?(2)?");
                //    txt.Append(" fld=[" + recordSet_toSave.Selectstatement.E_Field.E_Execute(log_Reports) + "]");
                //    txt.Append(" lookup-value=[" + recordSet_toSave.Selectstatement.E_Value.E_Execute( log_Reports) + "]");
                //    txt.Append(" description=[" + recordSet_toSave.Selectstatement.Expression_Description.E_Execute( log_Reports) + "]");
                //    txt.Append(" from=[" + recordSet_toSave.Selectstatement.Expression_From.E_Execute( log_Reports) + "]");
                //    txt.Append(" required=[" + recordSet_toSave.Selectstatement.E_Required.E_Execute( log_Reports) + "]");
                //    txt.Append(" Storage=[" + recordSet_toSave.Selectstatement.Expression_Storage.E_Execute( log_Reports) + "]");

                //    //txt.Append(" this.NFld=[" + RecordSet_toSave.NField.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]");
                //    //txt.Append(" this.NLookupValue=[" + RecordSet_toSave.NLookupValue.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]");
                //    //txt.Append(" this.NRequired=[" + RecordSet_toSave.NRequired.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]");
                //    //txt.Append(" this.NFrom=[" + RecordSet_toSave.NFrom.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]");

                //    //txt.Append(" ヒット件数=[" + RecordSet_toSave.O_Items.Count + "]");
                //    txt.Append(" ヒット件数=[" + recordSet.Count + "]");

                //    // レコードの内容
                //    //foreach (Dictionary<string, OValue> oRecord in RecordSet_toSave.O_Items)
                //    //{
                //    //    txt.Append(" フィールド数=[" + oRecord.Count + "]");
                //    //    foreach (string sKey in oRecord.Keys)
                //    //    {
                //    //        OValue oValue = oRecord[sKey];
                //    //        txt.Append(" 要素=[" + sKey + ":" + oValue.HumanInputString + "]");
                //    //    }
                //    //}
                //    foreach (DataRow record in recordSet)
                //    {
                //        txt.Append(" フィールド数=[" + record.Table.Columns.Count + "]");
                //        foreach (DataColumn column in record.Table.Columns)
                //        {

                //            Value_Humaninput oValue = (Value_Humaninput)record[column.ColumnName];

                //            txt.Append(" ★" + column.ColumnName + "=[" + oValue.Humaninput + "]");
                //        }
                //    }

                //    //ystem.Console.WriteLine(txt.ToString());
                //}

                // debug:
                //if (false)
                //{
                //    StringBuilder txt = new StringBuilder();

                //    txt.Append(Info_E.LibraryName + ":" + this.GetType().Name + "#SaveRecordSet:  【検索してきたレコードセット】内容入っていますか(3)?");

                //    txt.Append(" ヒット件数=[" + recordSet_toSave.O_Items.Count + "]←検索後");

                //    // レコードの内容
                //    foreach (Dictionary<string, Value_Humaninput> oRecord in recordSet_toSave.O_Items)
                //    {
                //        txt.Append(" フィールド数=[" + oRecord.Count + "]");
                //        foreach (string sKey in oRecord.Keys)
                //        {
                //            Value_Humaninput oValue = oRecord[sKey];
                //            txt.Append(" ■" + sKey + "=[" + oValue.Humaninput + "]");
                //        }
                //    }

                //    //ystem.Console.WriteLine(txt.ToString());
                //}

                //
                // レコードの一時保存。
                P4_RecordSetSaverImpl sel4 = new P4_RecordSetSaverImpl(this.Owner_MemoryApplication);
                sel4.P4_Save(
                    dst_Rs_ToSave,
                    this,
                    log_Reports
                    );
            }
            else
            {
                //ystem.Console.WriteLine(this.GetType().Name + "#SaveRecordSet: レコードセットは既に登録済みです。");
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_EmptyTableName:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration.Parent), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6030;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NullTable:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration.Parent), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6031;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Example #2
0
        /// <summary>
        /// セレクト文を作成します。
        /// </summary>
        /// <param name="out_bOneCellSelectCondition"></param>
        /// <param name="selectSt"></param>
        /// <param name="out_bExists_Awhr"></param>
        /// <param name="s_Fcell"></param>
        /// <param name="log_Reports"></param>
        private void E_Execute_P1_CleateSelect(
            out bool bOneCellSelectCondition_Out,//「フィールド名 = 値」の形のみ true。 エラー時もfalse。
            out Selectstatement selectSt,
            out bool bExists_Awhr_Out,//@whereの有無を返します。エラー時はfalse。
            Configuration_Node cf_Fcell,//「S■f-cell」。
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "E_Execute_P1_CleateSelect",log_Reports);
            //
            //

            //
            // 空っぽのセレクト文。
            //
            bExists_Awhr_Out = false;
            bOneCellSelectCondition_Out = false;
            selectSt = new SelectstatementImpl(this, cf_Fcell);
            Expression_Node_StringImpl ec_Awhr_Src = null;//子「E■where」

            //
            // (1)select=”☆”
            //    抽出する列名のリスト。
            //
            Expression_Node_String ec_Aselect = null;//ソース情報利用のE
            if (log_Reports.Successful)
            {
                this.TrySelectAttribute(out ec_Aselect, PmNames.S_SELECT.Name_Pm, EnumHitcount.One, log_Reports);
            }

            if (log_Reports.Successful)
            {
                selectSt.List_SName_SelectField = new CsvTo_ListImpl().Read(ec_Aselect.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
            }

            //
            // (2)into 属性
            //
            if (log_Reports.Successful)
            {
                Expression_Node_String ec_Into;//ソース情報利用のE
                bool bHit = this.TrySelectAttribute(out ec_Into, "into", EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit)
                {
                    selectSt.Expression_Into = ec_Into;
                }
            }

            //
            // (3)「E■@where」。無いものもある。
            //
            if (log_Reports.Successful)
            {
                Expression_Node_String ec_Awhr1_Src;
                this.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak)
                {
                    string sValue;
                    e_Child.TrySelectAttribute(out sValue, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);

                    if (NamesNode.S_FNC == e_Child.Cur_Configuration.Name &&
                        NamesFnc.S_WHERE == sValue)
                    {
                        ec_Awhr1_Src = e_Child;// Expression_Node_StringImpl である必要がある。E_String_AtomImplではダメ。

                        if (ec_Awhr1_Src is Expression_Node_StringImpl)
                        {
                            ec_Awhr_Src = (Expression_Node_StringImpl)ec_Awhr1_Src;
                        }
                        else
                        {
                            // エラー。
                            goto gt_Error_AtomWhr2;
                        }

                        bBreak = true;
                    }

                    goto gt_EndMethod2;

                // エラー。
                gt_Error_AtomWhr2:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();

                        Expression_Leaf_StringImpl ec_Leaf = (Expression_Leaf_StringImpl)ec_Awhr1_Src;
                        tmpl.SetParameter(1, ec_Leaf.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数

                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6015;", tmpl, log_Reports);
                    }
                    goto gt_EndMethod2;

                    //
                gt_EndMethod2:
                    ;
                });

                if (null != ec_Awhr_Src)
                {
                    // 子「E■where」あり。
                    bExists_Awhr_Out = true;
                }
                else
                {
                    // 正常。無いこともあります。
                    bExists_Awhr_Out = false;
                    Configurationtree_Node cf_Node = new Configurationtree_NodeImpl(this + ":Where属性該当なし", null);
                    ec_Awhr_Src = new Expression_Node_StringImpl(this, cf_Node);
                }
            }
            else
            {
                // エラーがあるのでさっさと抜ける。
                bOneCellSelectCondition_Out = false;
                bExists_Awhr_Out = false;
                goto gt_EndMethod;
            }

            //
            // (3)required=”★”
            //    レコードが1件以上ヒットすることが必須か。"true","TRUE"等。
            //
            if (log_Reports.Successful)
            {
                // <f-cell required=”☆”>を使う。

                //
                // <f-cell>は required属性を持たないはず。
                // <fnc name=”Sf:where;”>のrequired引数が登録される?
                //
                //

                string sRequired;
                bool bHit = this.TrySelectAttribute(out sRequired, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit)
                {
                    selectSt.Required = sRequired;
                }
                else
                {
                    //
                    // <f-cell>が required属性を持っていないとき。
                    //
                    //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていないとき。");

                    //
                    // where属性で「E■where」(fnc)を持っているはず。(無条件のときは持っていない)
                    //
                    Expression_Node_String ec_Whr;//属性利用
                    bool bHit2 = this.TrySelectAttribute(out ec_Whr, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                    if (bHit2)
                    {
                        bool bHit3 = ec_Whr.TrySelectAttribute(out sRequired, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                        if (bHit3)
                        {
                            selectSt.Required = sRequired;
                            //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得した。[" + selectSt.Required + "]");
                        }
                        else
                        {
                            // whereのrequired設定が未指定。

                            // #エラー
                            System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得しようとしたが、whereのrequiredは未設定だった。[" + selectSt.Required + "]");
                        }
                    }
                    else
                    {
                        //
                        // <f-cell>が、where属性を持っていない。 【正常】
                        //

                        //// required設定が未指定。

                        //// #エラー
                        //System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得しようとしたが、whereは未設定だった。[" + selectSt.Required + "]");

                        //if (bDbg1)
                        //{
                        //    System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect:┌────────┐this.E_AttrDic.Count=[" + this.E_AttrDic.Count + "]");
                        //    this.E_AttrDic.Each_E_Nodes(delegate(string sName, Expression_Node_String e_Child, ref bool bBreak)
                        //    {
                        //        System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: [" + sName + "]=[" + e_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                        //    });
                        //    System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect:└────────┘");
                        //}
                    }
                }
            }

            //
            // (4)テーブル名。"Ut:モンスター表"等。
            //
            if (log_Reports.Successful)
            {
                // <f-cell from=”☆”>を使う。
                Expression_Node_String ec_From;//ソース情報利用
                bool bHit = this.TrySelectAttribute(out ec_From, PmNames.S_FROM.Name_Pm, EnumHitcount.One, log_Reports);
                if (bHit)
                {
                    selectSt.Expression_From = ec_From;
                }

                // テーブル名は必須。
                if ("" == selectSt.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                {
                    //
                    // エラー。
                    //dst_Rs = null;
                    goto gt_Error_EmptyTableName;
                }
            }

            //
            // 「E■f-cell」は、子要素を持たない。
            //
            // 「E■f-cell」には、次の属性がある。
            // (1)「E■@where」
            //
            //
            // 「E■@where」は、次の子要素のリストがある。
            // ・「E■fnc name=”Sf:rec-cond;”」
            //

            //
            // f-cellの子要素の数は、where要素1つ、または 0 が正しい。
            //
            if (log_Reports.Successful)
            {
                // 子要素。
                List<Expression_Node_String> ecList = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports);
                //if (0 < e_List.Count)
                if (1 < ecList.Count)
                {
                    goto gt_Error_ExistsFcellChild;
                }
            }

            //
            // (2)探したいキー値の有無。"1000"等。
            if (log_Reports.Successful)
            {

                // key属性(@where)、record-set-load-from属性のどちらかが書かれているはず。

                if (
                    bExists_Awhr_Out ||
                    "" != selectSt.Expression_Where_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim()
                    )
                {
                    //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_PP1_FcellToSelectSt: 「E■a-where keyField=”☆”」は無かったが、「子E■rec-cond」要素はあった場合。");

                    // 次へ進む。
                }
                else
                {
                    // エラー。key値(@where)も、record-set-load-from属性もない。
                    goto gt_Error_EmptyKey;
                }
            }

            //
            // <f-cell>が、keyField=”★”属性("ID"などの値)を持つのは、R4-100版で廃止されました。
            //

            //
            // (5)あれば、「E■@where」の解析。(2012-02-07)
            //
            if (log_Reports.Successful)
            {
                if (bExists_Awhr_Out)
                {
                    // 「E■@where」条件が付いているとき。

                    // 「E■@where」の logic属性を取得しておく。
                    {
                        string sLogic;
                        bool bHit = ec_Awhr_Src.TrySelectAttribute(out sLogic, PmNames.S_LOGIC.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                        if (bHit)
                        {
                            selectSt.EnumWherelogic = Utility_Table.LogicStringToEnum(sLogic);
                            //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: where要素のlogic属性もきちんと読み取り。[" + sAwhrLogic + "]");
                        }
                    }

                    this.Execute_ParseChildRecordconditionList(
                        selectSt.List_Recordcondition,
                        ec_Awhr_Src,
                        log_Reports
                        );
                }
                else
                {
                    // 「E■@where」条件が無い場合。

                    // #警告。正常。
                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: 条件がないタイプ(whereを持たない)です。親ノード=" + this.Cur_Configuration.Parent);
                }
            }

            //
            // 「E■@where」は、2種類に判別。
            // (1)「E■rec-cond」が1つだけ入っている形式
            // (2)「E■rec-cond」が1つ以上入っている形式
            //
            if (log_Reports.Successful)
            {
                if (0 == selectSt.List_Recordcondition.Count())
                {
                    //
                    // 0個なら、無条件。
                    //
                }
                else if (1 == selectSt.List_Recordcondition.Count())
                {
                    //
                    // 「フィールド値=値」の形の条件式かどうかを調べます。
                    //

                    // ・<rec-cond>が1つ
                    Recordcondition firstReccond = selectSt.List_Recordcondition[0];
                    if (null == firstReccond)
                    {
                        // #エラー? TODO:エラー?
                        System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: rec-condリストにヌルが入っていた。エラー?");

                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // ・その<rec-cond>は logic属性を持たない。
                    if (EnumLogic.None != firstReccond.EnumLogic)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // field属性には1つのフィールド名が書かれている。(selectではないので、そうでなければエラー)
                    List<string> sList_FieldName = new CsvTo_ListImpl().Read(firstReccond.Name_Field);
                    if (1 != sList_FieldName.Count)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // valueを持つ。
                    if ("" == firstReccond.Value.Trim())
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    //「=」で結ばれている条件のもの。
                    if (EnumOpe.Eq != firstReccond.EnumOpe)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // 適合。「フィールド名=値」の形の条件式。セル1つが選ばれる。
                    bOneCellSelectCondition_Out = true;
                }
                else
                {
                    // 条件ハズレ。
                }
            }

            end_conditionSpec:

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_ExistsFcellChild:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.Cur_Configuration.Name, log_Reports);//設定ノード名

                List<Expression_Node_String> e_List = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports);
                tmpl.SetParameter(2, e_List.Count.ToString(), log_Reports);//子要素の数

                Log_TextIndented s = new Log_TextIndentedImpl();
                foreach (Expression_Node_String ec_Child in e_List)
                {
                    s.Append("Expr[" + ec_Child.Cur_Configuration.Name + "]");
                    s.Newline();
                }
                tmpl.SetParameter(3, s.ToString(), log_Reports);//要素のリスト

                tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6016;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyKey:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, bExists_Awhr_Out.ToString(), log_Reports);//Where句の有無
                tmpl.SetParameter(2, selectSt.Expression_Where_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(), log_Reports);//RecordSetLoadFrom属性
                tmpl.SetParameter(3, this.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数

                Log_TextIndented s1 = new Log_TextIndentedImpl();
                this.Dictionary_Expression_Attribute.ForEach(delegate(string sName3, Expression_Node_String e_Attr3, ref bool bBreak)
                {
                    s1.Append("Attribute[" + sName3 + "]=Expr[" + e_Attr3.Cur_Configuration.Name + "] 値=[" + e_Attr3.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    s1.Newline();
                });
                tmpl.SetParameter(4, s1.ToString(), log_Reports);//属性リスト

                tmpl.SetParameter(5, this.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//子要素の数

                Log_TextIndented s2 = new Log_TextIndentedImpl();
                this.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak)
                {
                    s2.Append("子 [" + e_Child.Cur_Configuration.Name + "]=[" + e_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    s2.Newline();
                });
                tmpl.SetParameter(6, s2.ToString(), log_Reports);//子要素リスト

                tmpl.SetParameter(7, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6017;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyTableName:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cf_Fcell), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6018;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// ユーザー定義プログラムの実行。
        /// </summary>
        /// <returns></returns>
        public override string Execute5_Main(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Execute5_Main", log_Reports);
            //
            //

            Configuration_Node parent_Configurationtree_Node_Query = this.Cur_Configuration;

            StringBuilder sb_Result = new StringBuilder();

            //
            // 外観
            //
            // <f-text-template table="Ut:条件テーブル" lookup-id="100">
            //
            // ・lookup-id は、lookup-value という名前の方が良かった。
            //

            //
            // 指定のテーブルの ID列を指定して、TEXT列の内容を取得。
            Builder_TexttemplateP1pImpl p1pText = new Builder_TexttemplateP1pImpl();
            {
                // <f-text-template>要素。
                Selectstatement selectSt = new SelectstatementImpl(this, this.Cur_Configuration);

                // TODO: logic属性がある版も要るはず。
                Recordcondition recCond1;
                bool bSuccessful = RecordconditionImpl.TryBuild(out recCond1, EnumLogic.None, Expression_SftextTemplate.S_FIELD_ID, parent_Configurationtree_Node_Query, log_Reports);
                selectSt.List_Recordcondition.Add(recCond1);

                ////
                //// (1)キー_フィールド名
                //{
                //    recCond1.Name_Field = "ID";
                //}

                //
                // (2)探したいキー値
                {
                    //
                    // thisは、<f-text-template>。
                    //

                    string sLookupId;
                    bool bHit = this.TrySelectAttribute(out sLookupId, PmNames.S_LOOKUP_ID.Name_Pm, EnumHitcount.One, log_Reports);
                    if (bHit)
                    {
                        recCond1.Value = sLookupId;
                    }

                    string sLookupValue;
                    if (log_Reports.Successful)
                    {
                        sLookupValue = recCond1.Value;
                    }
                    else
                    {
                        // エラー
                        goto gt_Error_NotFoundVariable;
                    }

                    // bug:
                    if ("" == sLookupValue.Trim())
                    {
                        //
                        // 検索キーが空欄の場合。
                        sb_Result.Length = 0; //空文字列にする。
                        goto gt_EndMethod;
                    }
                }

                //
                // (3)検索ヒットの必須の有無
                {
                    // 必須指定。
                    selectSt.Required = Expression_SftextTemplate.S_TRUE;
                }

                //
                // (4)テーブル名
                {
                    Expression_Node_String ec_Result;//ソース情報利用
                    bool bHit = this.TrySelectAttribute(out ec_Result, PmNames.S_TABLE.Name_Pm, EnumHitcount.One, log_Reports);
                    selectSt.Expression_From = ec_Result;
                }

                //
                // (5)欲しいデータのあるフィールド名
                selectSt.List_SName_SelectField.Add(Expression_SftextTemplate.S_FIELD_TEXT);

                //
                // (1)レコードセットの絞り込み。
                RecordSet dst_Rs;
                {
                    Table_Humaninput o_Tbl = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        selectSt.Expression_From,//これが空文字列の場合がある??
                        true,
                        log_Reports
                        );
                    dst_Rs = new RecordSetImpl(o_Tbl);
                }
                //dst_Rs.Selectstatement = selectSt;//★

                {

                    // テーブル名。
                    if ("" == selectSt.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                    {
                        //
                        // エラー。
                        goto gt_Error_EmptyTableName;
                    }

                    Table_Humaninput o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(selectSt.Expression_From, true, log_Reports);

                    if (null == o_Table)
                    {
                        goto gt_Error_NullTable;
                    }

                    bool isRequired_ExpectedValue;
                    {
                        bool parseSuccessful = bool.TryParse(selectSt.Required, out isRequired_ExpectedValue);
                    }

                    //
                    //
                    //
                    // 条件
                    //
                    //
                    //
                    string name_KeyField;
                    Fielddefinition fielddefinition_Key;
                    string value_Expected;
                    P2_ReccondImpl sel2 = new P2_ReccondImpl();
                    sel2.GetFirstAwhrReccond(
                        out name_KeyField,
                        out fielddefinition_Key,
                        out value_Expected,
                        selectSt.List_Recordcondition,
                        o_Table,
                        log_Reports
                        );

                    List<DataRow> dst_Row = new List<DataRow>();

                    if (log_Reports.Successful)
                    {
                        SelectPerformerImpl sp = new SelectPerformerImpl();
                        sp.Select(
                            out dst_Row,
                            name_KeyField,
                            value_Expected,
                            isRequired_ExpectedValue,
                            fielddefinition_Key,
                            o_Table.DataTable,
                            parent_Configurationtree_Node_Query,
                            log_Reports
                            );
                    }

                    if (log_Reports.Successful)
                    {
                        dst_Rs.AddList(dst_Row, log_Reports);
                    }

                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }

                if (!log_Reports.Successful)
                {
                    //
                    // エラーが出ていたら、さっさと抜ける。
                    //sResult = "";
                    goto gt_EndMethod;
                }

                //
                // フィールド値の取得。
                P5_CellsSelecterImpl sel5 = new P5_CellsSelecterImpl(this.Owner_MemoryApplication);
                List<List<string>> sListList_reslt = sel5.P5_Select_CellType(
                    dst_Rs,
                    selectSt,
                    null,//nwhere_recordSetSaveTo,
                    this.Cur_Configuration,
                    log_Reports
                    );

                if (0 < sListList_reslt.Count)
                {
                    // 先頭行の、
                    List<string> sList_Fld = sListList_reslt[0];
                    // 先頭フィールドの値。
                    string sString = sList_Fld[0];

                    //e_string.SetValidation(...);
                    p1pText.Text = sString;
                }
                else
                {
                    // エラー

                    Log_TextIndented txt = new Log_TextIndentedImpl();
                    txt.Append(this.GetType().Name);
                    txt.Append("#GetString:(" + Info_Expr.Name_Library + ") エラー。該当なし。");

                    txt.Append(" 選択フィールド=[");

                    txt.Append(selectSt.ToSelectFieldNameListCsv());

                    txt.Append("]");

                    txt.Append(" テーブル=[");

                    txt.Append(selectSt.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                    txt.Append("]");

                    // キーフィールド
                    txt.Append(" [");

                    txt.Append(recCond1.Name_Field);

                    txt.Append("]が");

                    // 探す値。
                    txt.Append("[");
                    txt.Append(recCond1.Value);
                    txt.Append("]のとき");

                    p1pText.Text = txt.ToString();
                }

            }

            List<int> nList_P1p = p1pText.ExistsP1pNumbers(
                this.Dictionary_Expression_Attribute,
                log_Reports
                );

            foreach (int n_P1p in nList_P1p)
            {
                string p1pValue;
                {
                    bool bHit = this.TrySelectAttribute(
                        out p1pValue,
                        "p" + n_P1p+"p",
                        EnumHitcount.One,
                        log_Reports
                        );

                    if (log_Reports.Successful)
                    {
                    }
                    else
                    {
                        p1pValue = null;
                    }

                    p1pText.Dictionary_NumberAndValue_Parameter.Add(n_P1p, p1pValue);
                }
            }

            Expression_Node_String ec_TextTemplate = p1pText.Compile(
                log_Reports
                );

            sb_Result.Append(ec_TextTemplate.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));

            //
            //
            //
            // TODO: 制約の判定
            //
            //
            //

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFoundVariable:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Configurationtree_Node_Query), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6009;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyTableName:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Configurationtree_Node_Query), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6010;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NullTable:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Configurationtree_Node_Query), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6011;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return sb_Result.ToString();
        }