Ejemplo n.º 1
0
        public DbTableConstraintColumn AddColumn(DbColumn cInfo, int seq = -1,
                                                 bool non = false, int card = -1)
        {
            DbTableConstraintColumn c = constraintColumns.ContainsKey(cInfo.objectName) ?
                                        constraintColumns[cInfo.objectName] : constraintColumns.Add(cInfo.objectName, new DbTableConstraintColumn(this, cInfo));

            c.seqInIndex  = seq;
            c.nonUnique   = non;
            c.cardinality = card;
            cInfo.constraints.Add(c);

            return(c);
        }
Ejemplo n.º 2
0
        void GetAccessibleTables(TablePath path)
        {
            DbTable t = path == null ? table : path.referencedTable;

            foreach (DbTableConstraint constraint in t.constraints.Values)
            {
                if (constraint.isForeignKey || constraint.type == "inferred")
                {
                    if (!paths.ContainsKey(constraint.referencedTable.objectName))
                    {
                        if (constraint.referencedTable != table)
                        {
                            TablePath p = new TablePath(constraint, path);
                            paths.Add(constraint.referencedTable.objectName, p);
                            GetAccessibleTables(p);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public int AliasUsed(string alias)
        {
            DbAlias a = aliases.ContainsKey(alias) ? aliases[alias] : null;

            if (a == null)
            {
                a = new DbAlias(alias, this);
                aliases.Add(alias, a);
            }
            int pos = a.Used();

            aliases.SetPosition(alias, pos);

            return(pos);
        }
Ejemplo n.º 4
0
 public DbTableConstraint GetOrAddConstraint(string nam, string typ)
 {
     return(constraints.ContainsKey(nam) ? constraints[nam] : constraints.Add(nam, new DbTableConstraint(nam, typ, this)));
 }
Ejemplo n.º 5
0
 public string GetTableNameByAlias(string alias, string def = "")
 {
     return(tablesByAlias.ContainsKey(alias) ? tablesByAlias[alias].name : def);
 }