Beispiel #1
0
        private ProcessFixedSQL getValueCountinFixedSQL(string FixedSQL, params string[] value)
        {
            ProcessFixedSQL pfs = new ProcessFixedSQL();

            pfs.Count = 0;

            for (int i = 0; i < value.Length; i++)
            {
                if (FixedSQL.Contains("{" + i.ToString() + "}") == true)
                {
                    FixedSQL = FixedSQL.Replace("{" + i.ToString() + "}", value[i]);
                    pfs.Count++;
                }
            }
            pfs.FixedSQL = FixedSQL;
            return(pfs);
        }
Beispiel #2
0
        private string MakeSQL(DBAgentTemplate dbaTemp, params string[] value)
        {
            string result = string.Empty;

            switch (dbaTemp.Information.SqlType)
            {
            default:
            case GlobalEnum.DBAgentSQLType.FixedSQL:       // 고정 SQL
                if (value != null)
                {
                    result = string.Format(dbaTemp.TemplateSQL.FixedSQL, value);
                }
                else
                {
                    result = dbaTemp.TemplateSQL.FixedSQL;
                }
                break;

            case GlobalEnum.DBAgentSQLType.DynamicSQL:
                StringBuilder          sb       = new StringBuilder();
                ProcessFixedSQL        pfx      = getValueCountinFixedSQL(dbaTemp.TemplateSQL.FixedSQL, value);
                string                 strSql   = pfx.FixedSQL;
                List <DynamicBodyData> BodyList = dbaTemp.TemplateSQL.DynamicBodys;
                for (int i = pfx.Count; i < value.Length; i++)
                {
                    if (!string.IsNullOrEmpty(value[i]) || (BodyList[i - pfx.Count].Gubun != null && BodyList[i - pfx.Count].Gubun == "1"))
                    {
                        strSql = strSql.Replace("#[" + BodyList[i - pfx.Count].Key + "]", String.Format(BodyList[i - pfx.Count].Body, value[i]));
                    }
                    else
                    {
                        strSql = strSql.Replace("#[" + BodyList[i - pfx.Count].Key + "]", string.Empty);
                    }
                }
                result = strSql;
                break;
            }
            return(result);
        }