Esempio n. 1
0
        public TableSymbol MergeSymbols(TableSymbol other)
        {
            var symbol = new TableSymbol();

            var compundTableColumns = new List <ISchemaColumn>();

            foreach (var item in _tables)
            {
                symbol._tables.Add(item.Key, item.Value);
                symbol._orders.Add(item.Key);

                compundTableColumns.AddRange(item.Value.Item2.Columns);
            }

            foreach (var item in other._tables)
            {
                symbol._tables.Add(item.Key, item.Value);
                symbol._orders.Add(item.Key);

                compundTableColumns.AddRange(item.Value.Item2.Columns);
            }

            symbol._fullTableName = symbol._orders.Aggregate((a, b) => a + b);
            symbol._fullTable     = new DynamicTable(compundTableColumns.ToArray());
            symbol._fullSchema    = new TransitionSchema(symbol._fullTableName, symbol._fullTable);

            return(symbol);
        }
Esempio n. 2
0
        public TableSymbol MakeNullableIfPossible()
        {
            var symbol = new TableSymbol();
            var compundTableColumns = new List <ISchemaColumn>();

            foreach (var column in _fullTable.Columns)
            {
                compundTableColumns.Add(ConvertColumnToNullable(column));
            }

            foreach (var item in _tables)
            {
                var dynamicTable = new DynamicTable(item.Value.Item2.Columns.Select(c => ConvertColumnToNullable(c)).ToArray());
                symbol._tables.Add(item.Key, new Tuple <ISchema, ISchemaTable>(item.Value.Item1, dynamicTable));
                symbol._orders.Add(item.Key);
            }

            symbol._fullTableName = symbol._orders.Aggregate((a, b) => a + b);
            symbol._fullTable     = new DynamicTable(compundTableColumns.ToArray());
            symbol._fullSchema    = new TransitionSchema(symbol._fullTableName, symbol._fullTable);

            return(symbol);
        }