private TableAnalyser GetLoadedConstraints(TableStructure table) { { var res = (TableAnalyser)AnalyserCache.GetTableAnalyser("constraints"); if (res != null) { return(res); } res = (TableAnalyser)AnalyserCache.GetTableAnalyser("constraints:" + table.FullName.ToString()); if (res != null) { return(res); } } InformationSchema ins = InformationSchema.LoadSchemaOnce(GetDbConn, m_conn.GetConnKey()); if (m_members.TableFilter != null && m_members.TableFilter.Count == 1) { // load constraint for one table TableAnalyser ta = new TableAnalyser(); ConstraintsLoader loader = new ConstraintsLoader(GetDbConn(), ins, ta, table.FullName, m_members.TableMembers & GetConstraintLoadMode(), GetDbNameCondition()); loader.Run(); AnalyserCache.PutTableAnalyser("constraints:" + table.FullName.ToString(), ta); return(ta); } else { // load constraints for all tables TableAnalyser ta = new TableAnalyser(); ConstraintsLoader loader = new ConstraintsLoader(GetDbConn(), ins, ta, null, m_members.TableMembers & GetConstraintLoadMode(), GetDbNameCondition()); loader.Run(); AnalyserCache.PutTableAnalyser("constraints", ta); return(ta); } }
protected virtual void LoadConstraints(TableStructure table) { TableAnalyser ta = GetLoadedConstraints(table); ta.SaveConstraints(table, this); //table.FilledMembers |= m_members.TableMembers.FilterConstraints(false); }
public ConstraintsLoader(DbConnection conn, InformationSchema infoSchema, TableAnalyser analyser, NameWithSchema table, TableStructureMembers members, Condition dbnamecond) { m_conn = conn; m_infoSchema = infoSchema; m_table = table; m_analyser = analyser; m_members = members; m_dbnamecond = dbnamecond; }
public static void PutTableAnalyser(this DatabaseCache cache, string key, TableAnalyser value) { cache.Put("analyser.tableanal", key, value); }