Package com.javaeye.jert.domain.query.impl

Examples of com.javaeye.jert.domain.query.impl.SimpleParameterQuery


   
    public static Query getQuery(String sql, String queryType){
        if(QUERY_TYPE_STATIC.equals(queryType)){
            return new StaticQuery(sql);
        }else if(QUERY_TYPE_SIMPLE_PARAMETER.equals(queryType)){
            return new SimpleParameterQuery(sql);
        }else if(QUERY_TYPE_DYNAMIC_PARAMETER.equals(queryType)){
            return new DynamicParameterQuery(sql);
        }else{
            throw new IllegalArgumentException(queryType + " is not supported");
        }
View Full Code Here


* @since    2004-12-26
* @version $Revision: 1.1 $
*/
public class SimpleParameterQueryTest extends TestCase {
    public void testParsing(){
        SimpleParameterQuery q1 = new SimpleParameterQuery("select * from user where age > #age#");
        assertEquals("select * from user where age > ?", q1.getSql(null));
       
        SimpleParameterQuery q2 = new SimpleParameterQuery("select * from user where age > #age# and name like #name#");
        assertEquals("select * from user where age > ? and name like ?", q2.getSql(null));
        assertEquals("age", q2.getParameterNames().get(0));
        assertEquals("name", q2.getParameterNames().get(1));
    }
View Full Code Here

TOP

Related Classes of com.javaeye.jert.domain.query.impl.SimpleParameterQuery

Copyright © 2018 www.massapicom. 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.