Пример #1
0
        public DBColumn ParseColumn(string name, DBSchema schema = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            DBColumn column = null;
            DBTable  table  = ParseTable(name, schema);

            int index = name.LastIndexOf('.');

            name = index < 0 ? name : name.Substring(index + 1);
            if (schema == null)
            {
                schema = DefaultSchema;
            }


            if (table != null)
            {
                column = table.ParseColumn(name);
            }
            else if (schema != null)
            {
                foreach (var t in schema.Tables)
                {
                    column = t.Columns[name];
                    if (column != null)
                    {
                        break;
                    }
                }
            }
            return(column);
        }
Пример #2
0
        public DBColumn ParseColumn(string name, DBSchema schema = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            DBTable table = ParseTable(name, schema);

            int index = name.LastIndexOf('.');

            name = index < 0 ? name : name.Substring(index + 1);
            return(table?.ParseColumn(name));
        }
Пример #3
0
 public DBComparerList(DBTable table, params string[] columns)
 {
     comparers = new List <IComparer>();
     foreach (string column in columns)
     {
         var dir = ListSortDirection.Ascending;
         if (column.EndsWith(" desc", StringComparison.OrdinalIgnoreCase))
         {
             dir = ListSortDirection.Descending;
         }
         string name = column.Trim().IndexOf(" ", StringComparison.Ordinal) > 0
                             ? column.Substring(0, column.IndexOf(" ", StringComparison.Ordinal))
                             : column;
         var dbColumn = table.ParseColumn(name);
         comparers.Add(dbColumn.CreateComparer(dir));
     }
 }
Пример #4
0
 public DBComparer(DBTable table, string column, ListSortDirection direction = ListSortDirection.Ascending)
     : this(table, table.ParseColumn(column), column, direction)
 {
 }