Пример #1
0
        public override string FormatField(ConListField field)
        {
            switch (field.Adorn)
            {
            case Adorns.Average:
                return(String.Format("AVE(`{0}`) AS `{1}`", field.FieldName, field.AliasName));

            case Adorns.Distinct:
                return(String.Format("DISTINCT(`{0}`) AS `{1}`", field.FieldName, field.AliasName));

            case Adorns.Maximum:
                return(String.Format("MAX(`{0}`) AS `{1}`", field.FieldName, field.AliasName));

            case Adorns.Minimum:
                return(String.Format("MIN(`{0}`) AS `{1}`", field.FieldName, field.AliasName));

            case Adorns.None:
                if (field.FieldName == field.AliasName)
                {
                    return(String.Format("`{0}`", field.FieldName));
                }
                else
                {
                    return(String.Format("`{0}` AS `{1}`", field.FieldName, field.AliasName));
                }
                break;

            case Adorns.Substring:
                return(String.Format("SUBSTR(`{0}`," + (field.Start + 1)
                                     + "," + field.Length + ") AS `{1}`", field.FieldName, field.AliasName));

                break;

            case Adorns.Sum:
                return(String.Format("SUM(`{0}`) AS `{1}`", field.FieldName, field.AliasName));

                break;

            case Adorns.Total:
            default:
                return(String.Format("TOTAL(`{0}`) AS `{1}`", field.FieldName, field.AliasName));
            }
        }
Пример #2
0
 /// <summary>
 /// 格式化字段名(包括函数),用于扩展字段类
 /// </summary>
 /// <param name="conListField"></param>
 /// <returns></returns>
 public abstract string FormatField(ConListField conListField);