Examples of Sql


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

    assertTrue(sql.getParam("pwdList").isListParam());
    assertTrue(sql.getParam("ageList").isListParam());
  }
 
  public void test_select() throws SQLException, Exception {
    Sql sql = parser.parseSql("select * from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?)");
    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"user_id","username","password","BIRTH_DATE","age","sex");
  }
View Full Code Here

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

    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"user_id","username","password","BIRTH_DATE","age","sex");
  }
 
  public void test_聚合函数() throws SQLException, Exception {
    Sql sql = parser.parseSql("select DISTINCT(count(*)) DISTINCT_count,count(username) cnt_username,sum(age) sum_age,avg(sex) avg_sex from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?)");
    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"DISTINCT_count","cnt_username","sum_age","avg_sex");
  }
View Full Code Here

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

    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"DISTINCT_count","cnt_username","sum_age","avg_sex");
  }

  public void test_聚合函数2() throws SQLException, Exception {
    Sql sql = parser.parseSql("select DISTINCT username from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?)");
    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"username");
  }
View Full Code Here

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

    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"username");
  }

  public void test_group_by() throws SQLException, Exception {
    Sql sql = parser.parseSql("select DISTINCT username from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?) group by username");
    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"username");
  }
View Full Code Here

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

    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"username");
  }

  public void test_join() throws SQLException, Exception {
    Sql sql = parser.parseSql("select DISTINCT t1.username from user_info t1 inner join user_info t2 on t1.user_id=t2.user_id where t1.user_id = ? and t1.age = ? and t1.password = ? and t1.username like ? or (t1.sex >= ?) group by t1.username");
    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"username");
  }
View Full Code Here

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

    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"username");
  }

  public void test_select_with_table_alias() throws SQLException, Exception {
    Sql sql = parser.parseSql("select * from user_info t where t.user_id = ? and t.age = ? and t.password = ? and t.username like ? or (t.sex >= ?)");
    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"userId","username","password","BIRTH_DATE","age","sex");
  }
View Full Code Here

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

    verifyParameters(sql,"userId","username","password","age","sex");
    verifyColumns(sql,"userId","username","password","BIRTH_DATE","age","sex");
  }
 
  public void test_group_by_having() throws SQLException, Exception {
    Sql sql = parser.parseSql("select sum(age) sum_age from user_info where user_id = ? and age = ? and password = ? and username like ? or (sex >= ?) group by username having sum(age) = :havingUsername");
    verifyParameters(sql,"userId","username","password","age","sex","havingUsername");
    verifyColumns(sql,"sum_age");
  }
View Full Code Here

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

    verifyParameters(sql,"userId","username","password","age","sex","havingUsername");
    verifyColumns(sql,"sum_age");
  }

    public void test_select_for_mybatis_foreach() throws SQLException, Exception {
        Sql sql = parser.parseSql("select * from user_info where user_id = ? and username = #{usernamesByIndex[index]}");
        verifyParameters(sql,"userId","usernamesByIndex");
       
        sql = parser.parseSql("select * from user_info where user_id = ? and username = #{usernamesByIndex[${index}]}");
        verifyParameters(sql,"userId","usernamesByIndex");
       
View Full Code Here

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

        sql = parser.parseSql("select * from user_info where user_id = ? and username = #{item}");
        verifyParameters(sql,"userId","item");
    }

   public void test_select_for_ibatis_foreach() throws SQLException, Exception {
       Sql sql = parser.parseSql("select * from user_info where user_id = ? and username = #usernamesByIndex[]#");
       verifyParameters(sql,"userId","usernamesByIndex");
   }
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 username = #usernamesByIndex[]#");
       verifyParameters(sql,"userId","usernamesByIndex");
   }
  
  public void test_select_willcard() throws SQLException, Exception {
    Sql sql = parser.parseSql("select * from user_info where user_id = ? and username = :username");
    verifyParameters(sql,"userId","username");
    String expected = "select USER_ID,USERNAME,PASSWORD,BIRTH_DATE,SEX,AGE from user_info where user_id = #userId# and username = :username";
    assertStringEquals(expected,sql.getIbatisSql());
  }
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.