Java 类org.springframework.jdbc.core.SqlProvider 实例源码

项目:buffer-slayer    文件:BatchJdbcTemplate.java   
public Promise<Integer, MessageDroppedException, ?> update(PreparedStatementCreator psc) throws DataAccessException {
  if (psc instanceof SqlProvider) {
    SqlProvider sqlProvider = (SqlProvider) psc;
    String sql = sqlProvider.getSql();

    Builder builder = Sql.builder().sql(sql);
    if (psc instanceof PreparedStatementSetter) {
      PreparedStatementSetter pss = (PreparedStatementSetter) psc;
      builder.preparedStatementSetter(pss);
    }
    return reporter.report(builder.build());
  }
  throw new UnsupportedOperationException("Must be instance of SqlProvider");
}
项目:qb-core    文件:RmJdbcTemplate.java   
/**
 * Determine SQL from potential provider object.
 * @param sqlProvider object that's potentially a SqlProvider
 * @return the SQL string, or <code>null</code>
 * @see SqlProvider
 */
private static String getSql(Object sqlProvider) {
    if (sqlProvider instanceof SqlProvider) {
        return ((SqlProvider) sqlProvider).getSql();
    }
    else {
        return null;
    }
}
项目:jdal    文件:DbAdminManagerSupport.java   
public boolean execute(final String sql) throws DataAccessException {
    if (log.isDebugEnabled()) {
        log.debug("Executing SQL statement [" + sql + "]");
    }
    class ExecuteStatementCallback implements StatementCallback<Boolean>, SqlProvider {
        public Boolean doInStatement(Statement stmt) throws SQLException {
            return stmt.execute(sql);
        }
        public String getSql() {
            return sql;
        }
    }

    return  template.execute(new ExecuteStatementCallback());
}
项目:javasec    文件:RmJdbcTemplate.java   
/**
 * Determine SQL from potential provider object.
 * @param sqlProvider object that's potentially a SqlProvider
 * @return the SQL string, or <code>null</code>
 * @see SqlProvider
 */
private static String getSql(Object sqlProvider) {
    if (sqlProvider instanceof SqlProvider) {
        return ((SqlProvider) sqlProvider).getSql();
    }
    else {
        return null;
    }
}
项目:java-lib    文件:RmJdbcTemplate.java   
/**
 * Determine SQL from potential provider object.
 * @param sqlProvider object that's potentially a SqlProvider
 * @return the SQL string, or <code>null</code>
 * @see SqlProvider
 */
private static String getSql(Object sqlProvider) {
    if (sqlProvider instanceof SqlProvider) {
        return ((SqlProvider) sqlProvider).getSql();
    }
    else {
        return null;
    }
}