Exemplo n.º 1
0
        protected DataTable FilterTableColumns(string ns, DataTable allcols, NameWithSchema table)
        {
            var index = (DataTableIndex)AnalyserCache.Get(ns, "colscache");

            if (index == null)
            {
                int schemai = allcols.SafeOrdinal(AnalysingExtensions.SCHEMACOL);
                int tablei  = allcols.SafeOrdinal(AnalysingExtensions.TABLECOL);
                index = new DataTableIndex(allcols, schemai, tablei);
                AnalyserCache.Put(ns, "colscache", index);
            }
            return(index.Query(v => v == null || table.Schema == null || String.Compare(v, table.Schema, true) == 0, v => v == null || table.Name == null || String.Compare(v, table.Name, true) == 0));
            //var res = allcols.Clone();
            //foreach (DataRow row in allcols.Rows)
            //{
            //    if (table.Schema != null && String.Compare(row.SafeString(AnalysingExtensions.SCHEMACOL), table.Schema, true) != 0) continue;
            //    if (table.Name != null && String.Compare(row.SafeString(AnalysingExtensions.TABLECOL), table.Name, true) != 0) continue;
            //    res.ImportRow(row);
            //}
            //return res;
        }
Exemplo n.º 2
0
        public static DataTable GetTableColumns(this DatabaseCache cache, string ns, NameWithSchema table)
        {
            string key = table != null?table.ToString() : "@#all";

            return((DataTable)cache.Get(ns, key));
        }
Exemplo n.º 3
0
 public static TableAnalyser GetTableAnalyser(this DatabaseCache cache, string key)
 {
     return((TableAnalyser)cache.Get("analyser.tableanal", key));
 }
Exemplo n.º 4
0
 public static TableStructure GetQueryStructure(this DatabaseCache cache, string sql)
 {
     return((TableStructure)cache.Get("analyser.querystructure", sql));
 }
Exemplo n.º 5
0
 public static DataTable GetSqlData(this DatabaseCache cache, string sql)
 {
     return((DataTable)cache.Get("analyser.sqldata", sql));
 }