Examples of Sql


Examples of cc.concurrent.mango.SQL

     * @param method
     * @return
     * @throws Exception
     */
    public static CacheableOperator getOperator(Method method) throws Exception {
        SQL sqlAnno = method.getAnnotation(SQL.class);
        if (sqlAnno == null) {
            throw new IncorrectAnnotationException("each method expected one cc.concurrent.mango.SQL annotation " +
                    "but not found");
        }
        String sql = sqlAnno.value();
        if (Strings.isNullOrEmpty(sql)) {
            throw new IncorrectSqlException("sql is null or empty");
        }
        ASTRootNode rootNode = new Parser(sql).parse().reduce();
        SQLType sqlType = getSQLType(sql);
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

      assertTrue(newSql("UPDATE user_info SET username = #username#,password = #password# WHERE username = #username#").isUpdateSql());
      assertTrue(newSql("update user_info set username = #username#,password = #password#").isUpdateSql());
  }
 
  public void test_setSqlMap_and_replase_cdata() {
      Sql s = new Sql();
      s.setSqlmap("${cdata-start} 123 ${cdata-end}");
      assertEquals(s.getSqlmap(),"<![CDATA[ 123 ]]>");
  }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

//    sql.setTableSqlName("diy_user");
//    assertEquals("DiyUser",sql.getTableClassName());
//  }

  private Sql newSql(String string) {
    Sql sql = new Sql();
    sql.setSourceSql(string);
    return sql;
  }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

import cn.org.rapid_framework.generator.util.StringHelper;

public class Helper {
 
  public static Map getMapBySql(TableConfig t, String operation) {
    Sql sql = getSql(t,operation);
      Map map = newMapFromSql(sql,t);
    return map;
  }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

    public void testListner() throws SQLException, Exception {
//      sql = newSql(newOperation("queryUserInfo","select * from user_info"),null);
//   
//    assertEquals(sql.getResultClass(),"UserInfo");
   
      Sql sql = newSql(newOperation("queryUserInfo","select * from user_info"),"CustomUserInfo");
   
    assertEquals(sql.getResultClass(),"CustomUserInfo");
   
    }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

      tc.setClassName(customClassName);
    tc.setOperations(Arrays.asList(operation));
    set.addTableConfig(tc);
   
    List<Sql> sqls = tc.getSqls();
    Sql sql = sqls.get(0);
    return sql;
  }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

  }
 
  public void test_union() throws SQLException, Exception {
    String query = "select * from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?) ";
    String orderByQuery = "select * from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?) order by :orderby ";
    Sql sql = parser.parseSql(query+" union " + query);
    verifyParameters(sql,"userId","username","password","age","sex");
   
    sql = parser.parseSql(orderByQuery+" union " + orderByQuery);
    verifyParameters(sql,"userId","username","password","age","sex");
  }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

    sql = parser.parseSql(orderByQuery+" union " + orderByQuery);
    verifyParameters(sql,"userId","username","password","age","sex");
  }
 
  public void test_order_by() throws SQLException, Exception {
    Sql sql = parser.parseSql("select * from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?) order by :orderby :asc_desc");
    verifyParameters(sql,"userId","username","password","age","sex");
  }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

    Sql sql = parser.parseSql("select * from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?) order by :orderby :asc_desc");
    verifyParameters(sql,"userId","username","password","age","sex");
  }
  public void test_unscaped_xml() throws SQLException, Exception {
    try {
      Sql sql = parser.parseSql("select * from user_info where user_id &lt; :user_id");
      fail();
    }catch(RuntimeException e) {
    }
  }
View Full Code Here

Examples of cn.org.rapid_framework.generator.provider.db.sql.model.Sql

    }catch(RuntimeException e) {
    }
  }

  public void test_ListParam() throws SQLException, Exception {
    Sql sql = parser.parseSql("select * from user_info where user_id = #nameList[]# and password = #{pwdList[index]} and age = ${ageList[${index}]} ");
    verifyParameters(sql,"nameList","pwdList","ageList");
    assertTrue(sql.getParam("nameList").isListParam());
    assertTrue(sql.getParam("pwdList").isListParam());
    assertTrue(sql.getParam("ageList").isListParam());
  }
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.