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; }
public static void PutTableColumns(this DatabaseCache cache, string ns, NameWithSchema table, DataTable value) { string key = table != null?table.ToString() : "@#all"; cache.Put(ns, key, value); }
public static void PutTableAnalyser(this DatabaseCache cache, string key, TableAnalyser value) { cache.Put("analyser.tableanal", key, value); }
public static void PutQueryStructure(this DatabaseCache cache, string sql, TableStructure value) { cache.Put("analyser.querystructure", sql, value); }
public static void PutSqlData(this DatabaseCache cache, string sql, DataTable value) { cache.Put("analyser.sqldata", sql, value); }