Пример #1
0
 public string CompilarInitial(CompilerWithFuzzy.Compiler.Syn.ParseTree.Container c)
 {
     if (c.ContainsKey("campo") && c.ContainsKey("tabela") && c.ContainsKey("condicao"))
     {
         return(string.Format("SELECT {0} FROM {1} {2}",
                              DicCompileExample[c["campo"].TypeName](c["campo"]),
                              DicCompileExample[c["tabela"].TypeName](c["tabela"]), c.ContainsKey("condicao") ?
                              DicCompileExample[c["condicao"].TypeName](c["condicao"]) : string.Empty));
     }
     else if (c.ContainsKey("tabela") && c.ContainsKey("condicao"))
     {
         return(string.Format("SELECT {0} FROM {1} {2}",
                              "*",
                              DicCompileExample[c["tabela"].TypeName](c["tabela"]), c.ContainsKey("condicao") ?
                              DicCompileExample[c["condicao"].TypeName](c["condicao"]) : string.Empty));
     }
     else
     {
         return("SELECT * FROM " + DicCompileExample[c["tabela"].TypeName](c["tabela"]));
     }
 }
Пример #2
0
 public string Condicao(CompilerWithFuzzy.Compiler.Syn.ParseTree.Container c)
 {
     return(string.Format("WHERE {0} > {1}",
                          CompilarCampoSemAlias(c["campo"]),
                          c["numero"].Value));
 }
Пример #3
0
 public string CompilarCampoSemAlias(CompilerWithFuzzy.Compiler.Syn.ParseTree.Container c)
 {
     return(c["nomecampo"].Value.ToLower() == "codigo" ? "ID" : c["nomecampo"].Value);
 }