Examples of newPreparedStatementCreator()


Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes);
    return pscf.newPreparedStatementCreator(params);
  }

  /**
   * Obtain a parsed representation of the given SQL statement.
   * @param sql the original SQL
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

      pscf.setGeneratedKeysColumnNames(keyColumnNames);
    }
    else {
      pscf.setReturnGeneratedKeys(true);
    }
    return getJdbcOperations().update(pscf.newPreparedStatementCreator(params), generatedKeyHolder);
  }

  public int[] batchUpdate(String sql, Map<String, ?>[] batchValues) {
    SqlParameterSource[] batchArgs = new SqlParameterSource[batchValues.length];
    int i = 0;
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes);
    return pscf.newPreparedStatementCreator(params);
  }

  /**
   * Obtain a parsed representation of the given SQL statement.
   * <p>The default implementation uses an LRU cache with an upper limit
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    JdbcTemplate j = getJdbcTemplate();
    PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
        "INSERT INTO resource_metadata (name,dimension_id,db_type,is_partitioning_resource) VALUES (?,?,?,?)",
        new int[] {Types.VARCHAR,Types.INTEGER,Types.VARCHAR,Types.BIT});
    creatorFactory.setReturnGeneratedKeys(true);
    int rows = j.update(creatorFactory
        .newPreparedStatementCreator(parameters), generatedKey);
    if (rows != 1)
      throw new HiveRuntimeException("Unable to create Resource: "
          + parameters);
    if (generatedKey.getKeyList().size() == 0)
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    JdbcTemplate j = getJdbcTemplate();
    PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
        "UPDATE resource_metadata SET name=?,dimension_id=?,db_type=?,is_partitioning_resource=? WHERE id=?",
        new int[] {Types.VARCHAR,Types.INTEGER,Types.VARCHAR,Types.INTEGER,Types.BIT});
    creatorFactory.setReturnGeneratedKeys(true);
    int rows = j.update(creatorFactory
        .newPreparedStatementCreator(parameters), generatedKey);
    if (rows != 1)
      throw new HiveRuntimeException("Unable to update Resource: " + resource.getId());
   
    // dependencies
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    parameters = new Object[] { resource.getId()};
    JdbcTemplate j = getJdbcTemplate();
    PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
        "DELETE FROM resource_metadata WHERE id=?",
        new int[] { Types.INTEGER });
    int rows = j.update(creatorFactory
        .newPreparedStatementCreator(parameters));
    if (rows != 1)
      throw new HiveRuntimeException("Unable to delete resource for id: " + resource.getId());
  }
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    JdbcTemplate j = getJdbcTemplate();
    PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
        "INSERT INTO secondary_index_metadata (resource_id,column_name,db_type) VALUES (?,?,?)",
        new int[] { Types.INTEGER, Types.VARCHAR, Types.VARCHAR });
    creatorFactory.setReturnGeneratedKeys(true);
    int rows = j.update(creatorFactory
        .newPreparedStatementCreator(parameters), generatedKey);
    if (rows != 1)
      throw new HiveRuntimeException("Unable to create secondary index: "
          + parameters);
    if (generatedKey.getKeyList().size() == 0)
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    JdbcTemplate j = getJdbcTemplate();
    PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
        "UPDATE secondary_index_metadata SET resource_id=?,column_name=?,db_type=? WHERE id=?",
        new int[] { Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER });
    creatorFactory.setReturnGeneratedKeys(true);
    int rows = j.update(creatorFactory
        .newPreparedStatementCreator(parameters), generatedKey);
    if (rows != 1)
      throw new HiveRuntimeException("Unable to update secondary index: " + secondaryIndex.getId());
  }
 
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    parameters = new Object[] { secondaryIndex.getId()};
    JdbcTemplate j = getJdbcTemplate();
    PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
        "DELETE FROM secondary_index_metadata WHERE id=?",
        new int[] { Types.INTEGER });
    int rows = j.update(creatorFactory
        .newPreparedStatementCreator(parameters));
    if (rows != 1)
      throw new HiveRuntimeException("Unable to delete secondary index for id: " + secondaryIndex.getId());
  }
View Full Code Here

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory.newPreparedStatementCreator()

    JdbcTemplate t = new JdbcTemplate(CachingDataSourceProvider.getInstance().getDataSource(uri));
    if (! tableExists(table.getName(), uri)) {
      final String createStatement = table.getCreateStatement();
      PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
          createStatement);
      t.update(creatorFactory.newPreparedStatementCreator(new Object[] {}));
    }
  }
 
  public static void emptyTables(Schema schema, String uri) {
    for (TableInfo table : schema.getTables(uri)) {
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.