Example #1
0
        public void AliasUsed(string alias, string table)
        {
            DbTable t = tables[table];

            tablesByAlias.AddIfNotExists(alias, t);
            tablesByAlias.SetPosition(alias, t.AliasUsed(alias));
            activeTables.AddIfNotExists(t);
        }
Example #2
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);
        }
Example #3
0
 void HandleStrays()
 {
     if (strays.Count > 0)
     {
         foreach (DbTable table in candidateTables.GetEnumerator(null, QListSort.None))
         {
             candidateTables.SetPosition(table, candidateTables.ValueCount(table));
         }
         foreach (ColumnParts parts in strays)
         {
             parts.dbTable = candidateTables.FindFirstKeyWithValue(parts.t, null);
             if (parts.dbTable != null)
             {
                 AddColumn(new Column(parts.tAs, parts.tColumnAlias, parts.t, parts.tTableAlias, parts.dbTable, parts.alias));
             }
         }
     }
 }
Example #4
0
        public virtual void AnalyzeSummarize()
        {
            if (analyzeTableColumnAffinities)
            {
                foreach (DbTable t in tables.Values)
                {
                    t.FindAffinities();
                    t.AnalyzeAffinities();
                }
            }

            if (rankTables)
            {
                QDict <string, DbTable> rankList = new QDict <string, DbTable>(QListSort.Descending);

                QList <string> list = new QList <string>(QListSort.Descending);
                foreach (DbTable t in tables.Values)
                {
                    rankList.Add(t.name, t);
                    t.affinities.Add("rowCount", t.rowCount);
                    if (t.references.Count > 0)
                    {
                        t.affinities.Add("references", t.references.Count);
                    }
                }

                RankTablesByAffinity("references", 5, 7);
                RankTablesByAffinity("important", 5, 3);
                RankTablesByAffinity("descriptive", 5, 3);
                RankTablesByAffinity("label", 5, 3);
                //RankTablesByAffinity("quantity", 5, 2);
                RankTablesByAffinity("rowCount", 5, 2);
                foreach (DbTable t in tables.Values)
                {
                    rankList.SetPosition(t.objectName, Convert.ToInt32(1000 * t.importance));
                }

                Log("table rank");
                foreach (string nam in rankList.Keys)
                {
                    Log(" " + nam);
                }
            }
        }
Example #5
0
 public void TableUsed(string name)
 {
     activeTables.AddIfNotExists(tables[name]);
     tables.SetPosition(name, tables[name].Used());
 }