Package javacommon.xsqlbuilder

Examples of javacommon.xsqlbuilder.XsqlBuilder


    int pageNumber = pageRequest.getPageNumber();
    return pageQuery(sql, cn.org.rapid_framework.beanutils.PropertyUtils.describe(pageRequest), totalCount, pageSize, pageNumber,rowMapper);
  }

  protected XsqlBuilder getXsqlBuilder() {
    XsqlBuilder builder = new XsqlBuilder();
//    XsqlBuilder builder = new XsqlBuilder(SafeSqlProcesserFactory.getMysql());
    if(builder.getSafeSqlProcesser().getClass() == DirectReturnSafeSqlProcesser.class) {
      System.err.println("BaseSpringJdbcDao.getXsqlBuilder(): 故意报错,你未开启Sql安全过滤,单引号等转义字符在拼接sql时需要转义,不然会导致Sql注入攻击的安全问题,请修改源码使用new XsqlBuilder(SafeSqlProcesserFactory.getDataBaseName())开启安全过滤");
    }
    return builder;
  }
View Full Code Here


  public Page pageQuery(final String sql,String countQuery,final PageRequest pageRequest) {
    Map otherFilters = new HashMap(1);
    otherFilters.put("sortColumns", pageRequest.getSortColumns());
   
    XsqlBuilder builder = getXsqlBuilder();
   
    //混合使用otherFilters与pageRequest为一个filters使用
    XsqlFilterResult queryXsqlResult = builder.generateHql(sql,otherFilters,pageRequest);
    XsqlFilterResult countQueryXsqlResult = builder.generateHql(countQuery,otherFilters,pageRequest);
   
    return PageQueryUtils.pageQuery(getHibernateTemplate(),pageRequest,queryXsqlResult,countQueryXsqlResult);
  }
View Full Code Here

    SessionFactoryImpl sf = (SessionFactoryImpl)(getSessionFactory());
    Dialect dialect = sf.getDialect();
   
    //or SafeSqlProcesserFactory.getMysql();
    SafeSqlProcesser safeSqlProcesser = SafeSqlProcesserFactory.getFromCacheByHibernateDialect(dialect);
    XsqlBuilder builder = new XsqlBuilder(safeSqlProcesser);
   
    if(builder.getSafeSqlProcesser().getClass() == DirectReturnSafeSqlProcesser.class) {
      System.err.println(BaseHibernateDao.class.getSimpleName()+".getXsqlBuilder(): 故意报错,你未开启Sql安全过滤,单引号等转义字符在拼接sql时需要转义,不然会导致Sql注入攻击的安全问题,请修改源码使用new XsqlBuilder(SafeSqlProcesserFactory.getDataBaseName())开启安全过滤");
    }
    return builder;
  }
View Full Code Here

TOP

Related Classes of javacommon.xsqlbuilder.XsqlBuilder

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.