Package de.mhus.lib.parser

Examples of de.mhus.lib.parser.CompiledString.dump()


  public void  testSimple() throws ParseException {
    String sql = "SELECT * FROM hamster where aaa = 'alpha' AND bbb='beta'";
    SqlCompiler compiler = new SqlCompiler();
    CompiledString compiled = compiler.compileString(sql);
    StringBuffer sb = new StringBuffer();
    compiled.dump(sb);
    System.out.println(sb.toString());
   
    HashMap<String, Object> attributes = new HashMap<String, Object>();
    sb = new StringBuffer();
    compiled.execute(sb, attributes);
View Full Code Here


  public void testQuotes() throws ParseException {
    String sql = "SELECT 'aloa' FROM hamster where aaa = 'alpha' AND bbb='beta' ccc='wow''aha'";
    SqlCompiler compiler = new SqlCompiler();
    CompiledString compiled = compiler.compileString(sql);
    StringBuffer sb = new StringBuffer();
    compiled.dump(sb);
    System.out.println(sb.toString());
   
    HashMap<String, Object> attributes = new HashMap<String, Object>();
    sb = new StringBuffer();
    compiled.execute(sb, attributes);
View Full Code Here

  public void testAttribute() throws ParseException {
    String sql = "SELECT $raw$ FROM $val$ where aaa = '$val$'";
    SqlCompiler compiler = new SqlCompiler();
    CompiledString compiled = compiler.compileString(sql);
    StringBuffer sb = new StringBuffer();
    compiled.dump(sb);
    System.out.println(sb.toString());
   
    HashMap<String, Object> attributes = new HashMap<String, Object>();
    attributes.put("val", "wow");
    attributes.put("raw", new Raw("wow"));
View Full Code Here

  public void testMath() throws ParseException {
    String sql = "SELECT * FROM aaa WHERE a+b=c-7*3/2 AND z != -13";
    SqlCompiler compiler = new SqlCompiler();
    CompiledString compiled = compiler.compileString(sql);
    StringBuffer sb = new StringBuffer();
    compiled.dump(sb);
    System.out.println(sb.toString());
   
    HashMap<String, Object> attributes = new HashMap<String, Object>();
    attributes.put("val", "wow");
    attributes.put("raw", new Raw("wow"));
View Full Code Here

  public void testFunction() throws ParseException {
    String sql = "SELECT * FROM aaa WHERE round(a) = round(b) AND date(a,b) = diff(date(a),'1928-03-21')";
    SqlCompiler compiler = new SqlCompiler();
    CompiledString compiled = compiler.compileString(sql);
    StringBuffer sb = new StringBuffer();
    compiled.dump(sb);
    System.out.println(sb.toString());
   
    HashMap<String, Object> attributes = new HashMap<String, Object>();
    attributes.put("val", "wow");
    attributes.put("raw", new Raw("wow"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.