<commit_before><commit_msg>String JDBC: PreparedStatementSetter example<commit_after>package com.gauravbytes.springjdbc;

import java.util.logging.Logger;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;

import com.gauravbytes.springjdbc.ds.JdbcDataSourceUtils;

/**
 * Example for {@link PreparedStatementSetter}
 * 
 * @author <NAME> <a href="https://gauravbytes.com">My blog</a>
 *         <a href="https://lineofcode.in">Website</a>
 */
public class PreparedStatementSetterExample {
	private static final Logger log = Logger.getGlobal();

	public static void main(String[] args) {
		JdbcTemplate jdbcTemplate = new JdbcTemplate(JdbcDataSourceUtils.getH2Database());
		jdbcTemplate.afterPropertiesSet();
		
		int updateCount = jdbcTemplate.update("insert into product(name, description) values(?,?)", ps -> {
			ps.setString(1, "Lenovo Bag");
			ps.setString(2, "Handcrafted bags by Lenovo");
		});
		
		log.info(() -> String.format("Product inserted: %d", updateCount));
	}
}
{'fraction_non_alphanumeric': 0.13588516746411483, 'fraction_numerical': 0.0028708133971291866, 'mean_word_length': 5.45679012345679, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7326094', 'n_tokens_mistral': 341, 'n_tokens_neox': 312, 'n_words': 64}