/// <summary> /// Add a node to the tree following initial build /// </summary> /// <param name="node"></param> public static void AddNode(MetaTreeNode node) { if (MetaTreeFactory == null) { DebugMx.DataException("MetaTreeFactory instance is not defined"); } if (Nodes == null) { DebugMx.DataException("Nodes dictionary is null"); } if (node == null) { DebugMx.DataException("Node parameter is null"); } if (Lex.IsNullOrEmpty(node.Name)) { DebugMx.DataException("Node name is not defined"); } if (Nodes.ContainsKey(node.Name.ToUpper())) { return; } Nodes.Add(node.Name.ToUpper(), node); return; }
/// <summary> /// Build the sql for the query /// </summary> /// <param name="eqp"></param> /// <returns></returns> public override string BuildSql( ExecuteQueryParms eqp) { string sql = ""; Eqp = eqp; if (Eqp == null) { DebugMx.DataException("Eqp parameter is null"); } Qt = eqp.QueryTable; if (Qt == null) { DebugMx.DataException("Eqp.QueryTable is null"); } MetaTable mt = Qt.MetaTable; if (mt == null) { DebugMx.DataException("Metatable not defined for CalcField Query Table"); } Query q = eqp.Qe.Query; QueryTableData[] qtd = eqp.Qe.Qtd; // query table data QueryColumn qc; MetaColumn mc; KeyMc = mt.KeyMetaColumn; if (KeyMc == null) { throw new Exception("Key (compound number) column not found for MetaTable " + mt.Name); } KeyQci = Qt.GetQueryColumnIndexByName(KeyMc.Name); KeyQc = Qt.QueryColumns[KeyQci]; KeyQc.Selected = true; // be sure key is selected Qt.MetaTable.KeyMetaColumn.ColumnMap = ""; // reset key column mapping Query q2 = InitializeSubQuery(Qt); foreach (QueryTable qtx in q2.Tables) { // todo... } return(sql); }